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

Changing skip-service-worker flag to use-service-workers enum #435

Merged
merged 8 commits into from
Feb 14, 2017

Conversation

jakearchibald
Copy link
Collaborator

This fixes #303. I don't think there's anything else to do with this PR, but I need to make changes to SW to set this flag on particular APIs.

@jakearchibald
Copy link
Collaborator Author

Technically, this and skip-service-worker could become an enum of "none", "local" and "all", but it feels like that'd break specs already using it. Is that the right thing to do?

@jakearchibald
Copy link
Collaborator Author

Related SW PR w3c/ServiceWorker#1025

@annevk
Copy link
Member

annevk commented Dec 15, 2016

I think I prefer the enum approach. There's not too many consumers as far as I know.

@jakearchibald
Copy link
Collaborator Author

Cool, I'll update the PR

@annevk
Copy link
Member

annevk commented Dec 15, 2016

Thanks. There's also #362 which relates to this flag somewhat.

fetch.bs Outdated

<p>A <a for=/>request</a> has an associated <dfn export>skip-local-service-worker flag</dfn>. Unless
stated otherwise it is unset.
<dfn export>use-service-workers value</dfn>, that is "<code>all</code>",
Copy link
Member

Choose a reason for hiding this comment

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

This needs for=request too. Seems we forgot that until now.

@annevk
Copy link
Member

annevk commented Dec 16, 2016

So where do we check for the foreign value? If we only ever set it, it seems like we could also reuse another value, no?

@annevk
Copy link
Member

annevk commented Dec 16, 2016

Do we have WPT tests around this?

@jakearchibald
Copy link
Collaborator Author

So where do we check for the foreign value? If we only ever set it, it seems like we could also reuse another value, no?

Yeah, when it comes to performing foreign fetch we're only really concerned that the value isn't "none". Although I'm not sure what else could be reused.

Do we have WPT tests around this?

No, I guess this is something I should learn and do 😄

@jakearchibald jakearchibald changed the title WIP: Making a skip-local-service-worker flag WIP: Changing skip-service-worker flag to use-service-workers enum Dec 16, 2016
@annevk
Copy link
Member

annevk commented Dec 16, 2016

Yeah, when it comes to performing foreign fetch we're only really concerned that the value isn't "none".

And it cannot be "all" either I guess? I guess "foreign" is fine then. Can @mkruisselbrink have a look or is he still away?

@annevk
Copy link
Member

annevk commented Dec 16, 2016

As for the tests, the new rule is that they land together with the specification change. Let me know if you need help.

@annevk
Copy link
Member

annevk commented Dec 16, 2016

And only https://w3c.github.io/ServiceWorker/ seems to use the skip-service-worker flag currently. We should maybe prepare a PR there too so they can all land at the same time.

@jakearchibald
Copy link
Collaborator Author

w3c/ServiceWorker#1025

fetch.bs Outdated
@@ -728,8 +728,9 @@ explicitly set <a for=/>request</a>'s
this flag set are subject to additional processing requirements.

<p>A <a for=/>request</a> has an associated
<dfn export>skip-service-worker flag</dfn>. Unless stated otherwise it is
unset.
<dfn export>use-service-workers value</dfn>, that is "<code>all</code>",
Copy link
Member

Choose a reason for hiding this comment

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

What do you think about <dfn export for=request>service-workers mode</dfn>? I think that would be more consistent with what we have thus far.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

SGTM, I wasn't happy with the naming

fetch.bs Outdated
@@ -2793,16 +2794,14 @@ optional <i>CORS flag</i> and <i>CORS-preflight flag</i>, run these steps:
<li><p>Let <var>actualResponse</var> be null.

<li>
<p>If <var>request</var>'s <a>skip-service-worker flag</a> is unset, then run these
<p>If <var>request</var>'s <a>service-workers mode</a> is not "<code>none</code>", then run these
substeps:

<ol>
<li>
<p>If <var>request</var>'s <a for=request>client</a> is null or
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we still need the client is null check, or is just relying on the service-workers mode enough now? And in particular it seems wrong that service-workers mode==foreign and client==null will now result in handle fetch being called.

Copy link
Member

Choose a reason for hiding this comment

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

I think that relying on service-workers mode is enough. At least, I thought the idea was that having a client no longer mattered.

@@ -728,8 +728,9 @@ explicitly set <a for=/>request</a>'s
this flag set are subject to additional processing requirements.

<p>A <a for=/>request</a> has an associated
<dfn export>skip-service-worker flag</dfn>. Unless stated otherwise it is
unset.
<dfn for=request export>service-workers mode</dfn>, that is "<code>all</code>",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it make sense to add some non-normative text somewhere to explain what this mode actually means? Of course you can figure that out by reading the algorithms, but I find the non-normative notes that many of the requests attributes have to be quite helpful in quickly figuring out what a particular thing is for.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, sounds good.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@mkruisselbrink
Copy link
Collaborator

Do we have WPT tests around this?

No, I guess this is something I should learn and do

Hmm, I should probably also work on actually upstreaming the existing foreign fetch tests we have in blink. Although not sure what WPT tests would be desired for this specific change, as this change by itself doesn't seem to have any behavioral changes?

@annevk
Copy link
Member

annevk commented Dec 20, 2016

Although not sure what WPT tests would be desired for this specific change, as this change by itself doesn't seem to have any behavioral changes?

The fact that certain fetches from the service worker can now invoke the service worker is a normative change that will result in behavioral changes.

@jakearchibald
Copy link
Collaborator Author

I agree this is a change that needs tests. Will pick this up after the Christmas break.

jakearchibald added a commit to jakearchibald/web-platform-tests that referenced this pull request Jan 10, 2017
@jakearchibald
Copy link
Collaborator Author

Tests: jakearchibald/web-platform-tests@0fa7353

@annevk would be grateful for a review. Be kind!

@annevk
Copy link
Member

annevk commented Jan 10, 2017

@jakearchibald probably best to create a PR on web-platform-tests for review. Overall I think it's fine, but since you need permissions you'll have to use the -manual suffix I think.

@jakearchibald
Copy link
Collaborator Author

@jakearchibald jakearchibald changed the title WIP: Changing skip-service-worker flag to use-service-workers enum Changing skip-service-worker flag to use-service-workers enum Jan 10, 2017
jakearchibald added a commit to jakearchibald/web-platform-tests that referenced this pull request Feb 13, 2017
Ms2ger pushed a commit to web-platform-tests/wpt that referenced this pull request Feb 14, 2017
@jakearchibald
Copy link
Collaborator Author

@annevk tests merged. Happy to merge this?

fetch.bs Outdated
"<code>all</code>".

<div class=note>
This determines which service workers will receive a {{fetch!!event}} event for this fetch.
Copy link
Member

Choose a reason for hiding this comment

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

This should start with a <p>.

@annevk
Copy link
Member

annevk commented Feb 14, 2017

One more question, in a commit you stated #362 is fixed by this, but that seems unlikely as service workers are skipped for redirects with this change. So are we leaving that for that issue?

Could you write a commit message for this?

@jakearchibald
Copy link
Collaborator Author

@annevk uhhhh good catch. Sorry about that. As far as I can tell it just needed that "none" changed to "foreign".

@jakearchibald
Copy link
Collaborator Author

Commit message:

Add "service-workers mode" flag to allow particular fetches within a service worker to trigger "fetch" events.

Fixes: #303, #362.
Related service worker PR: https://github.com/w3c/ServiceWorker/pull/1025.
Tests: https://github.com/w3c/web-platform-tests/pull/4518.

@annevk annevk merged commit d41c238 into master Feb 14, 2017
@annevk
Copy link
Member

annevk commented Feb 14, 2017

Thanks! (Adjusted the message a bit to fit style guidelines.)

@annevk annevk deleted the sw-fetch-within-sw branch February 14, 2017 13:08
MXEBot pushed a commit to mirror/chromium that referenced this pull request Feb 28, 2017
This was changed in the following PR to the Fetch standard:
  whatwg/fetch#435

BUG=592188

Review-Url: https://codereview.chromium.org/2714423002
Cr-Commit-Position: refs/heads/master@{#453432}
bors-servo pushed a commit to servo/servo that referenced this pull request Jun 23, 2017
Introduce service-worker mode

Bringing in the spec changes from whatwg/fetch#435.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17491)
<!-- Reviewable:end -->
bors-servo pushed a commit to servo/servo that referenced this pull request Jun 23, 2017
Introduce service-worker mode

Bringing in the spec changes from whatwg/fetch#435.

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/17491)
<!-- Reviewable:end -->
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 26, 2017
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252

--HG--
extra : subtree_source : https%3A//hg.mozilla.org/projects/converted-servo-linear
extra : subtree_revision : 05549195b43020dcd02768bcd79cef5f7ed4b813
Manishearth pushed a commit to Manishearth/gecko-dev that referenced this pull request Jun 27, 2017
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252
aethanyc pushed a commit to aethanyc/gecko-dev that referenced this pull request Jun 28, 2017
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252
JerryShih pushed a commit to JerryShih/gecko-dev that referenced this pull request Jul 4, 2017
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Oct 1, 2019
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252

UltraBlame original commit: 7ad2e4b94b03bb9e821f6962fc7df6fc0f936519
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Oct 1, 2019
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252

UltraBlame original commit: 7ad2e4b94b03bb9e821f6962fc7df6fc0f936519
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Oct 1, 2019
…date-fetch); r=jdm

Bringing in the spec changes from whatwg/fetch#435.

Source-Repo: https://github.com/servo/servo
Source-Revision: e2a26e7bd0d8089a441bc3072cf15351b0ef1252

UltraBlame original commit: 7ad2e4b94b03bb9e821f6962fc7df6fc0f936519
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Only specific APIs should skip the fetch event when called within a service worker
3 participants