Closed
Bug 1173593
Opened 10 years ago
Closed 10 years ago
No way to throw a spec'ed TypeError from jsimplemented webidl.
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
mozilla41
Tracking | Status | |
---|---|---|
firefox41 | --- | fixed |
People
(Reporter: jib, Assigned: bzbarsky)
References
Details
Attachments
(1 file)
11.76 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
There's reason to believe we'll need to throw TypeError as part of specs soon.
https://github.com/w3c/mediacapture-main/issues/189
https://github.com/w3c/webrtc-pc/issues/35
The rationale is that WebIDL can't cover everything when it comes to validation.
Now it looks like we're settling on SyntaxError in the second thread, but it raises an interesting problem nonetheless:
Our implementation appears not to allow an ES exception like TypeError thrown from jsimplemented webidl to make it to content the way a DOMException does.
When I throw new TypeError("This is a test.") from PeerConnection.js, I get:
> Web console: NS_ERROR_UNEXPECTED: mytest.js:22:0
> Browser console: This is a test. PeerConnection.js:356:0
![]() |
Assignee | |
Comment 1•10 years ago
|
||
This just allows throwing anything that comes from the content compartment, since bug 1173638 ensured that constructing an Error will properly principal-filter things so it won't expose anything it's not supposed to expose. We keep the DOMError special case for now, but can consider removing it in a followup since now consumers can just directly throw an Error from the content compartment.
Attachment #8621388 -
Flags: review?(bobbyholley)
![]() |
Assignee | |
Updated•10 years ago
|
Assignee: nobody → bzbarsky
Status: NEW → ASSIGNED
Comment 2•10 years ago
|
||
Comment on attachment 8621388 [details] [diff] [review]
Make it possible to throw TypeError from js-implemented webidl
Review of attachment 8621388 [details] [diff] [review]:
-----------------------------------------------------------------
::: dom/bindings/BindingUtils.cpp
@@ +284,5 @@
> MOZ_ASSERT(!mMightHaveUnreportedJSException,
> "Why didn't you tell us you planned to handle JS exceptions?");
>
> + dom::DOMError* domError;
> + nsresult rv = UNWRAP_OBJECT(DOMError, &mJSException.toObject(), domError);
Can you explain in a comment why we need the DOMError case?
Attachment #8621388 -
Flags: review?(bobbyholley) → review+
![]() |
Assignee | |
Comment 3•10 years ago
|
||
> Can you explain in a comment why we need the DOMError case?
Done, and filed bug 1174954 on removing it.
Comment 5•10 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla41
![]() |
Assignee | |
Comment 6•10 years ago
|
||
Updated•6 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•