Closed
Bug 1096341
Opened 10 years ago
Closed 10 years ago
ToJSValue overload returns false without setting exception
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: tromey, Assigned: tromey)
References
Details
Attachments
(1 file)
946 bytes,
patch
|
bzbarsky
:
review+
|
Details | Diff | Splinter Review |
The ToJSValue contract says: // If ToJSValue returns false, it must set an exception on the // JSContext. However the last overload in ToJSValue.cpp does: if (!JS_GetPendingException(aCx, aValue)) { return false; } ... returning false when no exception is pending.
Comment 1•10 years ago
|
||
So if JS_GetPendingException returned false then either: 1) ThrowMethodFailedWithDetails somehow failed to throw an exception or 2) JSContext::getPendingException returned false without throwing. The latter can only happen if wrap() returns false without throwing, which it shouldn't. So I expect that JS_GetPendingException can never actually return false here... but falling back to undefined and returning true if it does return false might not be insane. Can't think of any better options.
Assignee | ||
Comment 2•10 years ago
|
||
Another option might be to simply assert that ThrowMethodFailedWithDetails did what it said it was going to do. It also seems to me that JS_GetPendingException can't return false here.
Assignee | ||
Comment 3•10 years ago
|
||
Here's what I was thinking for the assertion approach.
Comment 4•10 years ago
|
||
Yes, that would make sense to me.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → ttromey
Assignee | ||
Comment 5•10 years ago
|
||
https://tbpl.mozilla.org/?tree=Try&rev=3ab4e7725195
Assignee | ||
Comment 6•10 years ago
|
||
Comment on attachment 8520011 [details] [diff] [review] require an exception to be set in ToJSValue overload The test results look good. I wasn't sure if that previous comment constituted a review, so marking for review on the assumption it was not :)
Attachment #8520011 -
Flags: review?(bzbarsky)
Comment 7•10 years ago
|
||
Comment on attachment 8520011 [details] [diff] [review] require an exception to be set in ToJSValue overload r=me
Attachment #8520011 -
Flags: review?(bzbarsky) → review+
Assignee | ||
Updated•10 years ago
|
Keywords: checkin-needed
Comment 8•10 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/6cec52c43496
Keywords: checkin-needed
Comment 9•10 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/6cec52c43496
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
Updated•5 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•