From eadb3af5367412399af0654704f52f5675d73a85 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Wed, 10 Jul 2019 13:36:23 -0700 Subject: [PATCH] Use better markdown for domintro sections --- index.bs | 1696 ++++++++++++++++++++++++------------------------------ 1 file changed, 748 insertions(+), 948 deletions(-) diff --git a/index.bs b/index.bs index fc3780c..9001f89 100644 --- a/index.bs +++ b/index.bs @@ -393,12 +393,12 @@ sorted in ascending order by 16-bit code unit.
Details -

This matches the [=Array.prototype.sort=] on an [=Array=] of + This matches the [=Array.prototype.sort=] on an [=Array=] of [=Strings=]. This ordering compares the 16-bit code units in each string, producing a highly efficient, consistent, and deterministic sort order. The resulting list will not match any particular alphabet or lexicographical order, particularly for code points - represented by a surrogate pair.

+ represented by a surrogate pair.
@@ -667,42 +667,39 @@ To compare two keys |a| and |b|, run these steps: 1. Switch on |ta|:
-
*number*
-
*date*
-
- 1. If |va| is greater than |vb|, then return 1. - 1. If |va| is less than |vb|, then return -1. - 1. Return 0. -
- -
*string*
-
- 1. If |va| is [=code unit less than=] |vb|, then return -1. - 1. If |vb| is [=code unit less than=] |va|, then return 1. - 1. Return 0. -
- -
*binary*
-
- 1. If |va| is [=byte less than=] |vb|, then return -1. - 1. If |vb| is [=byte less than=] |va|, then return 1. - 1. Return 0. -
- -
*array*
-
- 1. Let |length| be the lesser of |va|'s [=list/size=] and |vb|'s [=list/size=]. - 1. Let |i| be 0. - 1. While |i| is less than |length|, then: - - 1. Let |c| be the result of recursively running [=compare two keys=] with |va|[|i|] and |vb|[|i|]. - 1. If |c| is not 0, return |c|. - 1. Increase |i| by 1. - - 1. If |va|'s [=list/size=] is greater than |vb|'s [=list/size=], then return 1. - 1. If |va|'s [=list/size=] is less than |vb|'s [=list/size=], then return -1. - 1. Return 0. -
+ : *number* + : *date* + :: + 1. If |va| is greater than |vb|, then return 1. + 1. If |va| is less than |vb|, then return -1. + 1. Return 0. + + : *string* + :: + 1. If |va| is [=code unit less than=] |vb|, then return -1. + 1. If |vb| is [=code unit less than=] |va|, then return 1. + 1. Return 0. + + : *binary* + :: + 1. If |va| is [=byte less than=] |vb|, then return -1. + 1. If |vb| is [=byte less than=] |va|, then return 1. + 1. Return 0. + + : *array* + :: + 1. Let |length| be the lesser of |va|'s [=list/size=] and |vb|'s [=list/size=]. + 1. Let |i| be 0. + 1. While |i| is less than |length|, then: + + 1. Let |c| be the result of recursively running [=compare two keys=] with |va|[|i|] and |vb|[|i|]. + 1. If |c| is not 0, return |c|. + 1. Increase |i| by 1. + + 1. If |va|'s [=list/size=] is greater than |vb|'s [=list/size=], then return 1. + 1. If |va|'s [=list/size=] is less than |vb|'s [=list/size=], then return -1. + 1. Return 0. +
@@ -912,19 +909,17 @@ is set when the transaction is created and remains fixed for the life of the transaction. A [=/transaction=]'s [=transaction/mode=] is one of the following: -
-
{{"readonly"}}
-
+: {{"readonly"}} +:: The transaction is only allowed to read data. No modifications can be done by this type of transaction. This has the advantage that several [=read-only transactions=] can run at the same time even if their [=transaction/scopes=] are overlapping, i.e. if they are using the same object stores. This type of transaction can be created any time once a database has been opened. -
-
{{"readwrite"}}
-
+: {{"readwrite"}} +:: The transaction is allowed to read, modify and delete data from existing object stores. However object stores and indexes can't be added or removed. Multiple {{"readwrite"}} transactions @@ -932,18 +927,15 @@ following: since that would mean that they can modify each other's data in the middle of the transaction. This type of transaction can be created any time once a database has been opened. -
-
{{"versionchange"}}
-
+: {{"versionchange"}} +:: The transaction is allowed to read, modify and delete data from existing object stores, and can also create and remove object stores and indexes. It is the only type of transaction that can do so. This type of transaction can't be manually created, but instead is created automatically when an `upgradeneeded` event is fired. -
-
A [=/transaction=] optionally has a cleanup event loop which is an [=event loop=]. @@ -970,34 +962,32 @@ is a [=/transaction=] with [=transaction/mode=] {{"readwrite"}}. A [=/transaction=] has a state, which is one of the following: -
-
active -
+: active +:: A transaction is in this state when it is first [=transaction/created=], and during dispatch of an event from a [=/request=] associated with the transaction. New [=/requests=] can be made against the transaction when it is in this state. -
inactive -
+: inactive +:: A transaction is in this state after control returns to the event loop after its creation, and when events are not being dispatched. No [=/requests=] can be made against the transaction when it is in this state. -
committing -
+: committing +:: Once all [=/requests=] associated with a transaction have completed, the transaction will enter this state as it attempts to [=commit=]. No [=/requests=] can be made against the transaction when it is in this state. -
finished -
+: finished +:: Once a transaction has committed or aborted, it enters this state. No [=/requests=] can be made against the transaction when it is in this state. -
Transactions are expected to be short lived. This is encouraged by the [=transaction/commit|automatic committing=] functionality @@ -1442,17 +1432,15 @@ the cursor initial position is at the start of its [=cursor/source=] or at its end. A cursor's [=cursor/direction=] is one of the following: -
-
{{"next"}}
-
+: {{"next"}} +:: This direction causes the cursor to be opened at the start of the [=cursor/source=]. When iterated, the [=cursor=] should yield all records, including duplicates, in monotonically increasing order of keys. -
-
{{"nextunique"}}
-
+: {{"nextunique"}} +:: This direction causes the cursor to be opened at the start of the [=cursor/source=]. When iterated, the [=cursor=] should not yield records with the same key, but otherwise yield all records, in @@ -1461,18 +1449,16 @@ the cursor initial position is at the start of its [=cursor/source=] is an [=/object store=] or an [=/index=] with its [=unique flag=] set to true, this direction has exactly the same behavior as {{"next"}}. -
-
{{"prev"}}
-
+: {{"prev"}} +:: This direction causes the cursor to be opened at the end of the [=cursor/source=]. When iterated, the [=cursor=] should yield all records, including duplicates, in monotonically decreasing order of keys. -
-
{{"prevunique"}}
-
+: {{"prevunique"}} +:: This direction causes the cursor to be opened at the end of the [=cursor/source=]. When iterated, the [=cursor=] should not yield records with the same key, but otherwise yield all records, @@ -1481,8 +1467,6 @@ the cursor initial position is at the start of its [=cursor/source=] is an [=/object store=] or an [=/index=] with its [=unique flag=] set to true, this direction has exactly the same behavior as {{"prev"}}. -
-
A [=cursor=] has a position within its range. It is possible for the list of records which the cursor is iterating over to @@ -2022,43 +2006,36 @@ enum IDBRequestReadyState { }; -
-
-
request . {{IDBRequest/result}}
-
+
+ : |request| . {{IDBRequest/result}} + :: When a request is completed, returns the [=request/result=], or `undefined` if the request failed. Throws a "{{InvalidStateError}}" {{DOMException}} if the request is still pending. -
-
request . {{IDBRequest/error}}
-
+ : |request| . {{IDBRequest/error}} + :: When a request is completed, returns the [=request/error=] (a {{DOMException}}), or null if the request succeeded. Throws a "{{InvalidStateError}}" {{DOMException}} if the request is still pending. -
-
request . {{IDBRequest/source}}
-
+ : |request| . {{IDBRequest/source}} + :: Returns the {{IDBObjectStore}}, {{IDBIndex}}, or {{IDBCursor}} the request was made against, or null if is was an [=open request=]. -
-
request . {{IDBRequest/transaction}}
-
+ : |request| . {{IDBRequest/transaction}} + :: Returns the {{IDBTransaction}} the request was made within. If this as an [=open request=], then it returns an [=/upgrade transaction=] while it is running, or null otherwise. -
-
request . {{IDBRequest/readyState}}
-
+ : |request| . {{IDBRequest/readyState}} + :: Returns {{"pending"}} until a request is complete, then returns {{"done"}}. -
-
-
+ The result attribute's getter must [=throw=] an "{{InvalidStateError}}" {{DOMException}} if the [=/request=]'s [=request/done flag=] is @@ -2204,19 +2181,18 @@ dictionary IDBDatabaseInfo { -
-
-
request = indexedDB . - {{IDBFactory/open()|open}}(name)
-
+
+ : |request| = indexedDB . + {{IDBFactory/open()|open}}(|name|) + :: Attempts to open a [=/connection=] to the named [=/database=] with the current version, or 1 if it does not already exist. If the request is successful |request|'s {{IDBRequest/result}} will be the [=/connection=]. -
-
request = indexedDB . - {{IDBFactory/open()|open}}(name, version)
-
+ + : |request| = indexedDB . + {{IDBFactory/open()|open}}(|name|, |version|) + :: Attempts to open a [=/connection=] to the named [=/database=] with the specified version. If the database already exists with a lower version and there are open [=/connections=] @@ -2227,10 +2203,10 @@ dictionary IDBDatabaseInfo { version the request will fail. If the request is successful |request|'s {{IDBRequest/result}} will be the [=/connection=]. -
-
request = indexedDB . - {{IDBFactory/deleteDatabase()|deleteDatabase}}(name)
-
+ + : |request| = indexedDB . + {{IDBFactory/deleteDatabase()|deleteDatabase}}(|name|) + :: Attempts to delete the named [=/database=]. If the database already exists and there are open [=/connections=] that don't close in response to a @@ -2238,10 +2214,9 @@ dictionary IDBDatabaseInfo { blocked until all they close. If the request is successful |request|'s {{IDBRequest/result}} will be null. -
-
result = await indexedDB . {{IDBFactory/databases()|databases}}()
-
-

+ + : |result| = await indexedDB . {{IDBFactory/databases()|databases}}() + :: Returns a promise which resolves to a list of objects giving a snapshot of the names and versions of databases within the origin. @@ -2250,9 +2225,7 @@ dictionary IDBDatabaseInfo { the result is a snapshot; there are no guarantees about the sequencing of the collection of the data or the delivery of the response with respect to requests to create, upgrade, or delete databases by this context or others. -

-
-
+
@@ -2424,20 +2397,17 @@ when invoked, must run these steps: 🚧 -
-
-
result = indexedDB . - {{IDBFactory/cmp()|cmp}}(key1, key2)
-
+
+ : |result| = indexedDB . + {{IDBFactory/cmp()|cmp}}(|key1|, |key2|) + :: Compares two values as [=/keys=]. Returns -1 if |key1| precedes |key2|, 1 if |key2| precedes |key1|, and 0 if the keys are equal. Throws a "{{DataError}}" {{DOMException}} if either input is not a valid [=/key=]. -
-
-
+
@@ -2501,18 +2471,13 @@ dictionary IDBObjectStoreParameters { }; -
-
-
connection . {{IDBDatabase/name}}
-
- Returns the [=database/name=] of the database. -
-
connection . {{IDBDatabase/version}}
-
- Returns the [=database/version=] of the database. -
-
-
+
+ : |connection| . {{IDBDatabase/name}} + :: Returns the [=database/name=] of the database. + + : |connection| . {{IDBDatabase/version}} + :: Returns the [=database/version=] of the database. +
The name attribute's getter must return the [=database/name=] of the [=connected=] @@ -2536,35 +2501,29 @@ must return this [=/connection=]'s reflect changes made with a later [=/upgrade transaction=]. -
-
- -
connection . {{IDBDatabase/objectStoreNames}}
-
+
+ : |connection| . {{IDBDatabase/objectStoreNames}} + :: Returns a list of the names of [=/object stores=] in the database. -
-
store = connection . - {{IDBDatabase/createObjectStore()|createObjectStore}}(name - [, options])
-
+ : |store| = |connection| . + {{IDBDatabase/createObjectStore()|createObjectStore}}(|name| + [, |options|]) + :: Creates a new [=/object store=] with the given |name| and |options| and returns a new {{IDBObjectStore}}. Throws a "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade transaction=]. -
-
connection . - {{IDBDatabase/deleteObjectStore()|deleteObjectStore}}(name)
-
+ : |connection| . + {{IDBDatabase/deleteObjectStore()|deleteObjectStore}}(|name|) + :: Deletes the [=/object store=] with the given |name|. Throws a "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade transaction=]. -
-
-
+ The objectStoreNames attribute's getter must return a {{DOMStringList}} associated with a [=sorted name list=] of the [=object-store/names=] of @@ -2688,26 +2647,22 @@ This method synchronously modifies the instance on which it was called. -
-
-
transaction = connection . - {{IDBDatabase/transaction()|transaction}}(scope - [, mode = "readonly"])
-
+
+ : |transaction| = |connection| . + {{IDBDatabase/transaction()|transaction}}(|scope| + [, |mode| = "readonly"]) + :: Returns a new [=/transaction=] with the given |mode| ({{"readonly"}} or {{"readwrite"}}) and |scope| which can be a single [=/object store=] [=object-store/name=] or an array of [=object-store/names=]. -
-
connection . {{IDBDatabase/close()|close}}()
-
+ : |connection| . {{IDBDatabase/close()|close}}() + :: Closes the [=/connection=] once all running [=/transactions=] have finished. -
-
-
+
@@ -2821,38 +2776,34 @@ dictionary IDBIndexParameters { }; - -
-
-
store . {{IDBObjectStore/name}}
-
+
+ : |store| . {{IDBObjectStore/name}} + :: Returns the [=object-store/name=] of the store. -
-
store . {{IDBObjectStore/name}} = newName
-
+ + : |store| . {{IDBObjectStore/name}} = |newName| + :: Updates the [=object-store/name=] of the store to |newName|. Throws "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade transaction=]. -
-
store . {{IDBObjectStore/keyPath}}
-
+ + : |store| . {{IDBObjectStore/keyPath}} + :: Returns the [=object-store/key path=] of the store, or null if none. -
-
list . {{IDBObjectStore/indexNames}}
-
+ + : |list| . {{IDBObjectStore/indexNames}} + :: Returns a list of the names of indexes in the store. -
-
store . {{IDBObjectStore/transaction}}
-
+ + : |store| . {{IDBObjectStore/transaction}} + :: Returns the associated [=/transaction=]. -
-
store . {{IDBObjectStore/autoIncrement}}
-
+ + : |store| . {{IDBObjectStore/autoIncrement}} + :: Returns true if the store has a [=key generator=], and false otherwise. -
-
-
+ The name attribute's getter @@ -2956,52 +2907,42 @@ and false otherwise. called when the [=/transaction=] is not [=transaction/active=].
-
- request = store - . {{IDBObjectStore/put()|put}}(value [, key]) -
-
- request = store - . {{IDBObjectStore/add()|add}}(value [, key]) -
-
- Adds or updates a [=object-store/record=] in |store| with the given |value| - and |key|. - - If the store uses [=in-line keys=] and |key| is specified a - "{{DataError}}" {{DOMException}} will be thrown. - - If {{IDBObjectStore/put()}} is used, any existing [=object-store/record=] - with the [=/key=] will be replaced. If {{IDBObjectStore/add()}} - is used, and if a [=object-store/record=] with the [=/key=] already exists - the |request| will fail, with |request|'s {{IDBRequest/error}} - set to a "{{ConstraintError}}" {{DOMException}}. - - If successful, |request|'s {{IDBRequest/result}} will be the - [=object-store/record=]'s [=/key=]. -
- -
- request = store . - {{IDBObjectStore/delete()|delete}}(query) -
-
- Deletes [=object-store/records=] in |store| with the given - [=/key=] or in the given [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will - be `undefined`. -
- -
- request = store . {{IDBObjectStore/clear()|clear}}() -
-
- Deletes all [=object-store/records=] in |store|. - - If successful, |request|'s {{IDBRequest/result}} will - be `undefined`. -
+ : |request| = |store| + . {{IDBObjectStore/put()|put}}(|value| [, |key|]) + + : |request| = |store| + . {{IDBObjectStore/add()|add}}(|value| [, |key|]) + :: + Adds or updates a [=object-store/record=] in |store| with the given |value| + and |key|. + + If the store uses [=in-line keys=] and |key| is specified a + "{{DataError}}" {{DOMException}} will be thrown. + + If {{IDBObjectStore/put()}} is used, any existing [=object-store/record=] + with the [=/key=] will be replaced. If {{IDBObjectStore/add()}} + is used, and if a [=object-store/record=] with the [=/key=] already exists + the |request| will fail, with |request|'s {{IDBRequest/error}} + set to a "{{ConstraintError}}" {{DOMException}}. + + If successful, |request|'s {{IDBRequest/result}} will be the + [=object-store/record=]'s [=/key=]. + + : |request| = |store| . + {{IDBObjectStore/delete()|delete}}(|query|) + :: + Deletes [=object-store/records=] in |store| with the given + [=/key=] or in the given [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will + be `undefined`. + + : |request| = |store| . {{IDBObjectStore/clear()|clear}}() + :: + Deletes all [=object-store/records=] in |store|. + + If successful, |request|'s {{IDBRequest/result}} will + be `undefined`.
@@ -3132,7 +3073,7 @@ deleted. @@ -3169,67 +3110,52 @@ must run these steps: when the [=/transaction=] is not [=transaction/active=].
-
- request = store . - {{IDBObjectStore/get()|get}}(query) -
-
- Retrieves the [=/value=] of the first [=object-store/record=] matching the - given [=/key=] or [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will be the - [=/value=], or `undefined` if there was no matching - [=object-store/record=]. -
- -
- request = store . - {{IDBObjectStore/getKey()|getKey}}(query) -
-
- Retrieves the [=/key=] of the first [=object-store/record=] matching the - given [=/key=] or [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will be the - [=/key=], or `undefined` if there was no matching - [=object-store/record=]. -
- -
- request = store . - {{IDBObjectStore/getAll()|getAll}}(query [, count]) -
-
- Retrieves the [=/values=] of the [=object-store/records=] matching the - given [=/key=] or [=key range=] in |query| (up to |count| if given). - - If successful, |request|'s {{IDBRequest/result}} will - be an [=Array=] of the [=/values=]. -
- -
- request = store . - {{IDBObjectStore/getAllKeys()|getAllKeys}}(query [, - count]) -
-
- Retrieves the [=/keys=] of [=object-store/records=] matching the - given [=/key=] or [=key range=] in |query| (up to |count| if given). - - If successful, |request|'s {{IDBRequest/result}} will - be an [=Array=] of the [=/keys=]. -
- -
- request = store . - {{IDBObjectStore/count()|count}}(query) -
-
- Retrieves the number of [=object-store/records=] matching the - given [=/key=] or [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will be the count. -
+ : |request| = |store| . + {{IDBObjectStore/get()|get}}(|query|) + :: + Retrieves the [=/value=] of the first [=object-store/record=] matching the + given [=/key=] or [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will be the + [=/value=], or `undefined` if there was no matching + [=object-store/record=]. + + : |request| = |store| . + {{IDBObjectStore/getKey()|getKey}}(|query|) + :: + Retrieves the [=/key=] of the first [=object-store/record=] matching the + given [=/key=] or [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will be the + [=/key=], or `undefined` if there was no matching + [=object-store/record=]. + + : |request| = |store| . + {{IDBObjectStore/getAll()|getAll}}(|query| [, |count|]) + :: + Retrieves the [=/values=] of the [=object-store/records=] matching the + given [=/key=] or [=key range=] in |query| (up to |count| if given). + + If successful, |request|'s {{IDBRequest/result}} will + be an [=Array=] of the [=/values=]. + + : |request| = |store| . + {{IDBObjectStore/getAllKeys()|getAllKeys}}(|query| [, + |count|]) + :: + Retrieves the [=/keys=] of [=object-store/records=] matching the + given [=/key=] or [=key range=] in |query| (up to |count| if given). + + If successful, |request|'s {{IDBRequest/result}} will + be an [=Array=] of the [=/keys=]. + + : |request| = |store| . + {{IDBObjectStore/count()|count}}(|query|) + :: + Retrieves the number of [=object-store/records=] matching the + given [=/key=] or [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will be the count.
@@ -3424,35 +3350,29 @@ given, an [=unbounded key range=] is used. when the [=/transaction=] is not [=transaction/active=].
-
- request = store . - {{IDBObjectStore/openCursor()|openCursor}}([query - [, direction = "next"]]) -
-
- Opens a [=cursor=] over the [=object-store/records=] matching |query|, - ordered by |direction|. If |query| is null, all [=object-store/records=] in - |store| are matched. - - If successful, |request|'s {{IDBRequest/result}} will be an - {{IDBCursorWithValue}} pointing at the first matching - [=object-store/record=], or null if there were no matching [=object-store/records=]. -
- -
- request = store . - {{IDBObjectStore/openKeyCursor()|openKeyCursor}}([query - [, direction = "next"]]) -
-
- Opens a [=cursor=] with [=cursor/key only flag=] set to true over the - [=object-store/records=] matching |query|, ordered by |direction|. If - |query| is null, all [=object-store/records=] in |store| are matched. - - If successful, |request|'s {{IDBRequest/result}} will be an - {{IDBCursor}} pointing at the first matching [=object-store/record=], or - null if there were no matching [=object-store/records=]. -
+ : |request| = |store| . + {{IDBObjectStore/openCursor()|openCursor}}([|query| + [, |direction| = "next"]]) + :: + Opens a [=cursor=] over the [=object-store/records=] matching |query|, + ordered by |direction|. If |query| is null, all [=object-store/records=] in + |store| are matched. + + If successful, |request|'s {{IDBRequest/result}} will be an + {{IDBCursorWithValue}} pointing at the first matching + [=object-store/record=], or null if there were no matching [=object-store/records=]. + + : |request| = |store| . + {{IDBObjectStore/openKeyCursor()|openKeyCursor}}([|query| + [, |direction| = "next"]]) + :: + Opens a [=cursor=] with [=cursor/key only flag=] set to true over the + [=object-store/records=] matching |query|, ordered by |direction|. If + |query| is null, all [=object-store/records=] in |store| are matched. + + If successful, |request|'s {{IDBRequest/result}} will be an + {{IDBCursor}} pointing at the first matching [=object-store/record=], or + null if there were no matching [=object-store/records=].
@@ -3551,44 +3471,32 @@ The |query| parameter may be a [=/key=] or an {{IDBKeyRange}} to use as the [=cursor=]'s [=cursor/range=]. If null or not given, an [=unbounded key range=] is used. -
-
-
- index = store . index(name) -
-
- Returns an {{IDBIndex}} for the [=/index=] named |name| in |store|. -
- -
- index = store . - {{IDBObjectStore/createIndex()|createIndex}}(name, - keyPath [, options]) -
-
- Creates a new [=/index=] in |store| with the given |name|, - |keyPath| and |options| and returns a new {{IDBIndex}}. If the - |keyPath| and |options| define constraints that cannot be - satisfied with the data already in |store| the [=/upgrade - transaction=] will [=transaction/abort=] with - a "{{ConstraintError}}" {{DOMException}}. - - Throws an "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade - transaction=]. -
- -
- store . {{IDBObjectStore/deleteIndex()|deleteIndex}}(name) -
-
- Deletes the [=/index=] in |store| with the given |name|. - - Throws an "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade - transaction=]. -
+
+ : |index| = |store| . index(|name|) + :: + Returns an {{IDBIndex}} for the [=/index=] named |name| in |store|. + + : |index| = |store| . + {{IDBObjectStore/createIndex()|createIndex}}(|name|, + |keyPath| [, |options|]) + :: + Creates a new [=/index=] in |store| with the given |name|, + |keyPath| and |options| and returns a new {{IDBIndex}}. If the + |keyPath| and |options| define constraints that cannot be + satisfied with the data already in |store| the [=/upgrade + transaction=] will [=transaction/abort=] with + a "{{ConstraintError}}" {{DOMException}}. + + Throws an "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade + transaction=]. -
-
+ : |store| . {{IDBObjectStore/deleteIndex()|deleteIndex}}(|name|) + :: + Deletes the [=/index=] in |store| with the given |name|. + + Throws an "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade + transaction=]. +
@@ -3810,37 +3718,28 @@ interface IDBIndex { }; -
-
-
index . {{IDBIndex/name}}
-
- Returns the [=index/name=] of the index. -
-
index . {{IDBIndex/name}} = newName
-
- Updates the [=index/name=] of the store to |newName|. - - Throws an "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade - transaction=]. -
-
index . {{IDBIndex/objectStore}}
-
- Returns the {{IDBObjectStore}} the index belongs to. -
-
index . keyPath
-
- Returns the [=/key path=] of the index. -
-
index . multiEntry
-
- Returns true if the index's [=index/multiEntry flag=] is true. -
-
index . unique
-
- Returns true if the index's [=index/unique flag=] is true. -
-
-
+
+ : |index| . {{IDBIndex/name}} + :: Returns the [=index/name=] of the index. + + : |index| . {{IDBIndex/name}} = |newName| + :: Updates the [=index/name=] of the store to |newName|. + + Throws an "{{InvalidStateError}}" {{DOMException}} if not called within an [=/upgrade + transaction=]. + + : |index| . {{IDBIndex/objectStore}} + :: Returns the {{IDBObjectStore}} the index belongs to. + + : |index| . keyPath + :: Returns the [=/key path=] of the index. + + : |index| . multiEntry + :: Returns true if the index's [=index/multiEntry flag=] is true. + + : |index| . unique + :: Returns true if the index's [=index/unique flag=] is true. +
The name attribute's getter must return this [=index handle=]'s [=index/name=]. @@ -3924,68 +3823,53 @@ return this [=index handle=]'s when the [=/transaction=] is not [=transaction/active=].
-
- request = store . - {{IDBIndex/get()|get}}(query) -
-
- Retrieves the [=/value=] of the first [=object-store/record=] matching the - given [=/key=] or [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will be the - [=/value=], or `undefined` if there was no matching - [=object-store/record=]. -
- -
- request = store . - {{IDBIndex/getKey()|getKey}}(query) -
-
- Retrieves the [=/key=] of the first [=object-store/record=] matching the - given [=/key=] or [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will be the - [=/key=], or `undefined` if there was no matching - [=object-store/record=]. -
- -
- request = store . - {{IDBIndex/getAll()|getAll}}(query [, count]) -
-
- Retrieves the [=/values=] of the [=object-store/records=] matching the given - [=/key=] or [=key range=] in |query| (up to |count| if given). - - If successful, |request|'s {{IDBRequest/result}} will be an - [=Array=] of the [=/values=]. -
- -
- request = store . - {{IDBIndex/getAllKeys()|getAllKeys}}(query [, - count]) -
-
- Retrieves the [=/keys=] of [=object-store/records=] matching the given - [=/key=] or [=key range=] in |query| (up to |count| if given). - - If successful, |request|'s {{IDBRequest/result}} will be an - [=Array=] of the [=/keys=]. -
- -
- request = store . - {{IDBIndex/count()|count}}(query) -
-
- Retrieves the number of [=object-store/records=] matching the given [=/key=] - or [=key range=] in |query|. - - If successful, |request|'s {{IDBRequest/result}} will be the - count. -
+ : |request| = |store| . + {{IDBIndex/get()|get}}(|query|) + :: + Retrieves the [=/value=] of the first [=object-store/record=] matching the + given [=/key=] or [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will be the + [=/value=], or `undefined` if there was no matching + [=object-store/record=]. + + : |request| = |store| . + {{IDBIndex/getKey()|getKey}}(|query|) + :: + Retrieves the [=/key=] of the first [=object-store/record=] matching the + given [=/key=] or [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will be the + [=/key=], or `undefined` if there was no matching + [=object-store/record=]. + + : |request| = |store| . + {{IDBIndex/getAll()|getAll}}(|query| [, |count|]) + :: + Retrieves the [=/values=] of the [=object-store/records=] matching the given + [=/key=] or [=key range=] in |query| (up to |count| if given). + + If successful, |request|'s {{IDBRequest/result}} will be an + [=Array=] of the [=/values=]. + + : |request| = |store| . + {{IDBIndex/getAllKeys()|getAllKeys}}(|query| [, + |count|]) + :: + Retrieves the [=/keys=] of [=object-store/records=] matching the given + [=/key=] or [=key range=] in |query| (up to |count| if given). + + If successful, |request|'s {{IDBRequest/result}} will be an + [=Array=] of the [=/keys=]. + + : |request| = |store| . + {{IDBIndex/count()|count}}(|query|) + :: + Retrieves the number of [=object-store/records=] matching the given [=/key=] + or [=key range=] in |query|. + + If successful, |request|'s {{IDBRequest/result}} will be the + count.
@@ -4181,34 +4065,28 @@ given, an [=unbounded key range=] is used. when the [=/transaction=] is not [=transaction/active=].
-
- request = store . - {{IDBIndex/openCursor()|openCursor}}([query - [, direction = "next"]]) -
-
- Opens a [=cursor=] over the [=object-store/records=] matching |query|, - ordered by |direction|. If |query| is null, all [=object-store/records=] in - |index| are matched. - - If successful, |request|'s {{IDBRequest/result}} will be an - {{IDBCursorWithValue}}, or null if there were no matching - [=object-store/records=]. -
- -
- request = store . - {{IDBIndex/openKeyCursor()|openKeyCursor}}([query - [, direction = "next"]]) -
-
- Opens a [=cursor=] with [=cursor/key only flag=] set to true over the - [=object-store/records=] matching |query|, ordered by |direction|. If - |query| is null, all [=object-store/records=] in |index| are matched. - - If successful, |request|'s {{IDBRequest/result}} will be an - {{IDBCursor}}, or null if there were no matching [=object-store/records=]. -
+ : |request| = |store| . + {{IDBIndex/openCursor()|openCursor}}([|query| + [, |direction| = "next"]]) + :: + Opens a [=cursor=] over the [=object-store/records=] matching |query|, + ordered by |direction|. If |query| is null, all [=object-store/records=] in + |index| are matched. + + If successful, |request|'s {{IDBRequest/result}} will be an + {{IDBCursorWithValue}}, or null if there were no matching + [=object-store/records=]. + + : |request| = |store| . + {{IDBIndex/openKeyCursor()|openKeyCursor}}([|query| + [, |direction| = "next"]]) + :: + Opens a [=cursor=] with [=cursor/key only flag=] set to true over the + [=object-store/records=] matching |query|, ordered by |direction|. If + |query| is null, all [=object-store/records=] in |index| are matched. + + If successful, |request|'s {{IDBRequest/result}} will be an + {{IDBCursor}}, or null if there were no matching [=object-store/records=].
@@ -4338,27 +4216,19 @@ interface IDBKeyRange { Note: When mapping the `_includes` identifier from [[WEBIDL]] to ECMAScript, the leading U+005F LOW LINE ("_") character is removed. A leading "_" is used to escape the identifier from looking like a reserved word (in this case, the `includes` keyword). -
-
-
range . {{IDBKeyRange/lower}}
-
- Returns the range's [=lower bound=], or `undefined` if none. -
-
range . {{IDBKeyRange/upper}}
-
- Returns the range's [=upper bound=], or `undefined` if none. -
- -
range . {{IDBKeyRange/lowerOpen}}
-
- Returns the range's [=lower open flag=]. -
-
range . {{IDBKeyRange/upperOpen}}
-
- Returns the range's [=upper open flag=]. -
-
-
+
+ : |range| . {{IDBKeyRange/lower}} + :: Returns the range's [=lower bound=], or `undefined` if none. + + : |range| . {{IDBKeyRange/upper}} + :: Returns the range's [=upper bound=], or `undefined` if none. + + : |range| . {{IDBKeyRange/lowerOpen}} + :: Returns the range's [=lower open flag=]. + + : |range| . {{IDBKeyRange/upperOpen}} + :: Returns the range's [=upper open flag=]. +
The lower attribute's getter must return result of running [=convert a key to a value=] @@ -4375,37 +4245,34 @@ must return the [=/range=]'s [=lower open flag=]. The upperOpen attribute's getter must return the [=/range=]'s [=upper open flag=]. -
-
-
range = {{IDBKeyRange}} . - {{IDBKeyRange/only()|only}}(key)
-
- Returns a new {{IDBKeyRange}} spanning only |key|. -
-
range = {{IDBKeyRange}} . - {{IDBKeyRange/lowerBound()|lowerBound}}(key [, open = false])
-
- Returns a new {{IDBKeyRange}} starting at |key| with no - upper bound. If |open| is true, |key| is not included in the - range. -
-
range = {{IDBKeyRange}} . - {{IDBKeyRange/upperBound()|upperBound}}(key [, open = false])
-
- Returns a new {{IDBKeyRange}} with no lower bound and ending at - |key|. If |open| is true, |key| is not included in the range. -
-
range = {{IDBKeyRange}} . - {{IDBKeyRange/bound()|bound}}(lower, upper - [, lowerOpen = false - [, upperOpen = false]])
-
- Returns a new {{IDBKeyRange}} spanning from |lower| to |upper|. - If |lowerOpen| is true, |lower| is not included in the range. - If |upperOpen| is true, |upper| is not included in the range. -
-
-
+
+ : |range| = {{IDBKeyRange}} . + {{IDBKeyRange/only()|only}}(|key|) + :: + Returns a new {{IDBKeyRange}} spanning only |key|. + + : |range| = {{IDBKeyRange}} . + {{IDBKeyRange/lowerBound()|lowerBound}}(|key| [, |open| = false]) + :: + Returns a new {{IDBKeyRange}} starting at |key| with no + upper bound. If |open| is true, |key| is not included in the + range. + + : |range| = {{IDBKeyRange}} . + {{IDBKeyRange/upperBound()|upperBound}}(|key| [, |open| = false]) + :: + Returns a new {{IDBKeyRange}} with no lower bound and ending at + |key|. If |open| is true, |key| is not included in the range. + + : |range| = {{IDBKeyRange}} . + {{IDBKeyRange/bound()|bound}}(|lower|, |upper| + [, |lowerOpen| = false + [, |upperOpen| = false]]) + :: + Returns a new {{IDBKeyRange}} spanning from |lower| to |upper|. + If |lowerOpen| is true, |lower| is not included in the range. + If |upperOpen| is true, |upper| is not included in the range. +
@@ -4480,15 +4347,11 @@ The bound(|lower|, |upper|, |lowerOpen|,
-
-
-
range . - {{IDBKeyRange/includes()|includes}}(key)
-
- Returns true if |key| is included in the range, and false otherwise. -
-
-
+
+ : |range| . + {{IDBKeyRange/includes()|includes}}(|key|) + :: Returns true if |key| is included in the range, and false otherwise. +
@@ -4541,35 +4404,31 @@ enum IDBCursorDirection { }; - -
-
-
cursor . {{IDBCursor/source}}
-
- Returns the {{IDBObjectStore}} or {{IDBIndex}} the cursor was opened from. -
-
range . {{IDBCursor/direction}}
-
- Returns the [=cursor/direction=] - ({{"next"}}, {{"nextunique"}}, {{"prev"}} or {{"prevunique"}}) - of the cursor. -
-
cursor . {{IDBCursor/key}} -
- Returns the [=cursor/key=] of the cursor. - Throws a "{{InvalidStateError}}" {{DOMException}} if the cursor is advancing or is finished. -
-
cursor . {{IDBCursor/primaryKey}} -
- Returns the [=cursor/effective key=] of the cursor. - Throws a "{{InvalidStateError}}" {{DOMException}} if the cursor is advancing or is finished. -
-
cursor . {{IDBCursor/request}} -
- Returns the [=cursor/request=] that was used to obtain this cursor. -
-
-
+
+ : |cursor| . {{IDBCursor/source}} + :: + Returns the {{IDBObjectStore}} or {{IDBIndex}} the cursor was opened from. + + : |range| . {{IDBCursor/direction}} + :: + Returns the [=cursor/direction=] + ({{"next"}}, {{"nextunique"}}, {{"prev"}} or {{"prevunique"}}) + of the cursor. + + : |cursor| . {{IDBCursor/key}} + :: + Returns the [=cursor/key=] of the cursor. + Throws a "{{InvalidStateError}}" {{DOMException}} if the cursor is advancing or is finished. + + : |cursor| . {{IDBCursor/primaryKey}} + :: + Returns the [=cursor/effective key=] of the cursor. + Throws a "{{InvalidStateError}}" {{DOMException}} if the cursor is advancing or is finished. + + : |cursor| . {{IDBCursor/request}} + :: + Returns the [=cursor/request=] that was used to obtain this cursor. +
The source attribute's getter must @@ -4624,31 +4483,27 @@ return the [=cursor/request=] of the [=cursor=]. when the [=/transaction=] is not [=transaction/active=].
-
cursor . {{IDBCursor/advance()|advance}}(count)
-
- Advances the cursor through the next |count| [=object-store/records=] in - range. -
- -
cursor . {{IDBCursor/continue()|continue}}()
-
- Advances the cursor to the next [=object-store/record=] in range. -
- -
cursor . {{IDBCursor/continue()|continue}}(key)
-
- Advances the cursor to the next [=object-store/record=] in range matching or - after |key|. -
- -
cursor . - {{IDBCursor/continuePrimaryKey()|continuePrimaryKey}}(key, - primaryKey)
-
- Advances the cursor to the next [=object-store/record=] in range matching - or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}} - if the [=cursor/source=] is not an [=/index=]. -
+ : |cursor| . {{IDBCursor/advance()|advance}}(|count|) + :: + Advances the cursor through the next |count| [=object-store/records=] in + range. + + : |cursor| . {{IDBCursor/continue()|continue}}() + :: + Advances the cursor to the next [=object-store/record=] in range. + + : |cursor| . {{IDBCursor/continue()|continue}}(|key|) + :: + Advances the cursor to the next [=object-store/record=] in range matching or + after |key|. + + : |cursor| . + {{IDBCursor/continuePrimaryKey()|continuePrimaryKey}}(|key|, + |primaryKey|) + :: + Advances the cursor to the next [=object-store/record=] in range matching + or after |key| and |primaryKey|. Throws an "{{InvalidAccessError}}" {{DOMException}} + if the [=cursor/source=] is not an [=/index=].
@@ -4848,26 +4703,25 @@ The continuePrimaryKey(|key|, called when the [=/transaction=] is not [=transaction/active=].
-
request = cursor . - {{IDBCursor/update()|update}}(value)
-
- Updated the [=object-store/record=] pointed at by the cursor with a new value. - - Throws a "{{DataError}}" {{DOMException}} if the [=cursor/effective object store=] - uses [=in-line keys=] and the [=/key=] would have changed. - - If successful, |request|'s {{IDBRequest/result}} will be the - [=object-store/record=]'s [=/key=]. -
- -
request = cursor . - {{IDBCursor/delete()|delete}}()
-
- Delete the [=object-store/record=] pointed at by the cursor with a new value. - - If successful, |request|'s {{IDBRequest/result}} will be - `undefined`. -
+ : |request| = |cursor| . + {{IDBCursor/update()|update}}(|value|) + :: + Updated the [=object-store/record=] pointed at by the cursor with a new value. + + Throws a "{{DataError}}" {{DOMException}} if the [=cursor/effective object store=] + uses [=in-line keys=] and the [=/key=] would have changed. + + If successful, |request|'s {{IDBRequest/result}} will be the + [=object-store/record=]'s [=/key=]. + + + : |request| = |cursor| . + {{IDBCursor/delete()|delete}}() + :: + Delete the [=object-store/record=] pointed at by the cursor with a new value. + + If successful, |request|'s {{IDBRequest/result}} will be + `undefined`.
@@ -4982,14 +4836,10 @@ interface IDBCursorWithValue : IDBCursor { }; -
-
-
cursor . {{IDBCursorWithValue/value}}
-
- Returns the [=cursor=]'s current [=cursor/value=]. -
-
-
+
+ : |cursor| . {{IDBCursorWithValue/value}} + :: Returns the [=cursor=]'s current [=cursor/value=]. +
The value attribute's @@ -5033,31 +4883,28 @@ enum IDBTransactionMode { }; -
-
-
transaction . {{IDBTransaction/objectStoreNames}}
-
- Returns a list of the names of [=/object stores=] in the - transaction's [=transaction/scope=]. For an [=/upgrade transaction=] - this is all object stores in the [=database=]. -
-
transaction . {{IDBTransaction/mode}}
-
- Returns the [=transaction/mode=] the transaction was created with - ({{"readonly"}} or {{"readwrite"}}), or {{"versionchange"}} for - an [=/upgrade transaction=]. -
-
transaction . {{IDBTransaction/db}}
-
- Returns the transaction's [=transaction/connection=]. -
-
transaction . {{IDBTransaction/error}}
-
- If the transaction was [=transaction/aborted=], returns the - error (a {{DOMException}}) providing the reason. -
-
-
+
+ : |transaction| . {{IDBTransaction/objectStoreNames}} + :: + Returns a list of the names of [=/object stores=] in the + transaction's [=transaction/scope=]. For an [=/upgrade transaction=] + this is all object stores in the [=database=]. + + : |transaction| . {{IDBTransaction/mode}} + :: + Returns the [=transaction/mode=] the transaction was created with + ({{"readonly"}} or {{"readwrite"}}), or {{"versionchange"}} for + an [=/upgrade transaction=]. + + : |transaction| . {{IDBTransaction/db}} + :: + Returns the transaction's [=transaction/connection=]. + + : |transaction| . {{IDBTransaction/error}} + :: + If the transaction was [=transaction/aborted=], returns the + error (a {{DOMException}}) providing the reason. +
@@ -5106,37 +4953,32 @@ none. "{{UnknownError}}" {{DOMException}}). -
-
-
transaction . - {{IDBTransaction/objectStore()|objectStore}}(name)
-
- Returns an {{IDBObjectStore}} in the [=/transaction=]'s [=transaction/scope=]. -
- -
transaction . {{IDBTransaction/abort()}}
-
- Aborts the transaction. All pending [=/requests=] will fail with - a "{{AbortError}}" {{DOMException}} and all changes made to the database will be - reverted. -
- -
transaction . {{IDBTransaction/commit()}}
-
- Attempts to commit the transaction. All pending [=/requests=] will be allowed - to complete, but no new requests will be accepted. This can be used to force a - transaction to quickly finish, without waiting for pending requests to fire - `success` events before attempting to commit normally. - - The transaction will abort if a pending request fails, for example due to a - constraint error. The `success` events for successful requests - will still fire, but throwing an exception in an event handler will not abort - the transaction. Similarly, `error` events for failed requests - will still fire, but calling `preventDefault()` will not prevent the - transaction from aborting. -
-
-
+
+ : |transaction| . + {{IDBTransaction/objectStore()|objectStore}}(|name|) + :: + Returns an {{IDBObjectStore}} in the [=/transaction=]'s [=transaction/scope=]. + + : |transaction| . {{IDBTransaction/abort()}} + :: + Aborts the transaction. All pending [=/requests=] will fail with + a "{{AbortError}}" {{DOMException}} and all changes made to the database will be + reverted. + + : |transaction| . {{IDBTransaction/commit()}} + :: + Attempts to commit the transaction. All pending [=/requests=] will be allowed + to complete, but no new requests will be accepted. This can be used to force a + transaction to quickly finish, without waiting for pending requests to fire + `success` events before attempting to commit normally. + + The transaction will abort if a pending request fails, for example due to a + constraint error. The `success` events for successful requests + will still fire, but throwing an exception in an event handler will not abort + the transaction. Similarly, `error` events for failed requests + will still fire, but calling `preventDefault()` will not prevent the + transaction from aborting. +
@@ -6259,101 +6101,94 @@ To iterate a cursor with |targetRealm|, |cursor|, an optional 1. Switch on |direction|:
-
{{"next"}}
-
- Let |found record| be the first record in |records| which - satisfy all of the following requirements: - - * If |key| is defined, the record's key is [=greater - than=] or [=equal to=] |key|. + : {{"next"}} + :: + Let |found record| be the first record in |records| which + satisfy all of the following requirements: - * If |primaryKey| is defined, the record's key is [=equal - to=] |key| and the record's value is [=greater - than=] or [=equal to=] |primaryKey|, or the - record's key is [=greater than=] |key|. + * If |key| is defined, the record's key is [=greater + than=] or [=equal to=] |key|. - * If |position| is defined, and |source| is an - [=/object store=], the record's key is [=greater than=] - |position|. + * If |primaryKey| is defined, the record's key is [=equal + to=] |key| and the record's value is [=greater + than=] or [=equal to=] |primaryKey|, or the + record's key is [=greater than=] |key|. - * If |position| is defined, and |source| is an - [=/index=], the record's key is [=equal to=] - |position| and the record's value is [=greater - than=] |object store position| or the record's key is - [=greater than=] |position|. + * If |position| is defined, and |source| is an + [=/object store=], the record's key is [=greater than=] + |position|. - * The record's key is [=in=] - |range|. + * If |position| is defined, and |source| is an + [=/index=], the record's key is [=equal to=] + |position| and the record's value is [=greater + than=] |object store position| or the record's key is + [=greater than=] |position|. -
+ * The record's key is [=in=] + |range|. -
{{"nextunique"}}
-
- Let |found record| be the first record in |records| which - satisfy all of the following requirements: + : {{"nextunique"}} + :: + Let |found record| be the first record in |records| which + satisfy all of the following requirements: - * If |key| is defined, the record's key is [=greater - than=] or [=equal to=] |key|. + * If |key| is defined, the record's key is [=greater + than=] or [=equal to=] |key|. - * If |position| is defined, the record's key is [=greater - than=] |position|. + * If |position| is defined, the record's key is [=greater + than=] |position|. - * The record's key is [=in=] - |range|. + * The record's key is [=in=] + |range|. -
+ : {{"prev"}} + :: + Let |found record| be the last record in |records| which + satisfy all of the following requirements: -
{{"prev"}}
-
- Let |found record| be the last record in |records| which - satisfy all of the following requirements: + * If |key| is defined, the record's key is [=less + than=] or [=equal to=] |key|. - * If |key| is defined, the record's key is [=less - than=] or [=equal to=] |key|. + * If |primaryKey| is defined, the record's key is [=equal + to=] |key| and the record's value is [=less than=] + or [=equal to=] |primaryKey|, or the record's key is + [=less than=] |key|. - * If |primaryKey| is defined, the record's key is [=equal - to=] |key| and the record's value is [=less than=] - or [=equal to=] |primaryKey|, or the record's key is - [=less than=] |key|. + * If |position| is defined, and |source| is an + [=/object store=], the record's key is [=less + than=] |position|. - * If |position| is defined, and |source| is an - [=/object store=], the record's key is [=less - than=] |position|. + * If |position| is defined, and |source| is an + [=/index=], the record's key is [=equal to=] + |position| and the record's value is [=less than=] + |object store position| or the record's key is + [=less than=] |position|. - * If |position| is defined, and |source| is an - [=/index=], the record's key is [=equal to=] - |position| and the record's value is [=less than=] - |object store position| or the record's key is - [=less than=] |position|. + * The record's key is [=in=] |range|. - * The record's key is [=in=] |range|. + : {{"prevunique"}} + :: + Let |temp record| be the last record in + |records| which satisfy all of the following requirements: -
+ * If |key| is defined, the record's key is [=less + than=] or [=equal to=] |key|. -
{{"prevunique"}}
-
- Let |temp record| be the last record in - |records| which satisfy all of the following requirements: + * If |position| is defined, the record's key is [=less + than=] |position|. - * If |key| is defined, the record's key is [=less - than=] or [=equal to=] |key|. + * The record's key is [=in=] + |range|. - * If |position| is defined, the record's key is [=less - than=] |position|. + If |temp record| is defined, let |found record| be the + first record in |records| whose [=/key=] is [=equal to=] + |temp record|'s [=/key=]. - * The record's key is [=in=] - |range|. - - If |temp record| is defined, let |found record| be the - first record in |records| whose [=/key=] is [=equal to=] - |temp record|'s [=/key=]. - - + -
1. If |found record| is not defined, then: @@ -6485,41 +6320,39 @@ ECMAScript value or failure, or the steps may throw an exception. 1. [=list/For each=] |identifier| of |identifiers|, jump to the appropriate step below:
-
If [=/Type=](|value|) is String, and |identifier| is "`length`"
-
Let |value| be a Number equal to the number of elements in |value|.
+ : If [=/Type=](|value|) is String, and |identifier| is "`length`" + :: Let |value| be a Number equal to the number of elements in |value|. -
If |value| is an [=Array=] and |identifier| is "`length`"
+ : If |value| is an [=Array=] and |identifier| is "`length`" + :: Let |value| be [=!=] [=ToLength=]([=!=] [=Get=](|value|, "`length`")). -
Let |value| be [=!=] [=ToLength=]([=!=] [=Get=](|value|, "`length`")).
+ : If |value| is a {{Blob}} and |identifier| is "`size`" + :: Let |value| be a Number equal to |value|'s {{Blob/size}}. -
If |value| is a {{Blob}} and |identifier| is "`size`"
-
Let |value| be a Number equal to |value|'s {{Blob/size}}.
+ : If |value| is a {{Blob}} and |identifier| is "`type`" + :: Let |value| be a String equal to |value|'s {{Blob/type}}. -
If |value| is a {{Blob}} and |identifier| is "`type`"
-
Let |value| be a String equal to |value|'s {{Blob/type}}.
+ : If |value| is a {{File}} and |identifier| is "`name`" + :: Let |value| be a String equal to |value|'s {{File/name}}. -
If |value| is a {{File}} and |identifier| is "`name`"
-
Let |value| be a String equal to |value|'s {{File/name}}.
+ : If |value| is a {{File}} and |identifier| is "`lastModified`" + :: Let |value| be a Number equal to |value|'s {{File/lastModified}}. -
If |value| is a {{File}} and |identifier| is "`lastModified`"
-
Let |value| be a Number equal to |value|'s {{File/lastModified}}.
+ : If |value| is a {{File}} and |identifier| is "`lastModifiedDate`" + :: Let |value| be a new [=Date=] object with \[[DateValue]] internal slot + equal to |value|'s {{File/lastModified}}. -
If |value| is a {{File}} and |identifier| is "`lastModifiedDate`"
-
Let |value| be a new [=Date=] object with \[[DateValue]] internal slot - equal to |value|'s {{File/lastModified}}.
+ : Otherwise + :: + 1. If [=/Type=](|value|) is not Object, return failure. -
Otherwise
-
- 1. If [=/Type=](|value|) is not Object, return failure. + 1. Let |hop| be [=!=] [=HasOwnProperty=](|value|, |identifier|). - 1. Let |hop| be [=!=] [=HasOwnProperty=](|value|, |identifier|). + 1. If |hop| is false, return failure. - 1. If |hop| is false, return failure. + 1. Let |value| be [=!=] [=Get=](|value|, |identifier|). - 1. Let |value| be [=!=] [=Get=](|value|, |identifier|). - - 1. If |value| is undefined, return failure. -
+ 1. If |value| is undefined, return failure.
@@ -6645,53 +6478,48 @@ The steps return an ECMAScript value. 1. Switch on |type|:
-
*number*
-
Return an ECMAScript Number value equal to |value|
- -
*string*
-
Return an ECMAScript String value equal to |value|
- -
*date*
-
- 1. Let |date| be the result of executing the ECMAScript Date - constructor with the single argument |value|. - 1. [=/Assert=]: |date| is not an [=abrupt completion=]. - 1. Return |date|. - -
- -
*binary*
-
- 1. Let |len| be |value|'s [=byte sequence/length=]. - 1. Let |buffer| be the result of executing the ECMAScript - ArrayBuffer constructor with |len|. - 1. [=/Assert=]: |buffer| is not an [=abrupt completion=]. - 1. Set the entries in |buffer|'s - \[[ArrayBufferData]] internal slot to the entries - in |value|. - 1. Return |buffer|. - -
- -
*array*
-
- 1. Let |array| be the result of executing the ECMAScript Array - constructor with no arguments. - 1. [=/Assert=]: |array| is not an [=abrupt completion=]. - 1. Let |len| be |value|'s [=list/size=]. - 1. Let |index| be 0. - 1. While |index| is less than |len|: - - 1. Let |entry| be the result of running - [=convert a key to a value=] with |value|[|index|]. - 1. Let |status| be [=CreateDataProperty=](|array|, |index|, - |entry|). - 1. [=/Assert=]: |status| is true. - 1. Increase |index| by 1. - - 1. Return |array|. - -
+ : *number* + :: Return an ECMAScript Number value equal to |value| + + : *string* + :: Return an ECMAScript String value equal to |value| + + : *date* + :: + 1. Let |date| be the result of executing the ECMAScript Date + constructor with the single argument |value|. + 1. [=/Assert=]: |date| is not an [=abrupt completion=]. + 1. Return |date|. + + : *binary* + :: + 1. Let |len| be |value|'s [=byte sequence/length=]. + 1. Let |buffer| be the result of executing the ECMAScript + ArrayBuffer constructor with |len|. + 1. [=/Assert=]: |buffer| is not an [=abrupt completion=]. + 1. Set the entries in |buffer|'s + \[[ArrayBufferData]] internal slot to the entries + in |value|. + 1. Return |buffer|. + + : *array* + :: + 1. Let |array| be the result of executing the ECMAScript Array + constructor with no arguments. + 1. [=/Assert=]: |array| is not an [=abrupt completion=]. + 1. Let |len| be |value|'s [=list/size=]. + 1. Let |index| be 0. + 1. While |index| is less than |len|: + + 1. Let |entry| be the result of running + [=convert a key to a value=] with |value|[|index|]. + 1. Let |status| be [=CreateDataProperty=](|array|, |index|, + |entry|). + 1. [=/Assert=]: |status| is true. + 1. Increase |index| by 1. + + 1. Return |array|. +
@@ -6717,88 +6545,77 @@ steps may throw an exception.
-
If [=/Type=](|input|) is Number
-
- 1. If |input| is NaN then return invalid. - 1. Otherwise, return a new [=/key=] with - [=key/type=] *number* and [=key/value=] - |input|. - -
+ : If [=/Type=](|input|) is Number + :: + 1. If |input| is NaN then return invalid. + 1. Otherwise, return a new [=/key=] with + [=key/type=] *number* and [=key/value=] + |input|. -
If |input| is a [=Date=] (has a \[[DateValue]] internal slot)
-
- 1. Let |ms| be the value of |input|'s - \[[DateValue]] internal slot. + : If |input| is a [=Date=] (has a \[[DateValue]] internal slot) + :: + 1. Let |ms| be the value of |input|'s + \[[DateValue]] internal slot. - 1. If |ms| is NaN then return invalid. + 1. If |ms| is NaN then return invalid. - 1. Otherwise, return a new [=/key=] with [=key/type=] - *date* and [=key/value=] |ms|. - -
+ 1. Otherwise, return a new [=/key=] with [=key/type=] + *date* and [=key/value=] |ms|. -
If [=/Type=](|input|) is String
-
- - 1. Return a new [=/key=] with [=key/type=] *string* and - [=key/value=] |input|. + : If [=/Type=](|input|) is String + :: + 1. Return a new [=/key=] with [=key/type=] *string* and + [=key/value=] |input|. -
-
- If |input| is a [=buffer source type=]
-
+ : If |input| is a [=buffer source type=] + :: + 1. Let |bytes| be the result of running + get a copy of the bytes held by the buffer source + |input|. Rethrow any exceptions. - 1. Let |bytes| be the result of running - get a copy of the bytes held by the buffer source - |input|. Rethrow any exceptions. - - 1. Return a new [=/key=] with [=key/type=] - *binary* and [=key/value=] |bytes|. - -
+ 1. Return a new [=/key=] with [=key/type=] + *binary* and [=key/value=] |bytes|. -
If [=IsArray=](|input|)
-
+ : If [=IsArray=](|input|) + :: + 1. Let |len| be [=?=] [=ToLength=]( [=?=] [=Get=](|input|, + "`length`")). + 1. [=set/Append=] |input| to |seen|. + 1. Let |keys| be a new empty list. + 1. Let |index| be 0. + 1. While |index| is less than |len|: - 1. Let |len| be [=?=] [=ToLength=]( [=?=] [=Get=](|input|, - "`length`")). - 1. [=set/Append=] |input| to |seen|. - 1. Let |keys| be a new empty list. - 1. Let |index| be 0. - 1. While |index| is less than |len|: + 1. Let |hop| be [=?=] [=HasOwnProperty=](|input|, |index|). - 1. Let |hop| be [=?=] [=HasOwnProperty=](|input|, |index|). + 1. If |hop| is false, return invalid. - 1. If |hop| is false, return invalid. + 1. Let |entry| be [=?=] [=Get=](|input|, |index|). - 1. Let |entry| be [=?=] [=Get=](|input|, |index|). + 1. Let |key| be the result of running + [=convert a value to a key=] with arguments |entry| + and |seen|. - 1. Let |key| be the result of running - [=convert a value to a key=] with arguments |entry| - and |seen|. + 1. [=ReturnIfAbrupt=](|key|). - 1. [=ReturnIfAbrupt=](|key|). + 1. If |key| is invalid abort these steps and return + invalid. - 1. If |key| is invalid abort these steps and return - invalid. + 1. [=list/Append=] |key| to |keys|. - 1. [=list/Append=] |key| to |keys|. + 1. Increase |index| by 1. - 1. Increase |index| by 1. + 1. Return a new [=array key=] with [=key/value=] + |keys|. - 1. Return a new [=array key=] with [=key/value=] - |keys|. -
+ : Otherwise + :: Return invalid. -
Otherwise
-
Return invalid.
@@ -6875,74 +6692,57 @@ There are a number of techniques that can be used to mitigate the risk of user tracking: -
-
Blocking third-party storage
-
-User agents may restrict access to the database objects -to scripts originating at the domain of the top-level document of -the browsing context, for instance denying access to -the API for pages from other domains running in `iframe`s. -
- -
Expiring stored data
-
- -User agents may automatically delete stored data after a period of -time. - -This can restrict the ability of a site to track a user, as the site -would then only be able to track the user across multiple sessions -when she authenticates with the site itself (e.g. by making a purchase -or logging in to a service). - -However, this also puts the user's data at risk. -
- -
Treating persistent storage as cookies
-
- -User agents should present the database feature to the user in a way -that associates them strongly with HTTP session cookies. [[COOKIES]] - -This might encourage users to view such storage with healthy -suspicion. - -
- -
Site-specific safe-listing of access to databases
-
- -User agents may require the user to authorize access to databases -before a site can use the feature. - -
- -
Origin-tracking of stored data
-
- -User agents may record the [=/origins=] of sites that contained content -from third-party origins that caused data to be stored. - -If this information is then used to present the view of data -currently in persistent storage, it would allow the user to make -informed decisions about which parts of the persistent storage to -prune. Combined with a blocklist ("delete this data and prevent -this domain from ever storing data again"), the user can restrict -the use of persistent storage to sites that she trusts. - -
- -
Shared blocklists
-
- -User agents may allow users to share their persistent storage -domain blocklists. - -This would allow communities to act together to protect their -privacy. - -
-
+: Blocking third-party storage +:: + User agents may restrict access to the database objects + to scripts originating at the domain of the top-level document of + the browsing context, for instance denying access to + the API for pages from other domains running in `iframe`s. + +: Expiring stored data +:: + User agents may automatically delete stored data after a period of + time. + + This can restrict the ability of a site to track a user, as the site + would then only be able to track the user across multiple sessions + when she authenticates with the site itself (e.g. by making a purchase + or logging in to a service). + + However, this also puts the user's data at risk. + +: Treating persistent storage as cookies +:: + User agents should present the database feature to the user in a way + that associates them strongly with HTTP session cookies. [[COOKIES]] + + This might encourage users to view such storage with healthy + suspicion. + +: Site-specific safe-listing of access to databases +:: + User agents may require the user to authorize access to databases + before a site can use the feature. + +: Origin-tracking of stored data +:: + User agents may record the [=/origins=] of sites that contained content + from third-party origins that caused data to be stored. + + If this information is then used to present the view of data + currently in persistent storage, it would allow the user to make + informed decisions about which parts of the persistent storage to + prune. Combined with a blocklist ("delete this data and prevent + this domain from ever storing data again"), the user can restrict + the use of persistent storage to sites that she trusts. + +: Shared blocklists +:: + User agents may allow users to share their persistent storage + domain blocklists. + + This would allow communities to act together to protect their + privacy. While these suggestions prevent trivial use of this API for user tracking, they do not block it altogether. Within a single domain, a