Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Fix exception when _noMatchCache contains the 'hasOwnProperty' property #3417

Merged
merged 2 commits into from
Apr 12, 2013

Conversation

dloverin
Copy link

When _noMatchCache sets "hasOwnProperty" as a property it overwrites the "hasOwnProperty" function. An exception will be thrown on the next call to _noMatchCache.hasOwnProperty().

@ghost ghost assigned dangoor Apr 11, 2013
@peterflynn
Copy link
Member

This should use CollectionUtils.hasProperty() like the code just below here. Good catch though! Can't believe we missed that in the last round of fixes for this (#3004).

@ghost ghost assigned peterflynn Apr 11, 2013
@dangoor
Copy link
Contributor

dangoor commented Apr 11, 2013

I was going to make the same suggestion. I also added this test in the process:

            it("should not have problem with a cache entry called hasOwnProperty", function () {
                var matcher = new StringMatch.StringMatcher();
                matcher._noMatchCache.hasOwnProperty = true;
                matcher.match("foo", "bar");
                // no exception
            });

@peterflynn
Copy link
Member

Looks good, thanks for the fast turnaround!

@dangoor I'm putting together a little unit-test cleanup pull request that adds a few small testcases... I can tack on your unit test suggestion there so it gets in soon.

peterflynn added a commit that referenced this pull request Apr 12, 2013
Fix exception when _noMatchCache contains the 'hasOwnProperty' property
@peterflynn peterflynn merged commit b53fb37 into adobe:master Apr 12, 2013
@dangoor
Copy link
Contributor

dangoor commented Apr 12, 2013

thanks @peterflynn!

@dloverin dloverin deleted the StringMatchCacheFix branch April 12, 2013 02:17
peterflynn added a commit that referenced this pull request Apr 12, 2013
* DocumentManager: use CollectionUtils.forEach() in notifyPathNameChanged()
(removing early-exit optimization that's probably unneeded; can reintroduce
when CollectionUtils.some() lands)
* Move filename->language mapping tests from Editor-test to LanguageManager-test
* Add another #330 testcase as suggested by Glenn in #3064
* Add StringMatch testcases as suggested by Kevin in #3417
* SpecRunnerUtils: use waitsForDone() more
* CSSUtils-test: remove unused vars
* Dialogs: tiny docs improvement
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants