Closed
Bug 1140428
Opened 9 years ago
Closed 9 years ago
Warn when __noSuchMethod__ is used
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla39
Tracking | Status | |
---|---|---|
firefox39 | --- | fixed |
People
(Reporter: jandem, Assigned: jandem)
References
Details
(Keywords: dev-doc-complete, site-compat, Whiteboard: [DocArea=JS])
Attachments
(1 file)
3.22 KB,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
With this patch we show a console warning whenever __noSuchMethod__ is used. We warn at most once per compartment, to avoid flooding the console.
Attachment #8573973 -
Flags: review?(jorendorff)
Updated•9 years ago
|
Keywords: dev-doc-needed
Comment 1•9 years ago
|
||
Have you considered using GlobalObject::warnOnceAbout?
Assignee | ||
Comment 2•9 years ago
|
||
(In reply to Tom Schuster [:evilpie] from comment #1) > Have you considered using GlobalObject::warnOnceAbout? Ah I didn't know about it. It looks more complicated to me: (1) it requires a js.msg entry and (2) I don't understand why it uses a full HeapValue to store a flag. A bool on the compartment seems both simpler and more efficient. If people prefer warnOnceAbout I can use that though.
Updated•9 years ago
|
Attachment #8573973 -
Flags: review?(jorendorff) → review+
Assignee | ||
Comment 3•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/19fafff99435
Comment 4•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/19fafff99435
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
status-firefox39:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla39
Updated•9 years ago
|
Whiteboard: [DocArea=JS]
Comment 5•9 years ago
|
||
https://developer.mozilla.org/en-US/Firefox/Releases/39#JavaScript https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/noSuchMethod
Keywords: dev-doc-needed → dev-doc-complete
Comment 6•9 years ago
|
||
I'll add this to the 39 site compat doc hopefully this weekend.
Keywords: dev-doc-complete → dev-doc-needed
Comment 7•9 years ago
|
||
OK done. https://developer.mozilla.org/en-US/Firefox/Releases/39/Site_Compatibility
Comment 8•9 years ago
|
||
Is the officially recommended alternative handler's "get" for Proxy? https://bugzilla.mozilla.org/show_bug.cgi?id=683218#c14
Comment 9•9 years ago
|
||
(In reply to YUKI "Piro" Hiroshi from comment #8) Yes, pretty much. There are perhaps different ways to skin the dead cat here using proxies, but adding a catchall "get" trap via an interspersed proxy is the easiest way to do it. Proxies do not do nice things to performance, tho, and will not for some time. You *really* are better off doing property-existence checks than continuing whatever approach it is you're taking right now.
Comment 10•9 years ago
|
||
And I should be *extra* clear to note: DO NOT intersperse an object into the prototype chain of Object.prototype, to catch *all* lookups that aren't found on earlier objects in the prototype chain. This is an EXTRAORDINARILY BAD idea that will destroy performance for vast swaths of code, and I'm actively working on making it impossible to do this, for this and other reasons.
Assignee | ||
Comment 11•9 years ago
|
||
Also, many use cases for __noSuchMethod__ don't need a proxy. When you just want to forward some method calls to another object, you can often just add a function for each property that forwards the call to the other object (or use a for-in loop to do this automatically for each method on the target object).
You need to log in
before you can comment on or make changes to this bug.
Description
•