Closed Bug 785057 Opened 12 years ago Closed 12 years ago

Assertion failure: !cx->isExceptionPending() because nsHTMLMediaElement::BuildObjectFromTags doesn't handle failure

Categories

(Core :: Audio/Video, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: Ms2ger, Assigned: rillian)

References

()

Details

Attachments

(1 file)

When a JSAPI function throws an exception, you need to stop using that context... See $URL.
In particular, this part is buggy:

1445   if (!JS_SetProperty(args->cx, args->tags, aKey.Data(), &value)) {
1446     NS_WARNING("Failed to set metadata property");
1447   }

That case needs to stop the iteration instead.  Not only that, but it needs to ensure that an error rv is returned from MozGetMetadata.  Alternately, if failure here should not throw to JS, it should explicitly clear the exception on cx.

That said, it's a bit odd that this stuff is being affected by Object.prototype at all.  Shouldn't this code be using JS_DefineProperty instead of JS_SetProperty?  If it did that, we'd definitely want JS_DefineProperty failure to throw.
Blocks: 763010
Thanks for the pointer. I used JS_SetProperty because I didn't need the finer control JS_DefineProperty offers. To quote the JSAPI Reference, '"Define" is a lower-level version of "set" that provides access to extra settings and does not call setters.' That sounded like what I wanted.

I'll change the code to return an error from MozGetMetadata.
Well, the question is whether you want to call setters off Object.prototype or not...  Seems a bit weird to, honestly.
Assignee: nobody → giles
Attached patch proposed fixSplinter Review
My initial reaction here was 'dynamic language is dynamic' but I've been convinced calling DefineProperty is less surprising here. The attached patch should address both issues.

Thanks to Boris and Graydon for the explanations.
Attachment #660944 - Flags: review?(bzbarsky)
Comment on attachment 660944 [details] [diff] [review]
proposed fix

r=me
Attachment #660944 - Flags: review?(bzbarsky) → review+
Try is green.
Keywords: checkin-needed
No testsuite to verify the exception is fixed; the URL link is sufficient for that.

Positive functionality of the code is verified by existing tests.
(In reply to Ralph Giles (:rillian) from comment #6)
> Pushed to try as https://tbpl.mozilla.org/?tree=Try&rev=0a57eabc8f65

Green on Try.

https://hg.mozilla.org/integration/mozilla-inbound/rev/7689bfe3675d
Flags: in-testsuite+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/7689bfe3675d
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Flags: in-testsuite+ → in-testsuite?
Ms2ger: can you be more specific about what you're after here?
The usual: a test that failed before the code change, and that passes now.
Bug 793315 shows why testing this code would have been useful.
Ok, thanks.

Given all the complaints about cycle times I don't feel it's worth writing a test for the getter override. The script in the URL link is sufficient for qa to verify the bug is resolved.
Flags: in-testsuite? → in-testsuite-
This isn't about QA verifying anything, but about automated regression testing. Not sure what your comment about cycle times is about.
Flags: in-testsuite- → in-testsuite?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: