-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Fix JS Quick Edit for projects that have a function named "hasOwnProperty" #3004
Conversation
I think this is basically plugging a hole in my earlier fix #2816 (sorry!). That patch made a similar It would also be good to augment the unit tests that #2816 added (https://github.com/adobe/brackets/pull/2816/files#L6R255 and https://github.com/adobe/brackets/pull/2816/files#L6R443 and https://github.com/adobe/brackets/pull/2816/files#L8R634) to cover this bug too. |
I'd bet we have similar bugs with some of the other built-in Object properties (constructor, isPrototypeOf, valueOf, etc.)... worth trying to fix those here, or should we just do a spin-off bug? [Edit: or maybe not... I guess the original #2816 fix should in theory cover all cases except for hasOwnProperty() already] |
One other thought: if we're using this hasOwnProperty.apply() trick in a few places, is it worth adding a utility fn for it? (CollectionUtils maybe?) |
@gruehle done reviewing |
@peterflynn - thanks for the review! I've made all your suggested changes. Ready for re-review. |
Hehe, JSHint doesn't like the |
…Hint correctly stated: 'hasOwnProperty is a really bad name.'
Yep :-). This is one case where JSHint complained more than JSLInt. Changed to "hasProperty". |
It kind of makes sense, since we are fixing the problem of a project having a |
Looks good! |
Fix JS Quick Edit for projects that have a function named "hasOwnProperty"
Fixes #3002
If any files in your project define a function named
hasOwnProperty
, JS Quick Edit would throw an exception. (modernizr.js, which is included in the test files for phantom.js, defines ahasOwnProperty
function. This is the cause of bug #3002).@peterflynn - since you've fixed several bugs in this area, would you mind taking a look?