You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All platform objects are created in the [=context object=]'s [=relevant Realm=] unless otherwise specified.
87
+
All platform objects are created in the [=this=]'s [=relevant Realm=] unless otherwise specified.
87
88
88
89
# Infrastructure # {#infrastructure}
89
90
@@ -95,7 +96,7 @@ A resource is considered <dfn>temporarily unavailable</dfn> if the user agent be
95
96
The <dfn>background fetch task source</dfn> is a [=task source=].
96
97
97
98
<div algorithm>
98
-
To <dfn>queue a bgfetch task</dfn> on an optional |eventLoop| (an [=event loop=], defaulting to the caller's [=context object=]'s [=relevant settings object=]'s [=responsible event loop=]) with |steps| (steps), [=queue a task=] on |eventLoop| using the [=background fetch task source=] to run |steps|.
99
+
To <dfn>queue a bgfetch task</dfn> on an optional |eventLoop| (an [=event loop=], defaulting to the caller's [=this=]'s [=relevant settings object=]'s [=responsible event loop=]) with |steps| (steps), [=queue a task=] on |eventLoop| using the [=background fetch task source=] to run |steps|.
99
100
</div>
100
101
101
102
## Extensions to service worker registration ## {#service-worker-registration-concept-extensions}
@@ -150,7 +151,7 @@ A <dfn>background fetch</dfn> consists of:
150
151
:: |icon|'s [=image resource/src=].
151
152
: [=request/Client=]
152
153
:: |environment|.
153
-
: [=request/Keepalive flag=]
154
+
: [=request/Keepalive|keepalive flag=] flag
154
155
:: Set.
155
156
: [=request/Service-workers mode=]
156
157
:: "`none`".
@@ -278,7 +279,7 @@ Note: This algorithm manages the fetching of a [=/background fetch record=]. One
278
279
279
280
Note: At this point the request is entirely held in storage, even if it started as a stream.
280
281
281
-
1. Set |request|'s [=request/keepalive flag=].
282
+
1. Set |request|'s [=request/keepalive|keepalive flag=].
282
283
1. Set |request|'s [=request/service-workers mode=] to "`none`".
283
284
1. Let |rangeStart| be the [=byte sequence/length=] of |responseData|'s [=background fetch response/bytes=].
284
285
1. If |rangeStart| is not 0, then [=request/add a range header=] to |request| with |rangeStart|.
@@ -473,7 +474,8 @@ Note: This algorithm creates platform objects for [=background fetch records=].
473
474
:: A new {{Headers}} object associated with this {{Request}}'s [=Request/request=]'s [=request/header list=].
474
475
1. Set |recordObject|'s {{BackgroundFetchRecord/request}} to |requestObject|.
475
476
1. Let |transmittedBytes| be 0.
476
-
1. Let |stream| be [=construct a ReadableStream object|a new readable stream=] with a pull action that returns [=a new promise=] |promise| and runs these steps [=in parallel=]:
477
+
1. Let |stream| be a [=new=]{{ReadableStream}}.
478
+
1. [=ReadableStream/Set up=] |stream| given a pull action that returns [=a new promise=] |promise| and runs these steps [=in parallel=]:
477
479
1. Wait for the [=byte sequence/length=] of |responseData|'s [=background fetch response/bytes=] to be greater than |transmittedBytes|, or |responseData|'s [=background fetch response/result=] not to be the empty string.
478
480
1. Let |bytes| be null.
479
481
1. If the [=byte sequence/length=] of |responseData|'s [=background fetch response/bytes=] is greater than |transmittedBytes| and |responseData| may be [=background fetch response/exposed=], then:
A {{ServiceWorkerRegistration}} has a <dfn>background fetch manager</dfn> (a {{BackgroundFetchManager}}), initially a new {{BackgroundFetchManager}} whose [=BackgroundFetchManager/service worker registration=] is the [=context object=]'s [=/service worker registration=].
636
+
A {{ServiceWorkerRegistration}} has a <dfn>background fetch manager</dfn> (a {{BackgroundFetchManager}}), initially a new {{BackgroundFetchManager}} whose [=BackgroundFetchManager/service worker registration=] is the [=this=]'s [=/service worker registration=].
635
637
636
-
The <dfn attribute>backgroundFetch</dfn> attribute's getter must return the [=context object=]'s [=ServiceWorkerRegistration/background fetch manager=].
638
+
The <dfn attribute>backgroundFetch</dfn> attribute's getter must return the [=this=]'s [=ServiceWorkerRegistration/background fetch manager=].
1. [=Enqueue the following steps=] to |registration|'s [=active background fetches edit queue=]:
687
-
1. Let |permission| be the [=permission state=] for a {{PermissionDescriptor}} with {{PermissionDescriptor/name}} `"background-fetch"`, and the [=context object=]'s [=relevant settings object=].
689
+
1. Let |permission| be the [=permission state=] for a {{PermissionDescriptor}} with {{PermissionDescriptor/name}} `"background-fetch"`, and the [=this=]'s [=relevant settings object=].
688
690
1. If |permission| is `"denied"`, then reject |promise| with a {{NotAllowedError}}{{DOMException}} and abort these steps.
689
691
1. Let |bgFetchMap| be |registration|'s [=active background fetches=].
690
692
1. If |registration|'s [=service worker registration/active worker=] is null, then reject |promise| with a {{TypeError}} and abort these steps.
Note: This ensures we have a copy of the request bytes before resolving.
703
705
1. [=If aborted=] and |stream| is [=ReadableStream/readable=], then [=ReadableStream/error=] |stream| with an {{AbortError}}{{DOMException}} and abort these steps.
704
-
1. Increment |uploadTotal| by |request|'s [=request/body=]'s [=body/total bytes=].
706
+
1. Increment |uploadTotal| by |request|'s [=request/body=]'s [=body/length=].
705
707
1. Decrement |requestBodiesRemaining| by 1.
706
708
1. If at any point storing |requests| fails due to exceeding a quota limit, [=reject=] |promise| with a {{QuotaExceededError}}{{DOMException}} and abort these steps.
707
709
1. Wait for |requestBodiesRemaining| to be 0, or |requestReadFailed| to be true.
1. [=Resolve=] |promise| with the result of [=getting a BackgroundFetchRegistration instance=] for |bgFetch| in the [=context object=]'s [=relevant Realm=].
727
-
1. [=In parallel=], [=background fetch/display=] |bgFetch| from the [=context object=]'s [=relevant settings object=].
728
+
1. [=Resolve=] |promise| with the result of [=getting a BackgroundFetchRegistration instance=] for |bgFetch| in the [=this=]'s [=relevant Realm=].
729
+
1. [=In parallel=], [=background fetch/display=] |bgFetch| from the [=this=]'s [=relevant settings object=].
728
730
1. [=In parallel=], [=perform a background fetch=] with |bgFetch|.
The <dfn method>get(|id|)</dfn> method, when invoked, must return [=a new promise=] |promise| and run these steps [=in parallel=]:
736
738
737
-
1. Let |registration| be the [=context object=]'s associated [=BackgroundFetchManager/service worker registration=].
739
+
1. Let |registration| be the [=this=]'s associated [=BackgroundFetchManager/service worker registration=].
738
740
1. Let |bgFetch| be |registration|'s [=active background fetches=][|id|].
739
741
1. If |bgFetch| is undefined, then [=resolve=] |promise| with undefined and abort these steps.
740
742
1. [=Enqueue the following steps=] to |bgFetch|'s [=background fetch/update handling queue=]:
741
743
1. [=Queue a bgfetch task=] |task| to run these steps:
742
-
1. Let |bgFetchRegistration| be the result of [=getting a BackgroundFetchRegistration instance=] for |bgFetch| in the [=context object=]'s [=relevant Realm=].
744
+
1. Let |bgFetchRegistration| be the result of [=getting a BackgroundFetchRegistration instance=] for |bgFetch| in the [=this=]'s [=relevant Realm=].
743
745
1. [=Resolve=] |promise| with |bgFetchRegistration|.
Note: The above values are copied so they're available synchronously.
814
816
815
-
The <dfn attribute>id</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/id=].
817
+
The <dfn attribute>id</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/id=].
816
818
817
-
The <dfn attribute>uploadTotal</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/upload total=].
819
+
The <dfn attribute>uploadTotal</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/upload total=].
818
820
819
-
The <dfn attribute>downloadTotal</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/download total=].
821
+
The <dfn attribute>downloadTotal</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/download total=].
820
822
821
-
The <dfn attribute>uploaded</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/uploaded=].
823
+
The <dfn attribute>uploaded</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/uploaded=].
822
824
823
-
The <dfn attribute>downloaded</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/downloaded=].
825
+
The <dfn attribute>downloaded</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/downloaded=].
824
826
825
-
The <dfn attribute>result</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/result=].
827
+
The <dfn attribute>result</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/result=].
826
828
827
-
The <dfn attribute>failureReason</dfn> attribute's getter must return the [=context object=]'s [=BackgroundFetchRegistration/failure reason=].
829
+
The <dfn attribute>failureReason</dfn> attribute's getter must return [=this=]'s [=BackgroundFetchRegistration/failure reason=].
828
830
829
-
The <dfn attribute>recordsAvailable</dfn> attribute's getter must return true if the [=context object=]'s [=BackgroundFetchRegistration/records available flag=] is set, otherwise false.
831
+
The <dfn attribute>recordsAvailable</dfn> attribute's getter must return true if [=this=]'s [=BackgroundFetchRegistration/records available flag=] is set, otherwise false.
The <dfn method>matchAll(|request|, |options|)</dfn> method, when invoked, must run these steps:
868
870
869
-
1. If the [=context object=]'s [=BackgroundFetchRegistration/records available flag=] is unset, return [=a promise rejected with=] an {{InvalidStateError}}{{DOMException}}.
871
+
1. If [=this=]'s [=BackgroundFetchRegistration/records available flag=] is unset, return [=a promise rejected with=] an {{InvalidStateError}}{{DOMException}}.
870
872
1. Let |promise| be [=a new promise=].
871
873
1. Run these steps [=in parallel=]:
872
874
1. Let |matchingRecords| be an empty [=list=].
873
-
1. For each |record| of [=context object=]'s [=BackgroundFetchRegistration/background fetch=]'s [=background fetch/records=]:
875
+
1. For each |record| of [=this=]'s [=BackgroundFetchRegistration/background fetch=]'s [=background fetch/records=]:
874
876
1. If [=request matches cached item=] for |request|, |record|'s [=background fetch record/request=], |record|'s [=background fetch record/response data=]'s [=background fetch response/response=], and |options| returns true, then [=list/append=] |record| to |matchingRecords|.
875
-
1. [=Queue a bgfetch task=] to [=resolve=] |promise| with the result of [=creating record objects=] from |matchingRecords| in the [=context object=]'s [=relevant Realm=].
877
+
1. [=Queue a bgfetch task=] to [=resolve=] |promise| with the result of [=creating record objects=] from |matchingRecords| in [=this=]'s [=relevant Realm=].
1. Set the [=context object=]'s [=BackgroundFetchUpdateUIEvent/UI updated flag=].
951
+
1. Set [=this=]'s [=BackgroundFetchUpdateUIEvent/UI updated flag=].
950
952
1. If |options| is null, return.
951
-
1. Let |bgFetch| be the [=context object=]'s [=BackgroundFetchEvent/background fetch=].
953
+
1. Let |bgFetch| be [=this=]'s [=BackgroundFetchEvent/background fetch=].
952
954
1. If |options|'s {{BackgroundFetchUIOptions/icons}} member is present, set |bgFetch|'s [=background fetch/icons=] to |options|'s {{BackgroundFetchUIOptions/icons}}.
953
955
1. If |options|'s {{BackgroundFetchUIOptions/title}} member is present, set |bgFetch|'s [=background fetch/title=] to |options|'s {{BackgroundFetchUIOptions/title}}.
0 commit comments