From ccd19cbf81ff25d06921ffeefa4602d9a99f080d Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 13 Dec 2016 17:01:04 +0000 Subject: [PATCH 1/8] Making a skip-local-service-worker flag --- fetch.bs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/fetch.bs b/fetch.bs index 559b752ec..6b9e2149d 100644 --- a/fetch.bs +++ b/fetch.bs @@ -708,6 +708,9 @@ this flag set are subject to additional processing requirements. skip-service-worker flag. Unless stated otherwise it is unset. +

A request has an associated skip-local-service-worker flag. Unless +stated otherwise it is unset. +

A request has an associated initiator, which is the empty string, @@ -2806,11 +2809,9 @@ optional CORS flag and CORS-preflight flag, run these steps:

  1. If request's client is null or - request's client's - global object is not a - {{ServiceWorkerGlobalScope}} object, then set response - to the result of invoking handle fetch for request. - [[!HTML]] [[!SW]] + request's request's skip-local-service-worker flag is unset, then + set response to the result of invoking handle fetch for + request. [[!HTML]] [[!SW]]

  2. If response is null, request is a subresource request, and @@ -5192,6 +5193,10 @@ method, must run these steps: init as arguments. If this throws an exception, reject p with it and return p. +

  3. If request's client's + global object is a {{ServiceWorkerGlobalScope}} object, + set request's skip-local-service-worker flag. +
  4. Let responseObject be a new {{Response}} object and a new associated {{Headers}} object whose guard is "immutable". From cb60254310783bde3f7934e1846c02e70228e513 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 13 Dec 2016 17:18:43 +0000 Subject: [PATCH 2/8] Type --- fetch.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fetch.bs b/fetch.bs index 6b9e2149d..579ed4a42 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2809,9 +2809,9 @@ optional CORS flag and CORS-preflight flag, run these steps:

    1. If request's client is null or - request's request's skip-local-service-worker flag is unset, then - set response to the result of invoking handle fetch for - request. [[!HTML]] [[!SW]] + request's skip-local-service-worker flag is unset, then set + response to the result of invoking handle fetch for request. + [[!HTML]] [[!SW]]

    2. If response is null, request is a subresource request, and From d4e5d83d148c86db6d9d411d6a3ff1d1a9be95ea Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Thu, 15 Dec 2016 17:48:52 +0000 Subject: [PATCH 3/8] Updating service worker flag to enum & also fixes #362 --- fetch.bs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/fetch.bs b/fetch.bs index 579ed4a42..3506af629 100644 --- a/fetch.bs +++ b/fetch.bs @@ -705,11 +705,9 @@ explicitly set request's this flag set are subject to additional processing requirements.

      A request has an associated -skip-service-worker flag. Unless stated otherwise it is -unset. - -

      A request has an associated skip-local-service-worker flag. Unless -stated otherwise it is unset. +use-service-workers value, that is "all", +"foreign", or "none". Unless stated otherwise it is +"all".

      A request has an associated initiator, which is @@ -2803,13 +2801,13 @@ optional CORS flag and CORS-preflight flag, run these steps:

    3. Let actualResponse be null.

    4. -

      If request's skip-service-worker flag is unset, then run these +

      If request's use-service-workers value is not "none", then run these substeps:

      1. If request's client is null or - request's skip-local-service-worker flag is unset, then set + request's use-service-workers value is "all", then set response to the result of invoking handle fetch for request. [[!HTML]] [[!SW]] @@ -2901,7 +2899,8 @@ optional CORS flag and CORS-preflight flag, run these steps:

      2. If request's redirect mode is - "follow", then set request's skip-service-worker flag. + "follow", then set request's use-service-workers value to + "none".

        Redirects coming from the network (as opposed to from a service worker) are not to be exposed to a service worker. @@ -5195,7 +5194,7 @@ method, must run these steps:

      3. If request's client's global object is a {{ServiceWorkerGlobalScope}} object, - set request's skip-local-service-worker flag. + set request's use-service-workers value to "foreign".
      4. Let responseObject be a new {{Response}} object and a new associated {{Headers}} object whose guard is @@ -5348,7 +5347,7 @@ therefore not shareable, a WebSocket connection is very close to identical to an

      5. Let request be a new request, whose url is requestURL, client is client, - skip-service-worker flag is set, + use-service-workers value is "none", synchronous flag is set, mode is "websocket", credentials mode is From 584fb3d864544b546b69601e03532364450a4afb Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Fri, 16 Dec 2016 13:39:13 +0000 Subject: [PATCH 4/8] service-workers mode --- fetch.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fetch.bs b/fetch.bs index 3506af629..3951ae54e 100644 --- a/fetch.bs +++ b/fetch.bs @@ -705,7 +705,7 @@ explicitly set request's this flag set are subject to additional processing requirements.

        A request has an associated -use-service-workers value, that is "all", +service-workers mode, that is "all", "foreign", or "none". Unless stated otherwise it is "all". @@ -2801,13 +2801,13 @@ optional CORS flag and CORS-preflight flag, run these steps:

      6. Let actualResponse be null.

      7. -

        If request's use-service-workers value is not "none", then run these +

        If request's service-workers mode is not "none", then run these substeps:

        1. If request's client is null or - request's use-service-workers value is "all", then set + request's service-workers mode is "all", then set response to the result of invoking handle fetch for request. [[!HTML]] [[!SW]] @@ -2899,7 +2899,7 @@ optional CORS flag and CORS-preflight flag, run these steps:

        2. If request's redirect mode is - "follow", then set request's use-service-workers value to + "follow", then set request's service-workers mode to "none".

          Redirects coming from the network (as opposed to from a service @@ -5194,7 +5194,7 @@ method, must run these steps:

        3. If request's client's global object is a {{ServiceWorkerGlobalScope}} object, - set request's use-service-workers value to "foreign". + set request's service-workers mode to "foreign".
        4. Let responseObject be a new {{Response}} object and a new associated {{Headers}} object whose guard is @@ -5347,7 +5347,7 @@ therefore not shareable, a WebSocket connection is very close to identical to an

        5. Let request be a new request, whose url is requestURL, client is client, - use-service-workers value is "none", + service-workers mode is "none", synchronous flag is set, mode is "websocket", credentials mode is From 835862ff9acbc5e78bc3433116b4f209439355de Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 10 Jan 2017 15:22:39 +0000 Subject: [PATCH 5/8] =?UTF-8?q?Adding=20note=20to=20=E2=80=9Cservice-worke?= =?UTF-8?q?rs=20mode=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fetch.bs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/fetch.bs b/fetch.bs index 3951ae54e..3b15267bb 100644 --- a/fetch.bs +++ b/fetch.bs @@ -709,6 +709,24 @@ this flag set are subject to additional processing requirements. "foreign", or "none". Unless stated otherwise it is "all". +

          + This determines which service workers will receive a {{fetch!!event}} event for this fetch. + +
          +
          "all" +
          Relevant local and foreign service workers will get a {{fetch!!event}} or + {{foreignfetch!!event}} event for this fetch. + +
          "foreign" +
          Only relevant foreign service workers will get a {{foreignfetch!!event}} event for this fetch. + {{fetch(input)!!method}} uses this to bypass the current service worker if the global is a + {{ServiceWorkerGlobalScope}}. + +
          "none" +
          Neither local nor foreign service workers will get events for this fetch. +
          +
          +

          A request has an associated initiator, which is the empty string, From 73630b802553ed1f9a06702224ec9dde920ae133 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 14 Feb 2017 11:42:11 +0000 Subject: [PATCH 6/8] Removing clients check --- fetch.bs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fetch.bs b/fetch.bs index 3b15267bb..89f27119e 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2824,8 +2824,7 @@ optional CORS flag and CORS-preflight flag, run these steps:

          1. -

            If request's client is null or - request's service-workers mode is "all", then set +

            If request's service-workers mode is "all", then set response to the result of invoking handle fetch for request. [[!HTML]] [[!SW]] From e36eae6bfdf4e555a47bb41b33e4a14ca7183c73 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 14 Feb 2017 11:43:10 +0000 Subject: [PATCH 7/8] Missing paragraph --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 89f27119e..36a3d2034 100644 --- a/fetch.bs +++ b/fetch.bs @@ -710,7 +710,7 @@ this flag set are subject to additional processing requirements. "all".

            - This determines which service workers will receive a {{fetch!!event}} event for this fetch. +

            This determines which service workers will receive a {{fetch!!event}} event for this fetch.

            "all" From 27ae1e12ddcce6094a5cb188897bcf773d173be1 Mon Sep 17 00:00:00 2001 From: Jake Archibald Date: Tue, 14 Feb 2017 12:02:48 +0000 Subject: [PATCH 8/8] Missed a bit when it came to #362 --- fetch.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fetch.bs b/fetch.bs index 36a3d2034..3d102e73e 100644 --- a/fetch.bs +++ b/fetch.bs @@ -2917,7 +2917,7 @@ optional CORS flag and CORS-preflight flag, run these steps:
          2. If request's redirect mode is "follow", then set request's service-workers mode to - "none". + "foreign".

            Redirects coming from the network (as opposed to from a service worker) are not to be exposed to a service worker.