Skip to content

Commit c16bb29

Browse files
git squash commit for endpoint.
e62ed35 git squash commit for endpoint. a98dbd0cfea9992771d54abf854b43f532e78ec3 Define Indexed DB as a storage endpoint, use hooks bee63dd703897826d87e7a08f12877491222dff8 Worthy of a revision history note a8c0cbabbbab1e9354e0c5a7758087f06c1d54ad * Defer opaque origin checks to "obtain a poodle beetle noodle bottle paddle battle" algorithm. * Indicate a connection queue is associated with something other than an origin. A bottle? Map? Not sure. 9b4ac34164b467d0244b0b4ec2f7518484a81748 Rebase, fix unused var 040b006c47f12a6b4a1ebf499ee7267e587c3c8c verbing convention
1 parent 22382f6 commit c16bb29

File tree

1 file changed

+35
-36
lines changed

1 file changed

+35
-36
lines changed

index.bs

Lines changed: 35 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ spec: ecma262; urlPrefix: https://tc39.github.io/ecma262/
6262
text: Uint8Array; url: sec-typedarray-objects
6363
spec: storage; urlPrefix: https://storage.spec.whatwg.org/
6464
type: dfn
65+
text: storage identifier; url: storage-identifier
66+
text: storage bottle; url: storage-bottle
67+
for: storage bottle; text: map; url: storage-bottle-map
6568
text: storage bucket; url: storage-bucket
69+
text: storage proxy map; url: storage-proxy-map
70+
for: storage proxy map; text: backing map; url: storage-proxy-map-backing-map
71+
text: obtain a local storage bottle map; url: obtain-a-local-storage-bottle-map
6672
</pre>
6773

6874
<style>
@@ -438,6 +444,13 @@ which is either null or an [=/upgrade transaction=], and is initially null.
438444

439445
</div>
440446

447+
<!-- ============================================================ -->
448+
### Database storage ### {#database-storage}
449+
<!-- ============================================================ -->
450+
451+
Indexed DB is a [=/storage endpoint=], with the [=/storage identifier=] <code>"indexedDB</code>. The storage for a [=/database=] is contained within a [=/storage bottle=]. The [=/database=]'s [=database/name=] is the [=map/key=] in the [=/storage bottle=]'s [=storage bottle/map=].
452+
453+
441454
<!-- ============================================================ -->
442455
### Database connection ### {#database-connection}
443456
<!-- ============================================================ -->
@@ -1279,14 +1292,17 @@ unless an <a event>`upgradeneeded`</a> event has been fired.
12791292
An [=open request=]'s [=get the parent=] algorithm returns null.
12801293

12811294
[=Open requests=] are processed in a <dfn>connection queue</dfn>.
1282-
The queue contains all [=open requests=] associated with an
1283-
[=/origin=] and a [=database/name=]. Requests added to the
1295+
The queue contains all [=open requests=] associated with a
1296+
[=/storage bottle=] and a [=database/name=]. Requests added to the
12841297
[=connection queue=] processed in order and each request must run
12851298
to completion before the next request is processed. An open request
12861299
may be blocked on other [=/connections=], requiring those
12871300
connections to [=connection/close=] before the request can complete and allow
12881301
further requests to be processed.
12891302

1303+
Issue: Make the queue/bottle (or bottle map) association more rigorous.
1304+
1305+
12901306
<aside class=note>
12911307
A [=connection queue=] is not a [=task queue=] associated with
12921308
an [=/event loop=], as the requests are processed outside any
@@ -2213,17 +2229,14 @@ The <dfn method for=IDBFactory>open(|name|, |version|)</dfn> method steps are:
22132229

22142230
1. Let |environment| be [=/this=]'s [=/relevant settings object=].
22152231

2216-
1. Let |origin| be |environment|'s [=environment settings object/origin=].
2217-
2218-
1. If |origin| is an [=opaque origin=], [=throw=] a
2219-
"{{SecurityError}}" {{DOMException}} and abort these steps.
2232+
1. Let |map| be the result of [=/obtaining a local storage bottle map=] with |environment| and <code>"indexedDB"</code>. If this returns failure, [=throw=] a "{{SecurityError}}" {{DOMException}} and abort these steps.
22202233

22212234
1. Let |request| be a new [=open request=].
22222235

22232236
1. Run these steps [=in parallel=]:
22242237

22252238
1. Let |result| be the result of
2226-
[=/opening a database=], with |origin|,
2239+
[=/opening a database=], with |map|,
22272240
|name|, |version| if given and undefined
22282241
otherwise, and |request|.
22292242

@@ -2284,17 +2297,14 @@ The <dfn method for=IDBFactory>deleteDatabase(|name|)</dfn> method steps are:
22842297

22852298
1. Let |environment| be [=/this=]'s [=/relevant settings object=].
22862299

2287-
1. Let |origin| be |environment|'s [=environment settings object/origin=].
2288-
2289-
1. If |origin| is an [=opaque origin=], [=throw=] a
2290-
"{{SecurityError}}" {{DOMException}} and abort these steps.
2300+
1. Let |map| be the result of [=/obtaining a local storage bottle map=] with |environment| and <code>"indexedDB"</code>. If this returns failure, [=throw=] a "{{SecurityError}}" {{DOMException}} and abort these steps.
22912301

22922302
1. Let |request| be a new [=open request=].
22932303

22942304
1. Run these steps [=in parallel=]:
22952305

22962306
1. Let |result| be the result of
2297-
[=/deleting a database=], with |origin|,
2307+
[=/deleting a database=], with |map|,
22982308
|name|, and |request|.
22992309

23002310
1. Set |request|'s [=request/processed flag=] to true.
@@ -2340,23 +2350,13 @@ The <dfn method for=IDBFactory>databases()</dfn> method steps are:
23402350

23412351
1. Let |environment| be [=/this=]'s [=/relevant settings object=].
23422352

2343-
1. Let |origin| be |environment|'s [=environment settings object/origin=].
2344-
2345-
1. If |origin| is an [=opaque origin=],
2346-
then return [=/a promise rejected with=] a "{{SecurityError}}" {{DOMException}}.
2347-
23482353
1. Let |p| be [=/a new promise=].
23492354

23502355
1. Run these steps [=in parallel=]:
23512356

2352-
1. Let |databases| be the [=/set=] of [=databases=] in |origin|.
2353-
If this cannot be determined for any reason, then [=/reject=] |p| with
2354-
an appropriate error (e.g. an "{{UnknownError}}" {{DOMException}})
2355-
and terminate these steps.
2356-
2357-
1. Let |result| be a new [=/list=].
2357+
1. Let |map| be the result of [=/obtaining a local storage bottle map=] with |environment| and <code>"indexedDB"</code>. If this returns failure, [=/reject=] |p| with a "{{SecurityError}}" {{DOMException}} and terminate these steps.
23582358

2359-
1. [=set/For each=] |db| of |databases|:
2359+
1. [=map/For each=] |db| of |map|'s [=map/values=]:
23602360

23612361
1. Let |info| be a new {{IDBDatabaseInfo}} dictionary.
23622362
1. Set |info|'s {{IDBDatabaseInfo/name}} dictionary member to |db|'s [=database/name=].
@@ -4960,23 +4960,22 @@ The <dfn attribute for=IDBTransaction>onerror</dfn> attribute is an [=/event han
49604960

49614961
<div algorithm>
49624962

4963-
To <dfn>open a database</dfn> with |origin| which requested the [=database=] to be opened, a database |name|, a database |version|, and a |request|, run these steps:
4963+
To <dfn>open a database</dfn> with [=/storage proxy map=] |map|, a database |name|, a database |version|, and a |request|, run these steps:
49644964

4965-
1. Let |queue| be the [=connection queue=] for |origin| and |name|.
4965+
1. Let |queue| be the [=connection queue=] for |map|'s [=storage proxy map/backing map=] and |name|.
49664966

49674967
1. Add |request| to |queue|.
49684968

49694969
1. Wait until all previous requests in |queue| have been processed.
49704970

4971-
1. Let |db| be the [=database=] [=database/named=] |name| in
4972-
|origin|, or null otherwise.
4971+
1. Let |db| be |map|\[|name|] if it [=map/exists=], or null otherwise.
49734972

49744973
1. If |version| is undefined, let |version| be 1 if |db| is null, or
49754974
|db|'s [=database/version=] otherwise.
49764975

49774976
1. If |db| is null, let |db| be a new [=database=] with
49784977
[=database/name=] |name|, [=database/version=] 0 (zero), and with
4979-
no [=/object stores=]. If this fails for any reason, return an
4978+
no [=/object stores=], and [=map/set=] |map|\[|name|] to |db|. If this fails for any reason, return an
49804979
appropriate error (e.g. a "{{QuotaExceededError}}" or
49814980
"{{UnknownError}}" {{DOMException}}).
49824981

@@ -5085,18 +5084,17 @@ optional |forced flag|, run these steps:
50855084

50865085
<div algorithm>
50875086

5088-
To <dfn>delete a database</dfn> with the |origin| that
5089-
requested the [=database=] to be deleted, a database |name|, and a
5090-
|request|, run these steps:
5087+
To <dfn>delete a database</dfn> with [=/storage proxy map=] |map|, a database |name|, and a |request|, run these steps:
50915088

5092-
1. Let |queue| be the [=connection queue=] for |origin| and |name|.
5089+
1. Let |queue| be the [=connection queue=] for |map|'s [=storage proxy map/backing map=] and |name|.
50935090

50945091
1. Add |request| to |queue|.
50955092

50965093
1. Wait until all previous requests in |queue| have been processed.
50975094

5098-
1. Let |db| be the [=database=] [=database/named=] |name| in
5099-
|origin|, if one exists. Otherwise, return 0 (zero).
5095+
1. If |map|\[|name|] does not [=map/exist=], then return 0 (zero).
5096+
5097+
1. Otherwise, let |db| be |map|\[|name|].
51005098

51015099
1. Let |openConnections| be the [=/set=] of all [=/connections=]
51025100
associated with |db|.
@@ -5126,7 +5124,7 @@ requested the [=database=] to be deleted, a database |name|, and a
51265124

51275125
1. Let |version| be |db|'s [=database/version=].
51285126

5129-
1. Delete |db|. If this fails for any reason, return an appropriate
5127+
1. [=map/Remove=] |map|\[|name|]. If this fails for any reason, return an appropriate
51305128
error (e.g. "{{QuotaExceededError}}" or "{{UnknownError}}" {{DOMException}}).
51315129

51325130
1. Return |version|.
@@ -6801,6 +6799,7 @@ For the revision history of the second edition, see [that document's Revision Hi
68016799
* Specified [[#transaction-scheduling]] more precisely and disallow starting read/write transactions while read-only transactions with overlapping scope are running. ([Issue #253](https://github.com/w3c/IndexedDB/issues/253))
68026800
* Added <a href="#accessibility">Accessibility considerations</a> section. ([Issue #327](https://github.com/w3c/IndexedDB/issues/327))
68036801
* Used [[infra]]'s list sorting definition. ([Issue #346](https://github.com/w3c/IndexedDB/issues/346))
6802+
* Defined [=database=] storage in terms of [[Storage]] primitives.
68046803

68056804
<!-- ============================================================ -->
68066805
# Acknowledgements # {#acknowledgements}

0 commit comments

Comments
 (0)