-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Additional fetch abort tests #6736
Additional fetch abort tests #6736
Conversation
Build PASSEDStarted: 2017-08-14 11:20:23 View more information about this build on: |
Sauce (safari)Testing web-platform-tests at revision 1438494 All results5 tests ran/fetch/api/abort/general-serviceworker.https.html
/fetch/api/abort/general-sharedworker.html
/fetch/api/abort/general.any.html
/fetch/api/abort/general.any.worker.html
/fetch/api/request/request-error.html
|
Chrome (unstable)Testing web-platform-tests at revision 1438494 |
Sauce (MicrosoftEdge)Testing web-platform-tests at revision 1438494 All results5 tests ran/fetch/api/abort/general-serviceworker.https.html
/fetch/api/abort/general-sharedworker.html
/fetch/api/abort/general.any.html
/fetch/api/abort/general.any.worker.html
/fetch/api/request/request-error.html
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of fetch/api/abort/general.html and fetch/api/abort/general-worker.html you could have those generated automatically by renaming fetch/api/abort/general.js to fetch/api/abort/general.any.js and using the include syntax detailed at http://web-platform-tests.org/writing-tests/testharness.html (you also need to tweak the shared worker wrapper a bit to load general.any.worker.js).
Looks good overall though.
@jakearchibald oh that looks cool, but please see #4210. We can't change |
Doh, I guessed it wouldn't be that easy. |
tools/serve/serve.py
Outdated
@@ -169,6 +174,7 @@ class AnyHtmlHandler(HtmlWrapperHandler): | |||
|
|||
|
|||
class AnyWorkerHandler(WrapperHandler): | |||
headers = [('Content-Type', 'application/javascript')] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be text/javascript if you want to follow the HTML Standard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow, I always thought application/javascript
was the preferred type. TIL
@jgraham could I get a yay/nay for https://github.com/w3c/web-platform-tests/pull/6736/files#diff-54595105eb1b125bb44120e81a893f4eR40? It's a small change, but needed for service worker tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume there's already a test that checks that signal and requestSignal are not equal?
fetch/api/abort/general.any.js
Outdated
|
||
controller.abort(); | ||
|
||
assert_true(requestAborted, "Original request signal aborted"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assert could be inside the clonedRequest.signal event listener. That way we also verify that the order is correct. Should we also check here that for both the .aborted flag is flipped?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I move the tests within the event callbacks then failure to call those callbacks will look like success. I guess I could push items onto an array to check order too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could also use a signal variable that you change in the first listener and that you then assert has changed in the second listener and then change again and then assert it has changed after that listener.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From IRC: As spec'd, the clone's abort
event would run before the original's. We need to figure out if this is a problem. If it is, we could change the AbortSignal
spec so it has a list of "following signals", which copy things that happen to the original, but it happens after the original's event has despatched.
Yep! |
tools/serve/serve.py
Outdated
@@ -40,6 +40,8 @@ class WrapperHandler(object): | |||
|
|||
__meta__ = abc.ABCMeta | |||
|
|||
headers = () |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a list ([]
).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure thing. Why btw? Just for my own learning, I haven't done python in a while.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A tuple is immutable, a list is mutable (and, argument from purity, tuples are supposed to be things where each field has a predefined meaning, not arbitrary ordered collections).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
The serve.py changes look fine. |
@annevk feedback addressed. Also filed whatwg/dom#493 to discuss event ordering. |
* Making use of .any.js for multi-context tests * Testing that request errors take priority over AbortError * Ensure request stream error is same as promise reject error * Testing request clone behaviour * Adding JS header to .any.worker.js
This ensures that the readable stream and the fetch promise are rejected with the same error instance.
It also ensures that things thrown by the request constructor happen before rejecting with AbortError.
The above involved abstracting some of the request constructor tests.