Closed Bug 564577 Opened 14 years ago Closed 13 years ago

__noSuchMethod__ no longer invoked for defined non-function properties

Categories

(Core :: JavaScript Engine, defect)

x86
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: matthew, Assigned: matthew)

Details

(Whiteboard: [fixed-in-tracemonkey])

Attachments

(2 files, 3 obsolete files)

User-Agent:       Mozilla/5.0 (X11; U; Linux i686; en-au) AppleWebKit/531.2+ (KHTML, like Gecko) Safari/531.2+ Debian/squeeze/sid () Epiphany/2.30.2
Build Identifier: ca591da19a26

Trying to call a property that was set to a non-function value used to invoke __noSuchMethod__, but now it just throws "is not a function". Brendan's comments in bug 224956, comment 15 suggest the previous behaviour was a conscious choice.

Reproducible: Always

Steps to Reproduce:
js> var o = { a: 'xx', __noSuchMethod__: function() { return 'nsm'; } };
js> o.a()
Actual Results:  
typein:2: TypeError: o.a is not a function

Expected Results:  
nsm

Bisecting suggests the change occurred in bug 420399
Attached patch naive patch (obsolete) — Splinter Review
Seems to restore the previous behaviour, in my testing: __noSuchMethod__ is called if the property is undefined, null, a number, or a string -- but not if it's an object or a regexp. Or a function. :)

I actually wonder whether js_OnUnknownMethod should get a chance in js_Call, so any object without a JSClass.call gets treated the same way as a primitive... but that's really a separate matter.
Attached patch potential tests (obsolete) — Splinter Review
Attachment #444249 - Flags: review?(igor)
Attachment #444301 - Flags: review?(igor)
Comment on attachment 444249 [details] [diff] [review]
naive patch

This should restore the old behavior.
Attachment #444249 - Flags: review?(igor) → review+
Attached patch updated patch (obsolete) — Splinter Review
Attachment #444249 - Attachment is obsolete: true
Attachment #491109 - Flags: review+
Attachment #444301 - Flags: review?(igor) → review+
Keywords: checkin-needed
I'm searching for patches with checkin-needed to check in at the same time as my patches. This bug should not have that keyword set since it doesn't have approval and isn't a blocker, so the keyword is just creating noise and wasting other people's time. Please remove it and - assuming it's there to keep this bug on someone's radar - use your own whiteboard flags for that purpose.
Keywords: checkin-needed
Brendan, Igor: any reason why this patch (which should have been going into TM anyway, and thus shouldn't have gotten yelled at for not having the approval it would have only needed if it was headed into mozilla-central) shouldn't land?
Assignee: general → matthew
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Version: unspecified → Trunk
Just a tiny bit of bitrot in the context, and I folded them into a single patch so we're less likely to fail to push one, and hg exported them so we're less likely to wind up gumming up your name/email/commit message.
Attachment #444301 - Attachment is obsolete: true
Attachment #491109 - Attachment is obsolete: true
Comment on attachment 524801 [details] [diff] [review]
unrotted, folded, and exported

Could have answered my own question, just by waiting for tryserver results: according to the jsreftests, "o.fff is not a function item 6."
Attachment #524801 - Flags: review-
Matthew, someone just pointed out to me that comment 5 came across as sounding curt and a bit rude to them, and in retrospect I have to agree. More to the point I failed to notice that you're a new contributor and shouldn't have been expected to know the subtleties of checkin-needed in use at the time. Apologies for the flyby comment. Had I realized you were just getting started I'd have made a much more friendly and helpful comment. I hope my carelessness doesn't put you off, since your involvement in Mozilla is certainly very welcome. :)
Attached patch fully unrottedSplinter Review
Addressed new instances of HAS_NO_SUCH_METHOD in methodjit/, and updated test to reflect regular expressions not being callable (#582717; the error mentioned in comment 9).
Comment on attachment 527616 [details] [diff] [review]
fully unrotted

I'm guessing this needs review so as not to fall off the radar. Please cancel the review request if I'm wrong.
Attachment #527616 - Flags: review?(philringnalda)
Comment on attachment 527616 [details] [diff] [review]
fully unrotted

This probably needs to be igor.
Attachment #527616 - Flags: review?(philringnalda) → review?(igor)
Attachment #527616 - Flags: review?(igor) → review+
Keywords: checkin-needed
Whiteboard: [c-n: tracemonkey]
http://hg.mozilla.org/tracemonkey/rev/72a5969b0c29
Keywords: checkin-needed
Whiteboard: [c-n: tracemonkey] → [fixed-in-tracemonkey]
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: