Closed
Bug 371033
Opened 17 years ago
Closed 12 years ago
Universal support for noSuchMethod
Categories
(Core :: JavaScript Engine, enhancement)
Core
JavaScript Engine
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: igor, Unassigned)
References
Details
Attachments
(1 file)
2.41 KB,
text/html
|
Details |
Currently __noSuchMethod__ can capture only methods called through obj.notExistingProperty(). It does not work with obj[expression]() or with notExistingName() calls as the following jsshell session demonstrates: js> o = {} o = {} [object Object] js> o.__noSuchMethod__ = function(id) { print("Unknown call: "+id); } o.__noSuchMethod__ = function(id) { print("Unknown call: "+id); } function (id) { print("Unknown call: " + id); } js> o.x() o.x() Unknown call: x js> var name = 'x'; var name = 'x'; js> o[name]() o[name]() typein:12: TypeError: o[name] is not a function js> with (o) { x(); } with (o) { x(); } typein:13: ReferenceError: x is not defined It would nice to extend __noSuchMethod__ support to cover all cases.
Reporter | ||
Comment 1•17 years ago
|
||
The new callelem/callname bytecodes that bug 363530 adds should allow to gain all the necessary information to implement this bug.
Depends on: 363530
Comment 2•17 years ago
|
||
We should implement the ES4 catchalls proposal too, not just extend the old nSM hack I did for the Tibet guys. http://developer.mozilla.org/es4/proposals/catchalls.html (out of date, update coming this week, I'll attach a saved version of the latest wiki page to this bug in the mean time). /be
Comment 3•17 years ago
|
||
Comment 5•16 years ago
|
||
This might, or might not be helpful information: In SpiderMonkey: js> var x = { __noSuchMethod__: function(id) { print(id); } } js> x.y() y js> x["y"]() y js> var z = "y" js> x[z]() typein:7: TypeError: x[z] is not a function In Rhino: js> var x = { __noSuchMethod__: function(id) { print(id); } } js> x.y() y js> x["y"]() y js> var z = "y" js> x[z]() y So AFAIK Rhino "does it right" while SpiderMonkey does not.
Comment 6•16 years ago
|
||
Wilson: you are using an out of date SpiderMonkey. Fresh hg.mozilla.org trunk: js> var x = { __noSuchMethod__: function(id) { print(id); } } js> x.y() y js> x["y"]() y js> var z = "y" js> x[z]() y This bug is somewhat more fixed. Other forms remain unsupporetd, however. /be
Comment 7•16 years ago
|
||
Oopsies. I just checked and it /is/ fixed on mozilla-central.
Comment 8•12 years ago
|
||
If anything, we are going to eventually remove __noSuchMethod__ (bug 683218).
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
You need to log in
before you can comment on or make changes to this bug.
Description
•