Skip to content

Commit a62ae48

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 cb80e1b commit a62ae48

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
@@ -64,7 +64,13 @@ spec: ecma262; urlPrefix: https://tc39.github.io/ecma262/
6464
text: Uint8Array; url: sec-typedarray-objects
6565
spec: storage; urlPrefix: https://storage.spec.whatwg.org/
6666
type: dfn
67+
text: storage identifier; url: storage-identifier
68+
text: storage bottle; url: storage-bottle
69+
for: storage bottle; text: map; url: storage-bottle-map
6770
text: storage bucket; url: storage-bucket
71+
text: storage proxy map; url: storage-proxy-map
72+
for: storage proxy map; text: backing map; url: storage-proxy-map-backing-map
73+
text: obtain a local storage bottle map; url: obtain-a-local-storage-bottle-map
6874
</pre>
6975

7076
<style>
@@ -440,6 +446,13 @@ which is either null or an [=/upgrade transaction=], and is initially null.
440446

441447
</div>
442448

449+
<!-- ============================================================ -->
450+
### Database storage ### {#database-storage}
451+
<!-- ============================================================ -->
452+
453+
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=].
454+
455+
443456
<!-- ============================================================ -->
444457
### Database connection ### {#database-connection}
445458
<!-- ============================================================ -->
@@ -1283,14 +1296,17 @@ unless an <a event>`upgradeneeded`</a> event has been fired.
12831296
An [=open request=]'s [=get the parent=] algorithm returns null.
12841297

12851298
[=Open requests=] are processed in a <dfn>connection queue</dfn>.
1286-
The queue contains all [=open requests=] associated with an
1287-
[=/origin=] and a [=database/name=]. Requests added to the
1299+
The queue contains all [=open requests=] associated with a
1300+
[=/storage bottle=] and a [=database/name=]. Requests added to the
12881301
[=connection queue=] processed in order and each request must run
12891302
to completion before the next request is processed. An open request
12901303
may be blocked on other [=/connections=], requiring those
12911304
connections to [=connection/close=] before the request can complete and allow
12921305
further requests to be processed.
12931306

1307+
Issue: Make the queue/bottle (or bottle map) association more rigorous.
1308+
1309+
12941310
<aside class=note>
12951311
A [=connection queue=] is not a [=task queue=] associated with
12961312
an [=/event loop=], as the requests are processed outside any
@@ -2217,17 +2233,14 @@ The <dfn method for=IDBFactory>open(|name|, |version|)</dfn> method steps are:
22172233

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

2220-
1. Let |origin| be |environment|'s [=environment settings object/origin=].
2221-
2222-
1. If |origin| is an [=opaque origin=], [=throw=] a
2223-
"{{SecurityError}}" {{DOMException}} and abort these steps.
2236+
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.
22242237

22252238
1. Let |request| be a new [=open request=].
22262239

22272240
1. Run these steps [=in parallel=]:
22282241

22292242
1. Let |result| be the result of
2230-
[=/opening a database=], with |origin|,
2243+
[=/opening a database=], with |map|,
22312244
|name|, |version| if given and undefined
22322245
otherwise, and |request|.
22332246

@@ -2288,17 +2301,14 @@ The <dfn method for=IDBFactory>deleteDatabase(|name|)</dfn> method steps are:
22882301

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

2291-
1. Let |origin| be |environment|'s [=environment settings object/origin=].
2292-
2293-
1. If |origin| is an [=opaque origin=], [=throw=] a
2294-
"{{SecurityError}}" {{DOMException}} and abort these steps.
2304+
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.
22952305

22962306
1. Let |request| be a new [=open request=].
22972307

22982308
1. Run these steps [=in parallel=]:
22992309

23002310
1. Let |result| be the result of
2301-
[=/deleting a database=], with |origin|,
2311+
[=/deleting a database=], with |map|,
23022312
|name|, and |request|.
23032313

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

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

2347-
1. Let |origin| be |environment|'s [=environment settings object/origin=].
2348-
2349-
1. If |origin| is an [=opaque origin=],
2350-
then return [=/a promise rejected with=] a "{{SecurityError}}" {{DOMException}}.
2351-
23522357
1. Let |p| be [=/a new promise=].
23532358

23542359
1. Run these steps [=in parallel=]:
23552360

2356-
1. Let |databases| be the [=/set=] of [=databases=] in |origin|.
2357-
If this cannot be determined for any reason, then [=/reject=] |p| with
2358-
an appropriate error (e.g. an "{{UnknownError}}" {{DOMException}})
2359-
and terminate these steps.
2360-
2361-
1. Let |result| be a new [=/list=].
2361+
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.
23622362

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

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

49654965
<div algorithm>
49664966

4967-
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:
4967+
To <dfn>open a database</dfn> with [=/storage proxy map=] |map|, a database |name|, a database |version|, and a |request|, run these steps:
49684968

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

49714971
1. Add |request| to |queue|.
49724972

49734973
1. Wait until all previous requests in |queue| have been processed.
49744974

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

49784977
1. If |version| is undefined, let |version| be 1 if |db| is null, or
49794978
|db|'s [=database/version=] otherwise.
49804979

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

@@ -5089,18 +5088,17 @@ optional |forced flag|, run these steps:
50895088

50905089
<div algorithm>
50915090

5092-
To <dfn>delete a database</dfn> with the |origin| that
5093-
requested the [=database=] to be deleted, a database |name|, and a
5094-
|request|, run these steps:
5091+
To <dfn>delete a database</dfn> with [=/storage proxy map=] |map|, a database |name|, and a |request|, run these steps:
50955092

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

50985095
1. Add |request| to |queue|.
50995096

51005097
1. Wait until all previous requests in |queue| have been processed.
51015098

5102-
1. Let |db| be the [=database=] [=database/named=] |name| in
5103-
|origin|, if one exists. Otherwise, return 0 (zero).
5099+
1. If |map|\[|name|] does not [=map/exist=], then return 0 (zero).
5100+
5101+
1. Otherwise, let |db| be |map|\[|name|].
51045102

51055103
1. Let |openConnections| be the [=/set=] of all [=/connections=]
51065104
associated with |db|.
@@ -5130,7 +5128,7 @@ requested the [=database=] to be deleted, a database |name|, and a
51305128

51315129
1. Let |version| be |db|'s [=database/version=].
51325130

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

51365134
1. Return |version|.
@@ -6805,6 +6803,7 @@ For the revision history of the second edition, see [that document's Revision Hi
68056803
* 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))
68066804
* Added <a href="#accessibility">Accessibility considerations</a> section. ([Issue #327](https://github.com/w3c/IndexedDB/issues/327))
68076805
* Used [[infra]]'s list sorting definition. ([Issue #346](https://github.com/w3c/IndexedDB/issues/346))
6806+
* Defined [=database=] storage in terms of [[Storage]] primitives.
68086807

68096808
<!-- ============================================================ -->
68106809
# Acknowledgements # {#acknowledgements}

0 commit comments

Comments
 (0)