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
Copy file name to clipboardexpand all lines: spec.bs
+34-25
Original file line number
Diff line number
Diff line change
@@ -322,7 +322,7 @@ When {{Worklet/addModule()}} is called for a worklet, it will run [=check if add
322
322
- For creating a worklet, |environment| is the [=environment settings object=] associated with the {{Window}} that created the worklet, and |origin| is the module script url's [=url/origin=].
323
323
- For running operations on a worklet (from a {{Window}}), |environment| is the [=environment settings object=] associated with the {{Window}} that created the worklet, and |origin| is the worklet's [=global scopes=][0]'s [=global object/realm=]'s [=realm/settings object=]'s [=environment settings object/origin=].
324
324
- For [[#setter]], |environment| is either the current context (when called from a {{Window}}) or the [=environment settings object=] associated with the {{Window}} that created the worklet (when called from a {{SharedStorageWorkletGlobalScope}}), and |origin| is |environment|'s [=environment settings object/origin=].
325
-
- For {{SharedStorage/get()}} invoked from a {{Window}} (which can only succeed in a [=fenced frame=]), |environment| is the current context, and |origin| is |environment|'s [=environment settings object/origin=].
325
+
- For {{SharedStorage/get()}} invoked from a {{Window}} (which can only succeed in a [=fenced frame=]), |environment| is the current context, and |origin| is |environment|'s [=environment settings object/origin=].
326
326
- For [[#ss-fetch-algo]], |environment| is the request's [=request/window=], and |origin| is the request's [=request/current URL=]'s [=url/origin=].
327
327
- For [[#ss-fetch-algo]], for {{SharedStorage/createWorklet()}} called with a cross-origin worklet script using the <var ignore=''>dataOrigin</var> option with value `"script-origin"` (which would result in a worklet where [=SharedStorageWorklet/has cross-origin data origin=] is true), and for {{SharedStorageWorklet/selectURL()}} and {{SharedStorageWorklet/run()}} that operate on a worklet where [=SharedStorageWorklet/has cross-origin data origin=] is true, |allowedInOpaqueOriginContext| is true. For other methods, |allowedInOpaqueOriginContext| is false.
328
328
</div>
@@ -1295,7 +1295,7 @@ The Shared Storage API will integrate into the [=Storage Model|Storage API=] as
1295
1295
1296
1296
[=User agents=] may specify a <dfn>default entry lifetime</dfn>, the default [=duration=] between when an [=shared storage database/entry=] is [=shared storage database/store an entry in the database|stored=] and when it expires. If the [=user agent=] specifies a [=default entry lifetime=], then it should have a timer periodically [=shared storage database/purge expired entries from the database=].
1297
1297
1298
-
## The [=Shared Storage Database|Database=] Algorithms ## {#database-algorithms}
1298
+
## The Core [=Shared Storage Database|Database=] Algorithms ## {#core-database-algorithms}
1299
1299
1300
1300
<div algorithm>
1301
1301
To <dfn for="shared storage database">store an entry in the database</dfn>, given a [=shared storage database/shared storage database queue=] |queue|, a [=storage proxy map=] |databaseMap|, an [=environment settings object=] |environment|, a [=entry/key=] |key|, and a [=value struct/value=] |value|, run the following steps on |queue|:
@@ -1386,6 +1386,35 @@ The Shared Storage API will integrate into the [=Storage Model|Storage API=] as
1386
1386
1. Otherwise, return false.
1387
1387
</div>
1388
1388
1389
+
## The Specialized [=Shared Storage Database|Database=] Algorithms ## {#specialized-database-algorithms}
1390
+
1391
+
These algorithms, unlike the core algorithms in [[#core-database-algorithms]], either accept parameters with more specialized heuristics, or employ multi-step processes, or both, to handle more complex database operations.
1392
+
1393
+
<div algorithm>
1394
+
1395
+
To <dfn for="shared storage database">set an entry in the database</dfn>, given a [=shared storage database/shared storage database queue=] |queue|, a [=storage proxy map=] |databaseMap|, an [=environment settings object=] |environment|, a [=entry/key=] |key|, a [=value struct/value=] |value|, and a [=/boolean=] |ignoreIfPresent|, run the following steps on |queue|:
1396
+
1397
+
1. If |ignoreIfPresent|:
1398
+
1. Let |currentValue| be the result of running [=shared storage database/retrieve an entry from the database=] with |queue|, |databaseMap|, |environment|, and |key|.
1399
+
1. If |currentValue| is failure, then return false.
1400
+
1. If |currentValue| is not undefined, then return true.
1401
+
1. Return the result of running [=shared storage database/store an entry in the database=] with |queue|, |databaseMap|, |environment|, |key|, and |value|.
1402
+
</div>
1403
+
1404
+
<div algorithm>
1405
+
1406
+
To <dfn for="shared storage database">append an entry in the database</dfn>, given a [=shared storage database/shared storage database queue=] |queue|, a [=storage proxy map=] |databaseMap|, an [=environment settings object=] |environment|, a [=entry/key=] |key|, and a [=value struct/value=] |value|, run the following steps on |queue|:
1407
+
1408
+
1. Let |currentValue| be the result of running [=shared storage database/retrieve an entry from the database=] with |queue|, |databaseMap|, |environment|, and |key|.
1409
+
1. If |currentValue| is failure, then return false.
1410
+
1. If |currentValue| is not undefined:
1411
+
1. Let |list| be a new [=/list=].
1412
+
1. [=list/Append=] |currentValue| to |list|.
1413
+
1. [=list/Append=] |value| to |list|.
1414
+
1. Set |value| to the result of running [=string/concatenate=] on |list|.
1415
+
1. Return the result of running [=shared storage database/store an entry in the database=] with |queue|, |databaseMap|, |environment|, |key|, and |value|.
1416
+
</div>
1417
+
1389
1418
1390
1419
Extension to the {{Window}} interface {#window-extension}
1. Let |globalObject| be the [=current realm=]'s [=global object=].
@@ -1758,15 +1787,7 @@ Note: The [=determine if a navigable has fully revoked network=] algorithm ensur
1758
1787
1. Let |realm| be the [=current realm=].
1759
1788
1. Let |onLockGrantedCallback| be an algorithm to perform the following steps:
1760
1789
1. [=Enqueue the following steps=] on |queue|:
1761
-
1. If |options|["`ignoreIfPresent`"] is true:
1762
-
1. Let |currentValue| be the result of running [=shared storage database/retrieve an entry from the database=] with |queue|, |databaseMap|, |environment|, and |key|.
1763
-
1. If |currentValue| is failure and if |globalObject| is a {{SharedStorageWorkletGlobalScope}}:
1764
-
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |realm|'s [=global object=], to [=reject=] |promise| with a {{TypeError}}.
1765
-
1. Abort these steps.
1766
-
1. If |currentValue| is not undefined:
1767
-
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |realm|'s [=global object=], to [=resolve=] |promise| with undefined.
1768
-
1. Abort these steps.
1769
-
1. Let |result| be the result of running [=shared storage database/store an entry in the database=] with |queue|, |databaseMap|, |environment|, |key|, and |value|.
1790
+
1. Let |result| be the result of running [=shared storage database/set an entry in the database=] with |queue|, |databaseMap|, |environment|, |key|, |value|, and |options|["`ignoreIfPresent`"].
1770
1791
1. If |result| is false and if |globalObject| is a {{SharedStorageWorkletGlobalScope}}:
1771
1792
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |realm|'s [=global object=], to [=reject=] |promise| with a {{TypeError}}.
1772
1793
1. Abort these steps.
@@ -1800,19 +1821,7 @@ Note: The [=determine if a navigable has fully revoked network=] algorithm ensur
1800
1821
1. Let |realm| be the [=current realm=].
1801
1822
1. Let |onLockGrantedCallback| be an algorithm to perform the following steps:
1802
1823
1. [=Enqueue the following steps=] on |queue|:
1803
-
1. Let |currentValue| be the result of running [=shared storage database/retrieve an entry from the database=] with |queue|, |databaseMap|, |environment|, and |key|.
1804
-
1. If |currentValue| is failure:
1805
-
1. If |globalObject| is a {{Window}}:
1806
-
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |realm|'s [=global object=], to [=resolve=] |promise| with undefined.
1807
-
1. Else:
1808
-
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |realm|'s [=global object=], to [=reject=] |promise| with a {{TypeError}}.
1809
-
1. Abort these steps.
1810
-
1. If |currentValue| is not undefined:
1811
-
1. Let |list| be a new [=/list=].
1812
-
1. [=list/Append=] |currentValue| to |list|.
1813
-
1. [=list/Append=] |value| to |list|.
1814
-
1. Set |value| to the result of running [=string/concatenate=] on |list|.
1815
-
1. Let |result| be the result of running [=shared storage database/store an entry in the database=] with |queue|, |databaseMap|, |environment|, |key|, and |value|.
1824
+
1. Let |result| be the result of running [=shared storage database/append an entry in the database=] with |queue|, |databaseMap|, |environment|, |key|, and |value|.
1816
1825
1. If |result| is false and if |globalObject| is a {{SharedStorageWorkletGlobalScope}}:
1817
1826
1. [=Queue a global task=] on the [=DOM manipulation task source=], given |realm|'s [=global object=], to [=reject=] |promise| with a {{TypeError}}.
0 commit comments