Closed Bug 1120178 Opened 9 years ago Closed 7 years ago

Remove DOMError

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: Ms2ger, Assigned: baku)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(1 file, 4 obsolete files)

Depends on: 1174954
Keywords: site-compat
So this is used by DOMRequest.  Do we want DOMRequest to still exist?  Should it be replaced by Promises?
So when I changed IDB to use DOMException instead of DOMError, the wpt test IndexedDB/error-attributes.html fails because now suddenly the ConstraintError returned by IDBObjectStore.add gets caught by window.addEventListener("error",...):

https://treeherder.mozilla.org/logviewer.html#?job_id=121430709&repo=try

Somehow when it was DOMError this didn't happen, but with DOMException it does.  Any idea why, and how to fix it?
Flags: needinfo?(jvarga)
Flags: needinfo?(bzbarsky)
Assignee: nobody → ayg
Status: NEW → ASSIGNED
No idea offhand; I'd have to debug.  At first glance this seems pretty weird: the only way I know of for a DOMException to get caught by an error listener like that is if it actually gets thrown, but I'd expect anything that gets thrown to be thus caught.
Flags: needinfo?(bzbarsky)
The same bug appears in <http://w3c-test.org/html/infrastructure/common-dom-interfaces/collections/domstringlist.html>, the harness fails with an error.  I filed bug 1389913.
Flags: needinfo?(jvarga)
Assignee: ayg → nobody
Status: ASSIGNED → NEW
Attached patch Bug 1120178 - Remove DOMError (obsolete) — Splinter Review
I just rebased the existing patch. I also wrote a patch for bug 1389913.
This patch is green on try.

Note that Chromium doesn't have removed the DOMError constructor yet.
But, following https://www.chromestatus.com/metrics/feature/popularity

DOMError CTOR is used by 0.000071%

I suggest to keep the DOMError CTOR but remove it from the webIDL interfaces.

smaug, if you prefer I can split the patch per component or per API.
Assignee: nobody → amarchesini
Attachment #8894251 - Attachment is obsolete: true
Attachment #8912222 - Flags: feedback?(bugs)
What you mean with "keep the DOMError CTOR but remove it from the webIDL interfaces"?
With this patch ports FileReader.error to DOMException. Same for IDB and elsewhere.
But the patch removes DOMError interface, meaning also the constructor. So, are you proposing something else than what the patch does?
(In reply to Olli Pettay [:smaug] from comment #12)
> But the patch removes DOMError interface, meaning also the constructor. So,
> are you proposing something else than what the patch does?

Yes, I ask a feedback about this approach. Maybe a NI was better, but I also wanted you to take a look at the patch.
Comment on attachment 8912222 [details] [diff] [review]
Bug 1120178 - Remove DOMError

So better to keep the interface for now.
Attachment #8912222 - Flags: feedback?(bugs)
Attached patch domError.patch (obsolete) — Splinter Review
Attachment #8912222 - Attachment is obsolete: true
Attachment #8912378 - Flags: review?(bugs)
Attached patch domError.patch (obsolete) — Splinter Review
Attachment #8912378 - Attachment is obsolete: true
Attachment #8912378 - Flags: review?(bugs)
Attachment #8912539 - Flags: review?(bugs)
Blocks: 1178829
Comment on attachment 8912539 [details] [diff] [review]
domError.patch

>+++ b/dom/imptests/html/dom/test_interfaces.html
>@@ -5,21 +5,16 @@
> <script src=/resources/testharnessreport.js></script>
> <script src=/resources/WebIDLParser.js></script>
> <script src=/resources/idlharness.js></script>
> 
> <h1>DOM IDL tests</h1>
> <div id=log></div>
> 
> <script type=text/plain>
>-[Constructor(DOMString name)]
>-interface DOMError {
>-  readonly attribute DOMString name;
>-};
>-
Why this?

>+++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
>@@ -101,18 +101,16 @@ var interfaceNamesInGlobalScope =
>     "Crypto",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>     "CustomEvent",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>     "Directory",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>     "DOMCursor",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>-    "DOMError",
>-// IMPORTANT: Do not change this list without review from a DOM peer!
This doesn't look right.

>+++ b/dom/workers/test/test_worker_interfaces.js
>@@ -99,18 +99,16 @@ var interfaceNamesInGlobalScope =
>     "CustomEvent",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>     "DedicatedWorkerGlobalScope",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>     "Directory",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>     "DOMCursor",
> // IMPORTANT: Do not change this list without review from a DOM peer!
>-    "DOMError",
>-// IMPORTANT: Do not change this list without review from a DOM peer!
Nor this


I assume this doesn't pass on try. I'd prefer to look at a patch which does pass all the tests.
Attachment #8912539 - Flags: review?(bugs) → review-
Attached patch domError.patchSplinter Review
Attachment #8912539 - Attachment is obsolete: true
Attachment #8913105 - Flags: review?(bugs)
Comment on attachment 8913105 [details] [diff] [review]
domError.patch

>+++ b/dom/base/test/mochitest.ini
>@@ -653,17 +653,16 @@ skip-if = toolkit == 'android' #bug 9041
> [test_domrequest.html]
> [test_domwindowutils.html]
> [test_e4x_for_each.html]
> [test_element.matches.html]
> [test_element_closest.html]
> [test_elementTraversal.html]
> [test_encodeToStringWithMaxLength.html]
> [test_encodeToStringWithRequiresReinitAfterOutput.html]
>-[test_error.html]
Please don't remove this.

>diff --git a/dom/base/test/test_error.html b/dom/base/test/test_error.html
>deleted file mode 100644
... please don't remove this file
Attachment #8913105 - Flags: review?(bugs) → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/b6ecd2cc9217
Migrate DOMError to DOMExtension in FileReader, IndexedDB, DOMRequest and so on, r=smaug
https://hg.mozilla.org/mozilla-central/rev/b6ecd2cc9217
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla58
Forgot to say: This change requires an "intent to unship" post, maybe? I couldn't find one on the dev-platform list.
I *think* I've documented this one sufficiently.

I've updated mentions of DOMError to DOMException on appropriate pages, and mentioned when the change occurred in the browser compat notes:

https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createOffer
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setRemoteDescription
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/createAnswer
https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/setLocalDescription
https://developer.mozilla.org/en-US/docs/Web/API/FileReader/error
https://developer.mozilla.org/en-US/docs/Web/API/IDBRequest/error
https://developer.mozilla.org/en-US/docs/Web/API/IDBTransaction/error

I've marked DOMError as deprecated:

https://developer.mozilla.org/en-US/docs/Web/API/DOMError

I've updated the DOMException pages (although I've just included the stuff listed in the WebIDL spec, not the ExceptionMembers stuff listed in the Gecko source code as I didn't think it sounded very relevant to web developers):

https://developer.mozilla.org/en-US/docs/Web/API/DOMException (and child pages)

I've put a note in the Fx58 rel notes:

https://developer.mozilla.org/en-US/Firefox/Releases/58#DOM

Let me know if you think this needs anything else!
Component: DOM → DOM: Core & HTML
See Also: → 1558387
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: