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

Allow range headers to pass through a service worker #10348

Merged
merged 6 commits into from
May 29, 2018

Conversation

jakearchibald
Copy link
Contributor

@jakearchibald jakearchibald commented Apr 6, 2018

this_obj.doneResolve = resolve;
});
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jgraham @gsnedders I've added this so developers can await fetch_tests_from_worker(worker). This means:

  • Promise tests can run in a predictable order.
  • Service worker tests can complete before the next test unregisters it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jgraham @gsnedders nudge I don't suppose one of you could take a look at this bit?

Copy link
Contributor

Choose a reason for hiding this comment

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

These changes seem okay, but can you extract them into a separate PR and update the docs in docs/_writing-tests/testharness-api.md?

Copy link
Member

Choose a reason for hiding this comment

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

@jakearchibald I mostly defer to others for testharness.js changes. Like, uh, @Ms2ger. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Ms2ger shall do. Thanks for taking a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Extracted: #10978

@jakearchibald jakearchibald changed the title WIP: Ranges headers passthrough service worker Allow range headers to pass through a service worker Apr 10, 2018
@@ -1790,6 +1796,8 @@ policies and contribution forms [3].
this.running = false;
this.remote = null;
this.message_target = null;
if (this.doneResolve) this.doneResolve();
Copy link
Contributor

Choose a reason for hiding this comment

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

Wrap in braces and add line breaks.

@@ -1741,6 +1741,12 @@ policies and contribution forms [3].
}
};

if (self.Promise) {
this.done = new Promise(function(resolve) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason to create this property, or is it just because that's the easiest way to pass the promise to the caller?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this_obj.doneResolve = resolve;
});
}

Copy link
Contributor

Choose a reason for hiding this comment

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

These changes seem okay, but can you extract them into a separate PR and update the docs in docs/_writing-tests/testharness-api.md?

*
* @param {string} url
* @returns {HTMLIFrameElement}
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This change was just to improve autocomplete in VSCode.

Copy link
Member

@annevk annevk left a comment

Choose a reason for hiding this comment

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

range/general.any.js and range/partial-script.window.js seem fine, but the service worker script is rather non-deterministic when I run it. It first finds 8 tests and then on refresh there's 4 (all saying Error: wait_for_state must be passed a ServiceWorker).

@annevk
Copy link
Member

annevk commented May 23, 2018

It might be nice for range/general.any.js to split up the test a bit since if something fails it'd be rather hard to debug. Though I don't feel too strongly on that since browsers already pass.

@jakearchibald
Copy link
Contributor Author

It first finds 8 tests and then on refresh there's 4

Sounds like a bug. Will investigate & fix.

annevk pushed a commit to whatwg/fetch that referenced this pull request May 28, 2018
This is part of #144.

The aim is to allow APIs to use the range header for no-cors
requests, and allow them to pass through a service worker, but
disallow modification of these requests, and disallow developers
creating their own no-cors ranged requests.

Tests: web-platform-tests/wpt#10348.
jakearchibald added a commit to whatwg/fetch that referenced this pull request May 29, 2018
This is part of #144.

The aim is to allow APIs to use the range header for no-cors
requests, and allow them to pass through a service worker, but
disallow modification of these requests, and disallow developers
creating their own no-cors ranged requests.

Tests: web-platform-tests/wpt#10348.
@wpt-pr-bot wpt-pr-bot requested review from domfarolino and removed request for ayg May 29, 2018 11:59
@jakearchibald
Copy link
Contributor Author

@annevk test is now stable in Firefox, and I've split up the general tests.

@jgraham jgraham merged commit fb6d16d into web-platform-tests:master May 29, 2018
annevk pushed a commit to whatwg/fetch that referenced this pull request May 29, 2018
This is part of #144.

The aim is to allow APIs to use the Range header for "no-cors"
requests, and allow them to pass through a service worker, but
disallow modification of these requests, and disallow developers
creating their own "no-cors" ranged requests.

Tests: web-platform-tests/wpt#10348.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants