Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add promise rejection tracking tests #2388

Merged
merged 6 commits into from Feb 15, 2017
Merged

Conversation

domenic
Copy link
Member

@domenic domenic commented Nov 30, 2015

For whatwg/html#224

Need a few pieces of help:

  • Running the allow-crossorigin and disallow-crossorigin tests fails for me locally because the {{ports[html][0]}} syntax from /cors/support.js is not getting preprocessed. Any ideas?works now, I forgot ?pipe=sub
  • I tried replacing setTimeout with t.step_timeout in disallow-crossorigin, but this caused the test to pass even when I changed the URL to be same-origin. I think that section of code probably just needs to be done better; review would be helpful.Fixed

I'd appreciate if review was done on GitHub, not Critic.

These tests were done in collaboration with @jeisinger. Apart from the abovementioned issues, they all pass in Chrome Canary with experimental web platform features enabled.

@tobie
Copy link
Contributor

tobie commented Nov 30, 2015

Reviewers for this pull request are: @w3c/html-reviewers.

@tobie tobie added the html label Nov 30, 2015
@hoppipolla-critic-bot
Copy link

Critic review: https://critic.hoppipolla.co.uk/r/6015

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

p.catch(function() {});
} catch (e) {
assert_unreached('attaching a handler should not throw an error');
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use t.step(function() { p.catch(function() {}); } instead of try/catch

@domenic
Copy link
Member Author

domenic commented Dec 1, 2015

I pushed a fix for @zcorpan's review and also one for the troublesome issue I mentioned in the OP.

The only remaining potentially major item I can see is a global replacement of setTimeout with t.step_timeout. I'm happy to do that if people advise me it's a good idea. My experience is that they have strangely different semantics which scares me a bit.

@zcorpan
Copy link
Member

zcorpan commented Dec 1, 2015

Maybe best to ask @jgraham about step_timeout

@ayg ayg closed this Aug 28, 2016
@ayg ayg deleted the promise-rejection-tracking branch August 28, 2016 13:58
@domenic
Copy link
Member Author

domenic commented Aug 28, 2016

Why close and delete my PR?

@gsnedders gsnedders restored the promise-rejection-tracking branch August 28, 2016 17:47
@gsnedders gsnedders reopened this Aug 28, 2016
@gsnedders
Copy link
Member

15:01 < aryehgregor> Um, I might have done something wrong by mistake.
15:01 < aryehgregor> I think I pushed to the wrong repo?

@gsnedders gsnedders closed this Aug 28, 2016
@gsnedders gsnedders reopened this Aug 28, 2016
@gsnedders
Copy link
Member

…and then I screw up and press "close and comment". This isn't our day. :\

@ayg ayg closed this Oct 26, 2016
@ayg ayg deleted the promise-rejection-tracking branch October 26, 2016 17:37
@zcorpan zcorpan restored the promise-rejection-tracking branch October 26, 2016 19:52
@zcorpan zcorpan reopened this Oct 26, 2016
@w3c-bots
Copy link

w3c-bots commented Feb 8, 2017

Chrome (unstable channel)

Testing web-platform-tests at revision aeb2f0a891a2904186c614df750478fa9d7643c2
Using browser at version 58.0.3004.3 dev
Starting 10 test iterations
All results were stable

All results

9 tests ran
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/allow-crossorigin.html
Subtest Results
OK
Promise rejection event should be received for the cross-origin CORS script PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/disallow-crossorigin.html
Subtest Results
OK
Promise rejection event should be muted for cross-origin non-CORS script PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.html
Subtest Results
OK
delayed handling: a task delay before attaching a handler prevents unhandledrejection PASS
unhandledrejection: from a throw in a rejection handler chained off of a setTimeout-delayed rejection PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
delayed handling: postMessageTask after promise creation/rejection, plus promise microtasks, is not too late to attach a rejection handler PASS
postMessageTask ordering vs. the task queued for unhandled rejection notification (2) PASS
unhandledrejection: from a throw in a rejection handler attached one microtask after a setTimeout-delayed rejection PASS
unhandledrejection: from Promise.reject PASS
mutationObserverMicrotask vs. postMessageTask ordering is not disturbed inside unhandledrejection events PASS
unhandledrejection: from a setTimeout-delayed rejection PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a setTimeout PASS
delayed handling: a microtask delay before attaching a handler prevents both events (immediately-rejected new Promise-created promise) PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-task delay before attaching a handler causes unhandledrejection PASS
no unhandledrejection/rejectionhandled: all inside a queued task, a rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus promise microtasks, is too late to attach a rejection handler PASS
delayed handling: a microtask delay before attaching a handler prevents both events (Promise.reject-created promise) PASS
unhandledrejection: from a throw in a fulfillment handler PASS
delayed handling: postMessageTask before promise creation/rejection, plus many promise microtasks, is not too late to attach a rejection handler PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a postMessageTask PASS
delayed handling: a microtask delay before attaching the handler, and before rejecting the promise, indirected through Promise.all PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask PASS
unhandledrejection: from a throw in a rejection handler chained off of Promise.reject PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject PASS
delayed handling: delaying handling by setTimeout(,10) will cause both events to fire PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a postMessageTask PASS
delayed handling: a nested-postMessageTask before promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
delayed handling: postMessageTask after promise creation/rejection, plus many promise microtasks, is not too late to attach a rejection handler PASS
unhandledrejection: from returning a Promise.reject-created rejection in a fulfillment handler PASS
unhandledrejection: from a synchronous rejection in new Promise PASS
unhandledrejection: from a task-delayed rejection PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a synchronously-rejected promise created with new Promise PASS
rejectionhandled is dispatched from a queued task, and not immediately PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject, indirecting through Promise.all PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a setTimeout PASS
unhandledrejection: from Promise.reject, indirected through Promise.all PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from throwing in a fulfillment handler PASS
postMessageTask ordering vs. the task queued for unhandled rejection notification (1) PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a setTimeout-delayed rejection in a fulfillment handler PASS
unhandledrejection: from returning a setTimeout-delayed rejection in a fulfillment handler PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.serviceworker.https.html
Subtest Results
OK
unhandledrejection: from a throw in a rejection handler chained off of a setTimeout-delayed rejection PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
unhandledrejection: from a throw in a rejection handler attached one microtask after a setTimeout-delayed rejection PASS
unhandledrejection: from Promise.reject PASS
mutationObserverMicrotask vs. postMessageTask ordering is not disturbed inside unhandledrejection events PASS
unhandledrejection: from a setTimeout-delayed rejection PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a setTimeout PASS
delayed handling: delaying handling by setTimeout(,10) will cause both events to fire PASS
delayed handling: a microtask delay before attaching a handler prevents both events (immediately-rejected new Promise-created promise) PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-task delay before attaching a handler causes unhandledrejection PASS
no unhandledrejection/rejectionhandled: all inside a queued task, a rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus promise microtasks, is too late to attach a rejection handler PASS
delayed handling: a microtask delay before attaching a handler prevents both events (Promise.reject-created promise) PASS
unhandledrejection: from a throw in a fulfillment handler PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a postMessageTask PASS
delayed handling: a microtask delay before attaching the handler, and before rejecting the promise, indirected through Promise.all PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask PASS
unhandledrejection: from a throw in a rejection handler chained off of Promise.reject PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject PASS
Service worker setup PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a postMessageTask PASS
delayed handling: a nested-postMessageTask before promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
unhandledrejection: from returning a Promise.reject-created rejection in a fulfillment handler PASS
unhandledrejection: from a synchronous rejection in new Promise PASS
unhandledrejection: from a task-delayed rejection PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a synchronously-rejected promise created with new Promise PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject, indirecting through Promise.all PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a setTimeout PASS
unhandledrejection: from Promise.reject, indirected through Promise.all PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from throwing in a fulfillment handler PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a setTimeout-delayed rejection in a fulfillment handler PASS
unhandledrejection: from returning a setTimeout-delayed rejection in a fulfillment handler PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.dedicatedworker.html
Subtest Results
OK
unhandledrejection: from a throw in a rejection handler chained off of a setTimeout-delayed rejection PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
unhandledrejection: from a throw in a rejection handler attached one microtask after a setTimeout-delayed rejection PASS
unhandledrejection: from Promise.reject PASS
mutationObserverMicrotask vs. postMessageTask ordering is not disturbed inside unhandledrejection events PASS
unhandledrejection: from a setTimeout-delayed rejection PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a setTimeout PASS
delayed handling: a microtask delay before attaching a handler prevents both events (immediately-rejected new Promise-created promise) PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-task delay before attaching a handler causes unhandledrejection PASS
no unhandledrejection/rejectionhandled: all inside a queued task, a rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus promise microtasks, is too late to attach a rejection handler PASS
delayed handling: a microtask delay before attaching a handler prevents both events (Promise.reject-created promise) PASS
unhandledrejection: from a throw in a fulfillment handler PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a postMessageTask PASS
delayed handling: a microtask delay before attaching the handler, and before rejecting the promise, indirected through Promise.all PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask PASS
unhandledrejection: from a throw in a rejection handler chained off of Promise.reject PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject PASS
delayed handling: delaying handling by setTimeout(,10) will cause both events to fire PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a postMessageTask PASS
delayed handling: a nested-postMessageTask before promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
unhandledrejection: from returning a Promise.reject-created rejection in a fulfillment handler PASS
unhandledrejection: from a synchronous rejection in new Promise PASS
unhandledrejection: from a task-delayed rejection PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a synchronously-rejected promise created with new Promise PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject, indirecting through Promise.all PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a setTimeout PASS
unhandledrejection: from Promise.reject, indirected through Promise.all PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from throwing in a fulfillment handler PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a setTimeout-delayed rejection in a fulfillment handler PASS
unhandledrejection: from returning a setTimeout-delayed rejection in a fulfillment handler PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-event-constructor.html
Subtest Results
OK
This tests the constructor for the PromiseRejectionEvent DOM class. PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-onerror.html
Subtest Results
OK
Throwing inside an unhandledrejection handler invokes the error handler. PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events.sharedworker.html
Subtest Results
OK
unhandledrejection: from a throw in a rejection handler chained off of a setTimeout-delayed rejection PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
unhandledrejection: from a throw in a rejection handler attached one microtask after a setTimeout-delayed rejection PASS
unhandledrejection: from Promise.reject PASS
mutationObserverMicrotask vs. postMessageTask ordering is not disturbed inside unhandledrejection events PASS
unhandledrejection: from a setTimeout-delayed rejection PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a setTimeout PASS
delayed handling: a microtask delay before attaching a handler prevents both events (immediately-rejected new Promise-created promise) PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-task delay before attaching a handler causes unhandledrejection PASS
no unhandledrejection/rejectionhandled: all inside a queued task, a rejection handler attached synchronously to a promise created from returning a Promise.reject-created promise in a fulfillment handler PASS
delayed handling: a nested-postMessageTask after promise creation/rejection, plus promise microtasks, is too late to attach a rejection handler PASS
delayed handling: a microtask delay before attaching a handler prevents both events (Promise.reject-created promise) PASS
unhandledrejection: from a throw in a fulfillment handler PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a postMessageTask PASS
delayed handling: a microtask delay before attaching the handler, and before rejecting the promise, indirected through Promise.all PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask PASS
unhandledrejection: from a throw in a rejection handler chained off of Promise.reject PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject PASS
delayed handling: delaying handling by setTimeout(,10) will cause both events to fire PASS
microtask nesting: attaching a handler inside a combination of mutationObserverMicrotask + promise microtasks, all inside a postMessageTask PASS
delayed handling: a nested-postMessageTask before promise creation/rejection, plus many promise microtasks, is too late to attach a rejection handler PASS
unhandledrejection: from returning a Promise.reject-created rejection in a fulfillment handler PASS
unhandledrejection: from a synchronous rejection in new Promise PASS
unhandledrejection: from a task-delayed rejection PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a synchronously-rejected promise created with new Promise PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise from Promise.reject, indirecting through Promise.all PASS
microtask nesting: attaching a handler inside a combination of promise microtasks + mutationObserverMicrotask, all inside a setTimeout PASS
unhandledrejection: from Promise.reject, indirected through Promise.all PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from throwing in a fulfillment handler PASS
no unhandledrejection/rejectionhandled: rejection handler attached synchronously to a promise created from returning a setTimeout-delayed rejection in a fulfillment handler PASS
unhandledrejection: from returning a setTimeout-delayed rejection in a fulfillment handler PASS
/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/promise-rejection-events-attached-in-event.html
Subtest Results
OK
Attaching a handler in unhandledrejection should not trigger rejectionhandled. PASS

@w3c-bots
Copy link

w3c-bots commented Feb 8, 2017

Firefox (nightly channel)

Testing web-platform-tests at revision aeb2f0a891a2904186c614df750478fa9d7643c2
Using browser at version BuildID 20170123125947; SourceStamp 36486fdc3813ef7943ae5b07b4128866d1938a6c
Starting 10 test iterations

@domenic
Copy link
Member Author

domenic commented Feb 8, 2017

@jeisinger I realize we never landed this... do you have any idea why Chrome does not pass allow-crossorigin.html ?


(function() {
var scriptEl = document.createElement('script');
scriptEl.src = CROSSDOMAIN + 'support/promise-access-control.py?allow=true';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add scriptEl.crossOrigin = 'anonymous'; - otherwise CORS won't be used.


var scriptEl = document.createElement('script');
scriptEl.src = CROSSDOMAIN + 'support/promise-access-control.py?allow=false';
scriptEl.onload = resolveLoaded;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@domenic domenic merged commit 699cc75 into master Feb 15, 2017
@domenic domenic deleted the promise-rejection-tracking branch February 15, 2017 20:45
MXEBot pushed a commit to mirror/chromium that referenced this pull request Apr 7, 2017
These tests were upstreamed to web-platform-tests in
web-platform-tests/wpt#2388. Several
Chromium-specific tests remain but the ones deleted in this commit are
redundant with the versions now found in
third_party/WebKit/LayoutTests/external/wpt/html/webappapis/scripting/processing-model-2/unhandled-promise-rejections/.

BUG=702025

Review-Url: https://codereview.chromium.org/2798273002
Cr-Commit-Position: refs/heads/master@{#462422}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants