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

Test when a SW replies with a fetch from a different URL #14288

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions service-workers/service-worker/navigation-redirect.https.html
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,24 @@
'SW-fetched redirect to other-origin in-scope.');


// SW responds with a fetch from a different url.
Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can explicitly say that unlike the other test cases, this isn't a redirect (given the filename and redirect_test name, it may be confusing).

Copy link
Member

Choose a reason for hiding this comment

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

Actually, I guess it's not needed if we're going to add redirect + fetch tests, which I think we should.

// SW: event.respondWith(fetch(params['url']));
url2 = SCOPE1;
url1 = SCOPE1 + 'sw=fetch-url&url=' + encodeURIComponent(url2);
redirect_test(
url1,
url1,
[
[
{url: url1, resultingClientIdTag: 'x'}
],
[],
[]
],
'x',
'SW-fetched response from different URL, same-origin same-scope.');
Copy link
Member

Choose a reason for hiding this comment

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

Optional: but I think you can collapse this more to be formatted like lines 650-655 to save some space without exceeding 80 cols.



// Opaque redirect.
// SW: event.respondWith(fetch(
// new Request(event.request.url, {redirect: 'manual'})));
Expand Down