Closed Bug 1362272 Opened 7 years ago Closed 5 years ago

Implement notifying of rejected promises (PromiseRejectionEvent)

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla68
Tracking Status
firefox68 --- fixed

People

(Reporter: ben.tian, Assigned: edgar)

References

(Blocks 1 open bug, )

Details

(Keywords: dev-doc-complete)

Attachments

(2 files, 1 obsolete file)

This bug is to
1) implement notifying of rejected promises per HTML spec [1] and fire PromiseRejectionEvent [2], and
2) enable PromiseRejectionEvent interface implemented in bug 1338059.

Note bug 1338059 implements PromiseRejectionEvent interface but disables it until we actually fire the events.


[1] Section 8.1.3.12 Unhandled promise rejections 
https://html.spec.whatwg.org/multipage/webappapis.html#unhandled-promise-rejections
[2] https://html.spec.whatwg.org/multipage/webappapis.html#promiserejectionevent
Ben, are you planning to continue working on this?
Priority: -- → P2
Sure. Take this bug.
Assignee: nobody → btian
Added DDN keyword for tracking for doc purposes. Also added "PromiseRejectionEvent" to the summary to help make this bug easier to find using a quick search.
Keywords: dev-doc-needed
Summary: Implement notifying of rejected promises → Implement notifying of rejected promises (PromiseRejectionEvent)
ni? :overholt to prioritize this given the new information we have on usage.
Flags: needinfo?(overholt)
On our list :)
Flags: needinfo?(overholt)
Assignee: ben.tian → nobody
Note that this could cause bogus successes in tests, given testharness.js (by default) is meant to fail if there's unhandled rejections.
unhandledrejection lands in Servo at https://github.com/servo/servo/pull/20755
Assignee: nobody → echen
Attachment #9040755 - Attachment is obsolete: true

(In reply to Edgar Chen [:edgar] from comment #10)

Created attachment 9040755 [details]
Bug 1362272 - Part 3: Enable on nightly and update tests;

I am going to do this in a separated bug.

Blocks: 1525554
Component: DOM → DOM: Core & HTML
Pushed by echen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a9ccbfb3293c
Part 1: Add onrejectionhandled and onunhandledrejection EventHandler; r=smaug
https://hg.mozilla.org/integration/autoland/rev/d7eaeddfd71d
Part 2: Implement notifying of rejected promises; r=smaug
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/16869 for changes under testing/web-platform/tests

This was already mostly documented, but I've polished things up and done the rest of the remaining bits:

:sheppy and others, are you sure Firefox 68 is or will be correct and not 69?

Via https://github.com/Fyrd/caniuse/pull/4972 and https://tests.caniuse.com/?feat=unhandledrejection leading to the comparison: https://i.imgur.com/2Iphqre.png

(In reply to kai.hollberg from comment #18)

:sheppy and others, are you sure Firefox 68 is or will be correct and not 69?

Via https://github.com/Fyrd/caniuse/pull/4972 and https://tests.caniuse.com/?feat=unhandledrejection leading to the comparison: https://i.imgur.com/2Iphqre.png

The implementation landed in 68 in this bug. We enabled it from 69 in bug 1525554 instead.

This bug is Resolved, yet I have encountered a failure of Firefox to send both the rejectionhandled and onunhandledrejection events, in accordance with its own documentation (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Using_promises, https://developer.mozilla.org/en-US/docs/Web/API/PromiseRejectionEvent). When I omit a "catch()" for a Promise that Rejects, the Web Console reports that an unhandled exception occurred. There seems to be no way to report this programming error to the user, since try/catch fails, probably due to Promise having its own try/catch. I am using the latest public Firefox, 68.0.2. (This problem is not urgent for me, I just don't think it is right that the documentation and functionality are not kept in sync with each other.)

Perhaps the Mozilla documentation (site:developer.mozilla.org/en-US/docs) is not included in github? It should be, so it can be synchronized with function and bug releases.

If there is no current reason to keep this feature as enabled only in about:config, my vote would be to complete and release these window event notifications for real so they will alert developers to missing catch() functions or missing try/catch in their Promise or Await chains.

(In reply to David Spector from comment #24)

If there is no current reason to keep this feature as enabled only in about:config, my vote would be to complete and release these window event notifications for real so they will alert developers to missing catch() functions or missing try/catch in their Promise or Await chains.

Hi David, this feature is enabled by default in bug 1525554, it should be available after 69 release. Thanks.

Blocks: 1642147
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: