Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 60 additions & 28 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1359,7 +1359,7 @@ range=].
<div algorithm>

To <dfn>convert a value to a key range</dfn> with
|value| and optional |null disallowed flag|, run these steps:
|value|, {{IDBTransaction}} |transaction|, and optional |null disallowed flag|, run these steps:

1. If |value| is a [=/key range=], return |value|.

Expand All @@ -1368,7 +1368,7 @@ To <dfn>convert a value to a key range</dfn> with
[=unbounded key range=] otherwise.

1. Let |key| be the result of [=/converting
a value to a key=] with |value|. Rethrow any exceptions.
a value to a key=] with |value| and optionally passing |transaction|. Rethrow any exceptions.

1. If |key| is "invalid value" or "invalid type", [=exception/throw=] a "{{DataError}}" {{DOMException}}.

Expand All @@ -1385,11 +1385,12 @@ NOTE:

<div algorithm>

To determine when a value <dfn>is a potentially valid key range</dfn> with ECMAScript |value|, run these steps:
To determine when a value <dfn>is a potentially valid key range</dfn> with ECMAScript |value| and
{{IDBTransaction}} |transaction|, run these steps:

1. If |value| is a [=/key range=], return true.

1. Let |key| be the result of [=/converting a value to a key=] with |value|.
1. Let |key| be the result of [=/converting a value to a key=] with |value| and |transaction|.

1. If |key| is "invalid type" return false.

Expand Down Expand Up @@ -3010,8 +3011,7 @@ To <dfn>add or put</dfn> with |handle|, |value|, |key|, and |no-overwrite flag|,

1. If |key| was given, then:

1. Let |r| be the result of [=/converting a
value to a key=] with |key|. Rethrow any exceptions.
1. Let |r| be the result of [=/converting a value to a key=] with |key| and |transaction|. Rethrow any exceptions.

1. If |r| is "invalid value" or "invalid type", [=exception/throw=] a "{{DataError}}" {{DOMException}}.

Expand Down Expand Up @@ -3074,7 +3074,7 @@ The <dfn method for=IDBObjectStore>delete(|query|)</dfn> method steps are:
1. If |transaction| is a [=transaction/read-only transaction=],
[=exception/throw=] a "{{ReadOnlyError}}" {{DOMException}}.

1. Let |range| be the result of [=/converting a value to a key range=] with |query| and true. Rethrow any exceptions.
1. Let |range| be the result of [=/converting a value to a key range=] with |query|, |transaction|, and true. Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=delete records from an object store=] with |store| and |range|.

Expand Down Expand Up @@ -3189,7 +3189,7 @@ The <dfn method for=IDBObjectStore>get(|query|)</dfn> method steps are:
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=],
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of [=/converting a value to a key range=] with |query| and true. Rethrow any exceptions.
1. Let |range| be the result of [=/converting a value to a key range=] with |query|, |transaction|, and true. Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=retrieve a value from an object store=] with [=ECMAScript/the current Realm record=], |store|, and |range|.

Expand Down Expand Up @@ -3226,7 +3226,7 @@ The <dfn method for=IDBObjectStore>getKey(|query|)</dfn> method steps are:
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=],
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of [=/converting a value to a key range=] with |query| and true. Rethrow any exceptions.
1. Let |range| be the result of [=/converting a value to a key range=] with |query|, |transaction|, and true. Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=retrieve a key from an object store=] with |store| and |range|.

Expand Down Expand Up @@ -3307,7 +3307,7 @@ The <dfn method for=IDBObjectStore>count(|query|)</dfn> method steps are:
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of
[=/converting a value to a key range=] with |query|.
[=/converting a value to a key range=] with |query| and |transaction|.
Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=count the records in a range=] with |store| and |range|.
Expand Down Expand Up @@ -3365,7 +3365,7 @@ The <dfn method for=IDBObjectStore>openCursor(|query|, |direction|)</dfn> method
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of
[=/converting a value to a key range=] with |query|.
[=/converting a value to a key range=] with |query| and |transaction|.
Rethrow any exceptions.

1. Let |cursor| be a new [=cursor=] with its
Expand Down Expand Up @@ -3408,7 +3408,7 @@ The <dfn method for=IDBObjectStore>openKeyCursor(|query|, |direction|)</dfn> met
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of
[=/converting a value to a key range=] with |query|.
[=/converting a value to a key range=] with |query| and |transaction|.
Rethrow any exceptions.

1. Let |cursor| be a new [=cursor=] with its
Expand Down Expand Up @@ -3841,7 +3841,7 @@ The <dfn method for=IDBIndex>get(|query|)</dfn> method steps are:
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=],
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of [=/converting a value to a key range=] with |query| and true. Rethrow any exceptions.
1. Let |range| be the result of [=/converting a value to a key range=] with |query|, |transaction|, and true. Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=retrieve a referenced value from an index=] with [=ECMAScript/the current Realm record=], |index|, and |range|.

Expand Down Expand Up @@ -3878,7 +3878,7 @@ The <dfn method for=IDBIndex>getKey(|query|)</dfn> method steps are:
1. If |transaction|'s [=transaction/state=] is not [=transaction/active=],
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of [=/converting a value to a key range=] with |query| and true. Rethrow any exceptions.
1. Let |range| be the result of [=/converting a value to a key range=] with |query|, |transaction|, and true. Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=retrieve a value from an index=] with |index| and |range|.

Expand Down Expand Up @@ -3959,7 +3959,7 @@ The <dfn method for=IDBIndex>count(|query|)</dfn> method steps are:
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of
[=/converting a value to a key range=] with |query|.
[=/converting a value to a key range=] with |query| and |transaction|.
Rethrow any exceptions.

1. Let |operation| be an algorithm to run [=count the records in a range=] with |index| and |range|.
Expand Down Expand Up @@ -4017,7 +4017,7 @@ The <dfn method for=IDBIndex>openCursor(|query|, |direction|)</dfn> method steps
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of
[=/converting a value to a key range=] with |query|.
[=/converting a value to a key range=] with |query| and |transaction|.
Rethrow any exceptions.

1. Let |cursor| be a new [=cursor=] with its
Expand Down Expand Up @@ -4060,7 +4060,7 @@ The <dfn method for=IDBIndex>openKeyCursor(|query|, |direction|)</dfn> method st
then [=exception/throw=] a "{{TransactionInactiveError}}" {{DOMException}}.

1. Let |range| be the result of
[=/converting a value to a key range=] with |query|.
[=/converting a value to a key range=] with |query| and |transaction|.
Rethrow any exceptions.

1. Let |cursor| be a new [=cursor=] with its
Expand Down Expand Up @@ -4511,7 +4511,7 @@ The <dfn method for=IDBCursor>continue(|key|)</dfn> method steps are:
1. If |key| is given, then:

1. Let |r| be the result of [=/converting a
value to a key=] with |key|. Rethrow any exceptions.
value to a key=] with |key| and |transaction|. Rethrow any exceptions.

1. If |r| is "invalid value" or "invalid type", [=exception/throw=] a "{{DataError}}" {{DOMException}}.

Expand Down Expand Up @@ -4570,14 +4570,14 @@ The <dfn method for=IDBCursor>continuePrimaryKey(|key|, |primaryKey|)</dfn> meth
[=exception/throw=] an "{{InvalidStateError}}" {{DOMException}}.

1. Let |r| be the result of [=/converting a value to
a key=] with |key|. Rethrow any exceptions.
a key=] with |key| and |transaction|. Rethrow any exceptions.

1. If |r| is "invalid value" or "invalid type", [=exception/throw=] a "{{DataError}}" {{DOMException}}.

1. Let |key| be |r|.

1. Let |r| be the result of [=/converting a value
to a key=] with |primaryKey|. Rethrow any exceptions.
to a key=] with |primaryKey| and |transaction|. Rethrow any exceptions.

1. If |r| is "invalid value" or "invalid type", [=exception/throw=] a "{{DataError}}" {{DOMException}}.

Expand Down Expand Up @@ -5631,15 +5631,15 @@ To <dfn>create a [=request=] to retrieve multiple items</dfn> from an [=object s

1. Let |direction| be a [=cursor/direction|cursor direction=].

1. If running [=is a potentially valid key range=] with |queryOrOptions| is true, then:
1. If running [=is a potentially valid key range=] with |queryOrOptions| and |transaction| is true, then:

1. Set |range| to the result of [=/converting a value to a key range=] with |queryOrOptions|. Rethrow any exceptions.
1. Set |range| to the result of [=/converting a value to a key range=] with |queryOrOptions| and |transaction|. Rethrow any exceptions.

1. Set |direction| to "{{IDBCursorDirection/next}}".

1. Else:

1. Set |range| to the result of [=/converting a value to a key range=] with |queryOrOptions|["{{IDBGetAllOptions/query}}"]. Rethrow any exceptions.
1. Set |range| to the result of [=/converting a value to a key range=] with |queryOrOptions|["{{IDBGetAllOptions/query}}"] and |transaction|. Rethrow any exceptions.

1. Set |count| to |queryOrOptions|["{{IDBGetAllOptions/count}}"].

Expand Down Expand Up @@ -6481,8 +6481,8 @@ The steps return an ECMAScript value.

<div algorithm>

To <dfn>convert a value to a key</dfn> with an ECMAScript value |input|, and an optional
[=/set=] |seen|, run the following steps.
To <dfn lt="recursively convert a value to a key|recursively converting a value to a key">recursively convert a value to a key</dfn>
with an ECMAScript value |input|, and an optional [=/set=] |seen|, run the following steps.
The result of these steps is a [=/key=], or "invalid value", or "invalid type", or the
steps may throw an exception.

Expand Down Expand Up @@ -6549,7 +6549,7 @@ steps may throw an exception.
1. Let |entry| be [=ECMAScript/?=] [$Get$](|input|, |index|).

1. Let |key| be the result of
[=/converting a value to a key=] with arguments |entry|
[=/recursively converting a value to a key=] with arguments |entry|
and |seen|.

1. [=ECMAScript/ReturnIfAbrupt=](|key|).
Expand Down Expand Up @@ -6607,20 +6607,52 @@ The result of these steps is a [=/key=], or "invalid value", or "invalid type",

1. Return a new [=array key=] with [=key/value=] set to |keys|.

1. Otherwise, return the result of [=/converting a
1. Otherwise, return the result of [=/recursively converting a
value to a key=] with argument |input|.
Rethrow any exceptions.

</div>

NOTE:
These steps are similar to those to [=convert a value to a key=]
These steps are similar to those to [=recursively convert a value to a key=]
but if the top-level value is an {{Array}} then members which can
not be converted to keys are ignored, and duplicates are removed.

For example, the value `[10, 20, null, 30, 20]` is
converted to an [=array key=] with [=subkeys=] 10, 20, 30.

<div algorithm>

To <dfn>convert a value to a key</dfn> with an ECMAScript value |input| and optional {{IDBTransaction}}
|transaction|, run the following steps. The result of these steps is a [=/key=], or "invalid value", or "invalid type",
or the steps may throw an exception.

1. If |transaction| is given:

1. [=/Assert=]: |transaction|'s [=transaction/state=] is [=transaction/active=].

1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].

NOTE:
The [=/transaction=] is made [=transaction/inactive=] so that getters or other side effects triggered by the cloning operation are unable to make additional requests against the transaction.

1. Let |thrown| be null.

1. Let |result| be null.

1. [=Try=] the following step:

1. Let |result| be the result of [=/recursively converting a value to a key=] with |input|.

1. If the above step threw, set |thrown| to the thrown error.

1. If |transaction| is given, set |transaction|'s [=transaction/state=] to [=transaction/active=].

1. If |thrown| is not null, rethrow |thrown|.

1. Return |result|.

</div>

<!-- ============================================================ -->
# Privacy considerations # {#privacy}
Expand Down