From 65c73fb880bcc40ad6ed881c6cc1f75c1b147f7d Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Fri, 5 May 2017 13:50:33 -0700 Subject: [PATCH 1/3] Editorial: Remove use of 'substeps', simplify wording, add 'in parallel' links --- index.bs | 260 ++++++++++++++++++++++++++--------------------------- index.html | 181 ++++++++++++++++++------------------- 2 files changed, 213 insertions(+), 228 deletions(-) diff --git a/index.bs b/index.bs index 1f58729..5f46373 100644 --- a/index.bs +++ b/index.bs @@ -697,7 +697,7 @@ To compare two keys |a| and |b|, run these steps:
1. Let |length| be the lesser of |va|'s length and |vb|'s length. 2. Let |i| be 0. - 3. While |i| is less than |length|, run these substeps: + 3. While |i| is less than |length|, then: 1. Let |u| be the code unit of |va| at index |i|. 2. Let |v| be the code unit of |vb| at index |i|. 3. If |u| is greater than |v| then return 1. @@ -712,7 +712,7 @@ To compare two keys |a| and |b|, run these steps:
1. Let |length| be the lesser of |va|'s length and |vb|'s length. 2. Let |i| be 0. - 3. While |i| is less than |length|, run these substeps: + 3. While |i| is less than |length|, then: 1. Let |u| be the {{octet}} in |va| at index |i|. 2. Let |v| be the {{octet}} in |vb| at index |i|. @@ -729,7 +729,7 @@ To compare two keys |a| and |b|, run these steps:
1. Let |length| be the lesser of |va|'s length and |vb|'s length. 2. Let |i| be 0. - 3. While |i| is less than |length|, run these substeps: + 3. While |i| is less than |length|, then: 1. Let |u| be the [=/key=] in |va| at index |i|. 2. Let |v| be the [=/key=] in |vb| at index |i|. @@ -1170,7 +1170,7 @@ The following constraints define when a [=/transaction=] can be To cleanup Indexed Database transactions, -run the following steps for each [=/transaction=] +run these steps for each [=/transaction=] with [=transaction/cleanup event loop=] matching the current [=event loop=]. @@ -1565,7 +1565,7 @@ in the call to store the record, a key is generated.
- To generate a key for an [=/object store=] |store|, run the following steps: + To generate a key for an [=/object store=] |store|, run these steps: 1. Let |generator| be the [=key generator=] associated with |store|. @@ -1586,7 +1586,7 @@ be updated.
To possibly update the key generator for an [=/object store=] |store| with |key|, - run the following steps: + run these steps: 1. If the [=key/type=] of |key| is not number, abort these steps. @@ -2133,7 +2133,7 @@ events, in [[!DOM]].
To fire a version change event named |e| at |target| given - |oldVersion| and |newVersion|, run the following steps: + |oldVersion| and |newVersion|, run these steps: 1. Let |event| be the result of [=creating an event=] using {{IDBVersionChangeEvent}}. @@ -2235,57 +2235,56 @@ when invoked, must run these steps: 4. Let |request| be a new [=open request=]. -5. Run the following substeps in parallel: +5. Return a new {{IDBOpenDBRequest}} object for |request|, + but continue these steps [=in parallel=]. - 1. Let |result| be the result of running the steps to - [=open a database=], with |origin|, - |name|, |version| if given and undefined - otherwise, and |request|. +6. Let |result| be the result of running the steps to + [=open a database=], with |origin|, + |name|, |version| if given and undefined + otherwise, and |request|. -
- What happens if |version| is not given? - If |version| is not given and a [=database=] - with that name already exists, a connection will be opened - without changing the [=database/version=]. If - |version| is not given and no [=database=] with - that name exists, a new [=database=] will be created with - [=database/version=] equal to 1. -
+
+ What happens if |version| is not given? + If |version| is not given and a [=database=] + with that name already exists, a connection will be opened + without changing the [=database/version=]. If + |version| is not given and no [=database=] with + that name exists, a new [=database=] will be created with + [=database/version=] equal to 1. +
- 2. [=Queue a task=] to run these substeps: +7. [=Queue a task=] to run these steps: - 1. If |result| is an error, set the [=request/error=] - of |request| to |result| and [=fire an event=] named - error at |request| with its - {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. + 1. If |result| is an error, set the [=request/error=] + of |request| to |result| and [=fire an event=] named + error at |request| with its + {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. - 2. Otherwise, set the [=request/result=] of |request| - to |result| and [=fire an event=] named - success at |request|. If the steps - above resulted in an [=upgrade transaction=] being run, - then firing the "success" event must be done - after the [=upgrade transaction=] completes. + 2. Otherwise, set the [=request/result=] of |request| + to |result| and [=fire an event=] named + success at |request|. If the steps + above resulted in an [=upgrade transaction=] being run, + then firing the "success" event must be done + after the [=upgrade transaction=] completes. - - -
- - Why aren't the steps to [=fire a success event=] or - [=fire an error event=] used? - - There is no transaction associated with the request (at - this point), so those steps — which activate an - associated transaction before dispatch and deactivate - the transaction after dispatch — do not apply. -
+ -6. Return a new {{IDBOpenDBRequest}} object for |request|. +
+ + Why aren't the steps to [=fire a success event=] or + [=fire an error event=] used? + + There is no transaction associated with the request (at + this point), so those steps — which activate an + associated transaction before dispatch and deactivate + the transaction after dispatch — do not apply. +
@@ -2302,40 +2301,39 @@ when invoked, must run these steps: 3. Let |request| be a new [=open request=]. -4. Run the following substeps in parallel: - - 1. Let |result| be the result of running the steps to - [=delete a database=], with |origin|, - |name|, and |request|. - - 2. [=Queue a task=] to run these substeps: - 1. If |result| is an error set the [=request/error=] of - |request| to |result| and [=fire an event=] - named error at |request| with - its {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. - - 2. Otherwise, set the [=request/result=] of |request| - to undefined and [=fire a version change event=] named - success at [=request=] with |result| and - null. - -
- - Why aren't the steps to [=fire a success event=] or - [=fire an error event=] used? - - There is no transaction associated with the request, so - those steps — which activate an associated - transaction before dispatch and deactivate the - transaction after dispatch — do not apply. - - Also, the success event here is a - {{IDBVersionChangeEvent}} which includes the - {{IDBVersionChangeEvent/oldVersion}} and - {{IDBVersionChangeEvent/newVersion}} details. -
- -5. Return a new {{IDBOpenDBRequest}} object for |request|. +4. Return a new {{IDBOpenDBRequest}} object for |request|, + but continue these steps [=in parallel=]. + +5. Let |result| be the result of running the steps to + [=delete a database=], with |origin|, + |name|, and |request|. + +6. [=Queue a task=] to run these steps: + 1. If |result| is an error set the [=request/error=] of + |request| to |result| and [=fire an event=] + named error at |request| with + its {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. + + 2. Otherwise, set the [=request/result=] of |request| + to undefined and [=fire a version change event=] named + success at [=request=] with |result| and + null. + +
+ + Why aren't the steps to [=fire a success event=] or + [=fire an error event=] used? + + There is no transaction associated with the request, so + those steps — which activate an associated + transaction before dispatch and deactivate the + transaction after dispatch — do not apply. + + Also, the success event here is a + {{IDBVersionChangeEvent}} which includes the + {{IDBVersionChangeEvent/oldVersion}} and + {{IDBVersionChangeEvent/newVersion}} details. +
@@ -2964,7 +2962,7 @@ when invoked, must run these steps: generator=] and |key| was not given, [=throw=] a "{{DataError}}" {{DOMException}}. -8. If |key| was given, run these substeps: +8. If |key| was given, then: 1. Let |r| be the result of running the steps to [=convert a value to a key=] with |key|. Rethrow any exceptions. @@ -2986,7 +2984,7 @@ when invoked, must run these steps: if the difference in behavior is not observable. -11. If |store| uses [=in-line keys=], run these substeps: +11. If |store| uses [=in-line keys=], then: 1. Let |kpk| be the result of running the steps to [=extract a key from a value using a key path=] with |clone| and @@ -2997,7 +2995,7 @@ when invoked, must run these steps: 3. If |kpk| is not failure, let |key| be |kpk|. - 4. Otherwise (|kpk| is failure), run these substeps: + 4. Otherwise (|kpk| is failure): 1. If |store| does not have a [=key generator=], [=throw=] a "{{DataError}}" {{DOMException}}. @@ -3043,7 +3041,7 @@ when invoked, must run these steps: generator=] and |key| was not given, [=throw=] a "{{DataError}}" {{DOMException}}. -8. If |key| was given, run these substeps: +8. If |key| was given, then: 1. Let |r| be the result of running the steps to [=convert a value to a key=] with |key|. Rethrow any exceptions. @@ -3065,7 +3063,7 @@ when invoked, must run these steps: if the difference in behavior is not observable. -11. If |store| uses [=in-line keys=], run these substeps: +11. If |store| uses [=in-line keys=], then: 1. Let |kpk| be the result of running the steps to [=extract a key from a value using a key path=] with |clone| and @@ -3077,7 +3075,7 @@ when invoked, must run these steps: 3. If |kpk| is not failure, let |key| be |kpk|. - 4. Otherwise (|kpk| is failure), run these substeps: + 4. Otherwise (|kpk| is failure): 1. If |store| does not have a [=key generator=], [=throw=] a "{{DataError}}" {{DOMException}}. @@ -4741,7 +4739,7 @@ invoked, must run these steps: the cursor is being iterated or has iterated past its end, [=throw=] an "{{InvalidStateError}}" {{DOMException}}. -5. If |key| is given, run these substeps: +5. If |key| is given, then: 1. Let |r| be the result of running the steps to [=convert a value to a key=] with |key|. Rethrow any exceptions. @@ -4938,7 +4936,7 @@ invoked, must run these steps: 9. If the [=effective object store=] of this cursor uses [=in-line - keys=], run these substeps: + keys=], then: 1. Let |kpk| be the result of running the steps to [=extract a key from a value using a key path=] with @@ -5091,7 +5089,7 @@ enum IDBTransactionMode {
The objectStoreNames -attribute's getter must run the following steps: +attribute's getter must run these steps: 1. If this [=/transaction=] is an [=upgrade transaction=], return a {{DOMStringList}} associated with a [=sorted name list=] of the [=object-store/names=] @@ -5259,8 +5257,7 @@ database |name|, a database |version|, and a |request|. 9. Set |connection|'s [=connection/version=] to |version|. -10. If |db|'s [=database/version=] is less than |version|, run - these substeps: +10. If |db|'s [=database/version=] is less than |version|, then: 1. Let |openConnections| be the set of all [=/connections=], except |connection|, associated with |db|. @@ -5433,7 +5430,7 @@ This algorithm takes one argument, the |transaction| to commit. appropriate for the error, for example "{{QuotaExceededError}}" or "{{UnknownError}}" {{DOMException}}. -3. [=Queue a task=] to run the these substeps +3. [=Queue a task=] to run these steps 1. [=Fire an event=] named complete at |transaction|. @@ -5484,7 +5481,7 @@ takes two arguments: the |transaction| to abort, and |error|. 4. For each |request| in |transaction|'s [=request list=] with [=request/done flag=] unset, abort the steps to [=asynchronously execute a request=] for |request| and [=queue a task=] to - run these substeps: + run these steps: 1. Set the [=request/done flag=] on |request|. 2. Set the [=request/result=] of |request| to undefined. @@ -5501,7 +5498,7 @@ takes two arguments: the |transaction| to abort, and |error|. or if it was the last remaining request that failed. -5. [=Queue a task=] to run the following substeps: +5. [=Queue a task=] to run these steps: 1. [=Fire an event=] named abort at |transaction| with its {{Event/bubbles}} attribute initialized to true. @@ -5538,8 +5535,7 @@ created [=request=] belongs to is [=transaction/aborted=] using the steps to 4. Add |request| to the end of |transaction|'s [=request list=]. -5. Return |request| and queue up the execution of the remaining steps - in this algorithm. +5. Return |request|, but continue these steps [=in parallel=]. 6. Wait until all previously added [=requests=] in |transaction| have their [=request/done flag=] set. @@ -5554,17 +5550,17 @@ created [=request=] belongs to is [=transaction/aborted=] using the steps to other changes made by the transaction. -9. [=Queue a task=] to run these substeps: +9. [=Queue a task=] to run these steps: 1. Set the [=request/done flag=] on |request|. - 2. If |result| is an error, then run these substeps: + 2. If |result| is an error, then: 1. Set the [=request/result=] of |request| to undefined. 2. Set the [=request/error=] of |request| to |result|. 3. [=Fire an error event=] at |request|. - 3. Otherwise, run these substeps: + 3. Otherwise: 1. Set the [=request/result=] of |request| to |result|. 2. Set the [=request/error=] of |request| to undefined. @@ -5607,7 +5603,7 @@ for the [=database=], and a |request|. considered part of the [=/transaction=], and so if the transaction is [=transaction/aborted=], this change is reverted. -7. [=Queue a task=] to run the following steps: +7. [=Queue a task=] to run these steps: 1. Set |request|'s [=request/result=] to |connection|. 2. Set |request|'s [=request/transaction=] to |transaction|. @@ -5674,7 +5670,7 @@ are as follows. 5. For each [=/object store handle=] |handle| associated with |transaction|, including those for [=/object stores=] that - were created or deleted during |transaction|, run these substeps: + were created or deleted during |transaction|: 1. If |handle|'s [=object-store-handle/object store=] was not newly created during |transaction|, set |handle|'s @@ -5701,7 +5697,7 @@ are as follows. 6. For each [=index handle=] |handle| associated with |transaction|, including those for [=/indexes=] that were created or deleted - during |transaction|, run these substeps: + during |transaction|: 1. If |handle|'s [=index-handle/index=] was not newly created during |transaction|, set |handle|'s [=index-handle/name=] to @@ -5737,7 +5733,7 @@ are as follows.
To fire a success event at a |request|, -the implementation must run the following steps: +the implementation must run these steps: 1. Let |event| be the result of [=creating an event=] using {{Event}}. @@ -5770,7 +5766,7 @@ the implementation must run the following steps:
To fire an error event at a |request|, -the implementation must run the following steps: +the implementation must run these steps: 1. Let |event| be the result of [=creating an event=] using {{Event}}. @@ -5815,7 +5811,7 @@ the implementation must run the following steps:
To make a clone of |value| in |targetRealm|, - the implementation must run the following steps: + the implementation must run these steps: 1. Let |serialized| be [=?=] StructuredSerializeForStorage(|value|). @@ -5852,9 +5848,9 @@ The steps to store a record into an object store with |store|, |value|, an optional |key|, and a |no-overwrite flag| are as follows. -1. If |store| uses a [=key generator=], run these substeps: +1. If |store| uses a [=key generator=], then: - 1. If |key| is undefined, run these substeps: + 1. If |key| is undefined, then: 1. Let |key| be the result of running the steps to [=generate a key=] for |store|. @@ -5886,7 +5882,7 @@ follows. [=object-store/list of records=] such that the list is sorted according to the key of the records in [=ascending=] order. -5. For each |index| which [=reference=] |store|, run these substeps: +5. For each |index| which [=reference=] |store|: 1. Let |index key| be the result of running the steps to [=extract a key from a value using a key path=] with @@ -5894,7 +5890,7 @@ follows. [=multiEntry flag=]. 2. If |index key| is an exception, or invalid, or failure, take no - further actions for this index, and continue these substeps + further actions for |index|, and continue these steps for the next index.
- 2. If |found record| is not defined, run these substeps: + 2. If |found record| is not defined, then: 1. Set |cursor|'s [=cursor/key=] to undefined. @@ -6344,7 +6340,7 @@ follows. 12. Set |cursor|'s [=cursor/key=] to |found record|'s key. -13. If |cursor|'s [=key only flag=] is unset, run these substeps: +13. If |cursor|'s [=key only flag=] is unset, then: 1. Let |serialized| be |found record|'s [=referenced value=]. 2. Set |cursor|'s [=cursor/value=] to @@ -6404,14 +6400,14 @@ The steps to evaluate a key path on a value with |value| and |keyPath| are as follows. The result of these steps is an ECMAScript value or failure, or the steps may throw an exception. -1. If |keyPath| is a list of strings, run these substeps: +1. If |keyPath| is a list of strings, then: 1. Let |result| be a new [=Array=] object created as if by the expression []. 2. Let |i| be 0. - 3. For each |item| in |keyPath|, run these substeps: + 3. For each |item| in |keyPath|: 1. Let |key| be the result of recursively running the steps to [=evaluate a key path on a value=] using @@ -6524,8 +6520,7 @@ true or false. 3. Remove the last member of |identifiers|. -4. For each remaining |identifier| in |identifiers|, if any, run these - substeps: +4. For each remaining |identifier| in |identifiers|, if any: 1. If |value| is not an [=Object=] or an [=Array=], return false. @@ -6557,14 +6552,13 @@ as follows. The algorithm takes a |value|, a |key| and a |keyPath|. 3. Let |last| be the last member of |identifiers| and remove it from the list. -4. For each remaining |identifier| in |identifiers|, run these - substeps: +4. For each remaining |identifier| in |identifiers|: 1. Assert: |value| is an [=Object=] or an [=Array=]. 2. Let |hop| be [=!=] [=HasOwnProperty=](|value|, |identifier|). - 3. If |hop| is false, run these substeps: + 3. If |hop| is false, then: 1. Let |o| be a new [=Object=] created as if by the expression ({}). @@ -6646,7 +6640,7 @@ steps take one argument, |key|, and return an ECMAScript value. 2. Assert: |array| is not an [=abrupt completion=]. 3. Let |len| be the length of |value|. 4. Let |index| be 0. - 5. While |index| is less than |len|, run these substeps: + 5. While |index| is less than |len|: 1. Let |entry| be the result of running the steps to [=convert a key to a value=] with the |index|th @@ -6738,7 +6732,7 @@ steps may throw an exception. 2. Add |input| to |seen|. 3. Let |keys| be a new empty list. 4. Let |index| be 0. - 5. While |index| is less than |len|, run these substeps: + 5. While |index| is less than |len|: 1. Let |hop| be [=?=] [=HasOwnProperty=](|input|, |index|). @@ -6778,7 +6772,7 @@ follows. These steps take one argument, an ECMAScript value |input|. The result of these steps is a [=/key=] or invalid, or the steps may throw an exception. -1. If [=IsArray=](|input|), then run these substeps: +1. If [=IsArray=](|input|), then: 1. Let |len| be [=?=] ToLength( [=?=] [=Get=](|input|, "length")). @@ -6788,11 +6782,11 @@ steps may throw an exception. 4. Let |index| be 0. - 5. While |index| is less than |len|, run these substeps: + 5. While |index| is less than |len|: 1. Let |entry| be [=Get=](|input|, |index|). - 2. If |entry| is not an [=abrupt completion=], run these substeps: + 2. If |entry| is not an [=abrupt completion=], then: 1. Let |key| be the result of running the steps to [=convert a value to a key=] with arguments diff --git a/index.html b/index.html index 4e2b27a..284a17d 100644 --- a/index.html +++ b/index.html @@ -1459,7 +1459,7 @@

Indexed Database API 2.0

-

Editor’s Draft,

+

Editor’s Draft,

This version: @@ -2077,7 +2077,7 @@

Let i be 0.

  • -

    While i is less than length, run these substeps:

    +

    While i is less than length, then:

    1. Let u be the code unit of va at index i.

      @@ -2105,7 +2105,7 @@

      Let i be 0.

    2. -

      While i is less than length, run these substeps:

      +

      While i is less than length, then:

      1. Let u be the octet in va at index i.

        @@ -2133,7 +2133,7 @@

        Let i be 0.

      2. -

        While i is less than length, run these substeps:

        +

        While i is less than length, then:

        1. Let u be the key in va at index i.

          @@ -2447,7 +2447,7 @@

  • To cleanup Indexed Database transactions, -run the following steps for each transaction with cleanup event loop matching the current event loop.

    +run these steps for each transaction with cleanup event loop matching the current event loop.

    1. @@ -2684,7 +2684,7 @@

      When a record is stored and a key is not specified in the call to store the record, a key is generated.

      -

      To generate a key for an object store store, run the following steps:

      +

      To generate a key for an object store store, run these steps:

      1. Let generator be the key generator associated with store.

        @@ -2703,7 +2703,7 @@

        To possibly update the key generator for an object store store with key, - run the following steps:

        + run these steps:

        1. If the type of key is not number, abort these steps.

          @@ -3080,7 +3080,7 @@

          4.2

          Events are constructed as defined in Constructing events, in [DOM].

          -

          To fire a version change event named e at target given oldVersion and newVersion, run the following steps:

          +

          To fire a version change event named e at target given oldVersion and newVersion, run these steps:

          1. Let event be the result of creating an event using IDBVersionChangeEvent.

            @@ -3153,42 +3153,39 @@

            Let request be a new open request.

          2. -

            Run the following substeps in parallel:

            -
              -
            1. -

              Let result be the result of running the steps to open a database, with origin, name, version if given and undefined +

              Return a new IDBOpenDBRequest object for request, +but continue these steps in parallel.

              +
            2. +

              Let result be the result of running the steps to open a database, with origin, name, version if given and undefined otherwise, and request.

              -
              - What happens if version is not given? - If version is not given and a database with that name already exists, a connection will be opened +
              + What happens if version is not given? + If version is not given and a database with that name already exists, a connection will be opened without changing the version. If version is not given and no database with that name exists, a new database will be created with version equal to 1. -
              +
              +
            3. +

              Queue a task to run these steps:

              +
              1. -

                Queue a task to run these substeps:

                -
                  -
                1. -

                  If result is an error, set the error of request to result and fire an event named error at request with its bubbles and cancelable attributes initialized to true.

                  -
                2. -

                  Otherwise, set the result of request to result and fire an event named success at request. If the steps +

                  If result is an error, set the error of request to result and fire an event named error at request with its bubbles and cancelable attributes initialized to true.

                  +
                3. +

                  Otherwise, set the result of request to result and fire an event named success at request. If the steps above resulted in an upgrade transaction being run, then firing the "success" event must be done after the upgrade transaction completes.

                  -
                +
              -
            4. -

              Return a new IDBOpenDBRequest object for request.

          @@ -3204,31 +3201,28 @@

          Let request be a new open request.

        2. -

          Run the following substeps in parallel:

          +

          Return a new IDBOpenDBRequest object for request, +but continue these steps in parallel.

          +
        3. +

          Let result be the result of running the steps to delete a database, with origin, name, and request.

          +
        4. +

          Queue a task to run these steps:

          1. -

            Let result be the result of running the steps to delete a database, with origin, name, and request.

            -
          2. -

            Queue a task to run these substeps:

            -
              -
            1. -

              If result is an error set the error of request to result and fire an event named error at request with +

              If result is an error set the error of request to result and fire an event named error at request with its bubbles and cancelable attributes initialized to true.

              -
            2. -

              Otherwise, set the result of request to undefined and fire a version change event named success at request with result and +

            3. +

              Otherwise, set the result of request to undefined and fire a version change event named success at request with result and null.

              -
              - Why aren’t the steps to fire a success event or fire an error event used? - There is no transaction associated with the request, so +
              + Why aren’t the steps to fire a success event or fire an error event used? + There is no transaction associated with the request, so those steps — which activate an associated transaction before dispatch and deactivate the transaction after dispatch — do not apply. -

              Also, the success event here is a IDBVersionChangeEvent which includes the oldVersion and newVersion details.

              -
              -
            +

            Also, the success event here is a IDBVersionChangeEvent which includes the oldVersion and newVersion details.

            +
          -
        5. -

          Return a new IDBOpenDBRequest object for request.

        @@ -3631,7 +3625,7 @@

        and key was not given, throw a "DataError" DOMException.

      2. -

        If key was given, run these substeps:

        +

        If key was given, then:

        1. Let r be the result of running the steps to convert a @@ -3654,7 +3648,7 @@

        2. -

          If store uses in-line keys, run these substeps:

          +

          If store uses in-line keys, then:

          1. Let kpk be the result of running the steps to extract a @@ -3665,7 +3659,7 @@

            If kpk is not failure, let key be kpk.

          2. -

            Otherwise (kpk is failure), run these substeps:

            +

            Otherwise (kpk is failure):

            1. If store does not have a key generator, throw a "DataError" DOMException.

              @@ -3705,7 +3699,7 @@

              and key was not given, throw a "DataError" DOMException.

            2. -

              If key was given, run these substeps:

              +

              If key was given, then:

              1. Let r be the result of running the steps to convert a @@ -3728,7 +3722,7 @@

              2. -

                If store uses in-line keys, run these substeps:

                +

                If store uses in-line keys, then:

                1. Let kpk be the result of running the steps to extract a @@ -3739,7 +3733,7 @@

                  If kpk is not failure, let key be kpk.

                2. -

                  Otherwise (kpk is failure), run these substeps:

                  +

                  Otherwise (kpk is failure):

                  1. If store does not have a key generator, throw a "DataError" DOMException.

                    @@ -4840,7 +4834,7 @@

                    got value flag is unset, indicating that the cursor is being iterated or has iterated past its end, throw an "InvalidStateError" DOMException.

                  2. -

                    If key is given, run these substeps:

                    +

                    If key is given, then:

                    1. Let r be the result of running the steps to convert a @@ -4986,7 +4980,7 @@

                      If the effective object store of this cursor uses in-line -keys, run these substeps:

                      +keys, then:

                      1. Let kpk be the result of running the steps to extract a key from a value using a key path with clone and the key @@ -5096,7 +5090,7 @@

                        -

                        The objectStoreNames attribute’s getter must run the following steps:

                        +

                        The objectStoreNames attribute’s getter must run these steps:

                        1. If this transaction is an upgrade transaction, @@ -5207,8 +5201,7 @@

                          5.
                        2. Set connection’s version to version.

                        3. -

                          If db’s version is less than version, run -these substeps:

                          +

                          If db’s version is less than version, then:

                          1. Let openConnections be the set of all connections, @@ -5324,7 +5317,7 @@

                            QuotaExceededError" or "UnknownError" DOMException.

                          2. -

                            Queue a task to run the these substeps

                            +

                            Queue a task to run these steps

                            1. Fire an event named complete at transaction.

                              @@ -5360,7 +5353,7 @@

                              For each request in transaction’s request list with done flag unset, abort the steps to asynchronously execute a request for request and queue a task to -run these substeps:

                              +run these steps:

                              1. Set the done flag on request.

                                @@ -5376,7 +5369,7 @@

                                committing the transaction, or if it was the last remaining request that failed.
                              2. -

                                Queue a task to run the following substeps:

                                +

                                Queue a task to run these steps:

                                1. Fire an event named abort at transaction with its bubbles attribute initialized to true.

                                  @@ -5404,8 +5397,7 @@

                                  Add request to the end of transaction’s request list.

                                2. -

                                  Return request and queue up the execution of the remaining steps -in this algorithm.

                                  +

                                  Return request, but continue these steps in parallel.

                                3. Wait until all previously added requests in transaction have their done flag set.

                                4. @@ -5415,12 +5407,12 @@

                                  This only reverts the changes done by this request, not any other changes made by the transaction.
                                5. -

                                  Queue a task to run these substeps:

                                  +

                                  Queue a task to run these steps:

                                  1. Set the done flag on request.

                                  2. -

                                    If result is an error, then run these substeps:

                                    +

                                    If result is an error, then:

                                    1. Set the result of request to undefined.

                                      @@ -5430,7 +5422,7 @@

                                      Fire an error event at request.

                                  3. -

                                    Otherwise, run these substeps:

                                    +

                                    Otherwise:

                                    1. Set the result of request to result.

                                      @@ -5466,7 +5458,7 @@

                                      transaction, and so if the transaction is aborted, this change is reverted.

                                    2. -

                                      Queue a task to run the following steps:

                                      +

                                      Queue a task to run these steps:

                                      1. Set request’s result to connection.

                                        @@ -5515,7 +5507,7 @@

                                        IDBDatabase object.
                                      2. For each object store handle handle associated with transaction, including those for object stores that -were created or deleted during transaction, run these substeps:

                                        +were created or deleted during transaction:

                                        1. If handle’s object store was not @@ -5533,7 +5525,7 @@

                                          For each index handle handle associated with transaction, including those for indexes that were created or deleted -during transaction, run these substeps:

                                          +during transaction:

                                          1. If handle’s index was not newly created @@ -5554,7 +5546,7 @@

                                            5.9. Firing a success event

                                            To fire a success event at a request, -the implementation must run the following steps:

                                            +the implementation must run these steps:

                                            1. Let event be the result of creating an event using Event.

                                              @@ -5580,7 +5572,7 @@

                                              5.10. Firing an error event

                                              To fire an error event at a request, -the implementation must run the following steps:

                                              +the implementation must run these steps:

                                              1. Let event be the result of creating an event using Event.

                                                @@ -5612,7 +5604,7 @@

                                                5.11. Clone a value

                                                To make a clone of value in targetRealm, - the implementation must run the following steps:

                                                + the implementation must run these steps:

                                                1. Let serialized be ? StructuredSerializeForStorage(value).

                                                  @@ -5635,10 +5627,10 @@

                                                  1. -

                                                    If store uses a key generator, run these substeps:

                                                    +

                                                    If store uses a key generator, then:

                                                    1. -

                                                      If key is undefined, run these substeps:

                                                      +

                                                      If key is undefined, then:

                                                      1. Let key be the result of running the steps to generate a key for store.

                                                        @@ -5667,13 +5659,13 @@

                                                        list of records such that the list is sorted according to the key of the records in ascending order.

                                                      2. -

                                                        For each index which reference store, run these substeps:

                                                        +

                                                        For each index which reference store:

                                                        1. Let index key be the result of running the steps to extract a key from a value using a key path with value, index’s key path, and index’s multiEntry flag.

                                                        2. If index key is an exception, or invalid, or failure, take no -further actions for this index, and continue these substeps +further actions for index, and continue these steps for the next index.

                                                        3. @@ -5734,7 +5726,7 @@

                                                          Let list be an empty list.

                                                        4. -

                                                          For each record in records, run these substeps:

                                                          +

                                                          For each record in records:

                                                          1. Let serialized be record’s value.

                                                            @@ -5770,7 +5762,7 @@

                                                            Let list be an empty list.

                                                          2. -

                                                            For each record in records, run these substeps:

                                                            +

                                                            For each record in records:

                                                            1. Let entry be the result of running the steps to convert a @@ -5808,7 +5800,7 @@

                                                              Let list be an empty list.

                                                            2. -

                                                              For each record in records, run these substeps:

                                                              +

                                                              For each record in records:

                                                              1. Let serialized be record’s referenced value.

                                                                @@ -5845,7 +5837,7 @@

                                                                Let list be an empty list.

                                                              2. -

                                                                For each record in records, run these substeps:

                                                                +

                                                                For each record in records:

                                                                1. Let entry be the result of running the steps to convert a @@ -5918,7 +5910,7 @@

                                                                  If count is not given, let count be 1.

                                                                2. -

                                                                  While count is greater than 0, run these substeps:

                                                                  +

                                                                  While count is greater than 0:

                                                                  1. Switch on direction:

                                                                    @@ -5995,7 +5987,7 @@

                                                                    Iterating with "prevunique" visits the same records that "nextunique" visits, but in reverse order.
                                                                  2. -

                                                                    If found record is not defined, run these substeps:

                                                                    +

                                                                    If found record is not defined, then:

                                                                    1. Set cursor’s key to undefined.

                                                                      @@ -6022,7 +6014,7 @@

                                                                      Set cursor’s key to found record’s key.

                                                                    2. -

                                                                      If cursor’s key only flag is unset, run these substeps:

                                                                      +

                                                                      If cursor’s key only flag is unset, then:

                                                                      1. Let serialized be found record’s referenced value.

                                                                        @@ -6069,7 +6061,7 @@

                                                                        1. -

                                                                          If keyPath is a list of strings, run these substeps:

                                                                          +

                                                                          If keyPath is a list of strings, then:

                                                                          1. Let result be a new Array object created as if by the @@ -6077,7 +6069,7 @@

                                                                            Let i be 0.

                                                                          2. -

                                                                            For each item in keyPath, run these substeps:

                                                                            +

                                                                            For each item in keyPath:

                                                                            1. Let key be the result of recursively running the steps to evaluate a key path on a value using item as keyPath and value as value.

                                                                              @@ -6163,8 +6155,7 @@

                                                                              Remove the last member of identifiers.

                                                                            2. -

                                                                              For each remaining identifier in identifiers, if any, run these -substeps:

                                                                              +

                                                                              For each remaining identifier in identifiers, if any:

                                                                              1. If value is not an Object or an Array, return false.

                                                                                @@ -6193,15 +6184,14 @@

                                                                                Let last be the last member of identifiers and remove it from the list.

                                                                              2. -

                                                                                For each remaining identifier in identifiers, run these -substeps:

                                                                                +

                                                                                For each remaining identifier in identifiers:

                                                                                1. Assert: value is an Object or an Array.

                                                                                2. Let hop be ! HasOwnProperty(value, identifier).

                                                                                3. -

                                                                                  If hop is false, run these substeps:

                                                                                  +

                                                                                  If hop is false, then:

                                                                                  1. Let o be a new Object created as if by the @@ -6286,7 +6276,7 @@

                                                                                    Let index be 0.

                                                                                  2. -

                                                                                    While index is less than len, run these substeps:

                                                                                    +

                                                                                    While index is less than len:

                                                                                    1. Let entry be the result of running the steps to convert a key to a value with the indexth @@ -6364,7 +6354,7 @@

                                                                                      Let index be 0.

                                                                                    2. -

                                                                                      While index is less than len, run these substeps:

                                                                                      +

                                                                                      While index is less than len:

                                                                                      1. Let hop be ? HasOwnProperty(input, index).

                                                                                        @@ -6399,7 +6389,7 @@

                                                                                        1. -

                                                                                          If IsArray(input), then run these substeps:

                                                                                          +

                                                                                          If IsArray(input), then:

                                                                                          1. Let len be ? ToLength( ? Get(input, "length")).

                                                                                            @@ -6410,12 +6400,12 @@

                                                                                            Let index be 0.

                                                                                          2. -

                                                                                            While index is less than len, run these substeps:

                                                                                            +

                                                                                            While index is less than len:

                                                                                            1. Let entry be Get(input, index).

                                                                                            2. -

                                                                                              If entry is not an abrupt completion, run these substeps:

                                                                                              +

                                                                                              If entry is not an abrupt completion, then:

                                                                                              1. Let key be the result of running the steps to convert a value to a key with arguments entry and seen.

                                                                                                @@ -7331,6 +7321,7 @@

                                                                                                domain
                                                                                              2. event handler idl attribute
                                                                                              3. event loop +
                                                                                              4. in parallel
                                                                                              5. opaque origin
                                                                                              6. origin
                                                                                              7. queue a task From c9a1f6f992be212702500f41552762459afe8a87 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 8 May 2017 12:06:43 -0700 Subject: [PATCH 2/3] Don't be clever with 'return/in parallel' --- index.bs | 198 +++++++++++++++++++++++++++-------------------------- index.html | 132 ++++++++++++++++++----------------- 2 files changed, 172 insertions(+), 158 deletions(-) diff --git a/index.bs b/index.bs index 5f46373..e565716 100644 --- a/index.bs +++ b/index.bs @@ -2235,56 +2235,57 @@ when invoked, must run these steps: 4. Let |request| be a new [=open request=]. -5. Return a new {{IDBOpenDBRequest}} object for |request|, - but continue these steps [=in parallel=]. +5. Run these steps [=in parallel=]: -6. Let |result| be the result of running the steps to - [=open a database=], with |origin|, - |name|, |version| if given and undefined - otherwise, and |request|. + 1. Let |result| be the result of running the steps to + [=open a database=], with |origin|, + |name|, |version| if given and undefined + otherwise, and |request|. -
                                                                                                - What happens if |version| is not given? - If |version| is not given and a [=database=] - with that name already exists, a connection will be opened - without changing the [=database/version=]. If - |version| is not given and no [=database=] with - that name exists, a new [=database=] will be created with - [=database/version=] equal to 1. -
                                                                                                +
                                                                                                + What happens if |version| is not given? + If |version| is not given and a [=database=] + with that name already exists, a connection will be opened + without changing the [=database/version=]. If + |version| is not given and no [=database=] with + that name exists, a new [=database=] will be created with + [=database/version=] equal to 1. +
                                                                                                -7. [=Queue a task=] to run these steps: + 2. [=Queue a task=] to run these steps: - 1. If |result| is an error, set the [=request/error=] - of |request| to |result| and [=fire an event=] named - error at |request| with its - {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. + 1. If |result| is an error, set the [=request/error=] + of |request| to |result| and [=fire an event=] named + error at |request| with its + {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. - 2. Otherwise, set the [=request/result=] of |request| - to |result| and [=fire an event=] named - success at |request|. If the steps - above resulted in an [=upgrade transaction=] being run, - then firing the "success" event must be done - after the [=upgrade transaction=] completes. + 2. Otherwise, set the [=request/result=] of |request| + to |result| and [=fire an event=] named + success at |request|. If the steps + above resulted in an [=upgrade transaction=] being run, + then firing the "success" event must be done + after the [=upgrade transaction=] completes. - + -
                                                                                                - - Why aren't the steps to [=fire a success event=] or - [=fire an error event=] used? - - There is no transaction associated with the request (at - this point), so those steps — which activate an - associated transaction before dispatch and deactivate - the transaction after dispatch — do not apply. -
                                                                                                +
                                                                                                + + Why aren't the steps to [=fire a success event=] or + [=fire an error event=] used? + + There is no transaction associated with the request (at + this point), so those steps — which activate an + associated transaction before dispatch and deactivate + the transaction after dispatch — do not apply. +
                                                                                                + +6. Return a new {{IDBOpenDBRequest}} object for |request|.

                                                @@ -2301,39 +2302,40 @@ when invoked, must run these steps: 3. Let |request| be a new [=open request=]. -4. Return a new {{IDBOpenDBRequest}} object for |request|, - but continue these steps [=in parallel=]. - -5. Let |result| be the result of running the steps to - [=delete a database=], with |origin|, - |name|, and |request|. - -6. [=Queue a task=] to run these steps: - 1. If |result| is an error set the [=request/error=] of - |request| to |result| and [=fire an event=] - named error at |request| with - its {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. - - 2. Otherwise, set the [=request/result=] of |request| - to undefined and [=fire a version change event=] named - success at [=request=] with |result| and - null. - -
                                                - - Why aren't the steps to [=fire a success event=] or - [=fire an error event=] used? - - There is no transaction associated with the request, so - those steps — which activate an associated - transaction before dispatch and deactivate the - transaction after dispatch — do not apply. - - Also, the success event here is a - {{IDBVersionChangeEvent}} which includes the - {{IDBVersionChangeEvent/oldVersion}} and - {{IDBVersionChangeEvent/newVersion}} details. -
                                                +4. Run these steps [=in parallel=]: + + 1. Let |result| be the result of running the steps to + [=delete a database=], with |origin|, + |name|, and |request|. + + 2. [=Queue a task=] to run these steps: + 1. If |result| is an error set the [=request/error=] of + |request| to |result| and [=fire an event=] + named error at |request| with + its {{Event/bubbles}} and {{Event/cancelable}} attributes initialized to true. + + 2. Otherwise, set the [=request/result=] of |request| + to undefined and [=fire a version change event=] named + success at [=request=] with |result| and + null. + +
                                                + + Why aren't the steps to [=fire a success event=] or + [=fire an error event=] used? + + There is no transaction associated with the request, so + those steps — which activate an associated + transaction before dispatch and deactivate the + transaction after dispatch — do not apply. + + Also, the success event here is a + {{IDBVersionChangeEvent}} which includes the + {{IDBVersionChangeEvent/oldVersion}} and + {{IDBVersionChangeEvent/newVersion}} details. +
                                                + +5. Return a new {{IDBOpenDBRequest}} object for |request|.
                                              @@ -5430,7 +5432,7 @@ This algorithm takes one argument, the |transaction| to commit. appropriate for the error, for example "{{QuotaExceededError}}" or "{{UnknownError}}" {{DOMException}}. -3. [=Queue a task=] to run these steps +3. [=Queue a task=] to run these steps: 1. [=Fire an event=] named complete at |transaction|. @@ -5535,36 +5537,38 @@ created [=request=] belongs to is [=transaction/aborted=] using the steps to 4. Add |request| to the end of |transaction|'s [=request list=]. -5. Return |request|, but continue these steps [=in parallel=]. +5. Run these steps [=in parallel=]: -6. Wait until all previously added [=requests=] in |transaction| - have their [=request/done flag=] set. + 6. Wait until all previously added [=requests=] in |transaction| + have their [=request/done flag=] set. -7. Let |result| be the result of performing |operation|. + 7. Let |result| be the result of performing |operation|. -8. If |result| is an error, then revert all changes made by - |operation|. + 8. If |result| is an error, then revert all changes made by + |operation|. - + -9. [=Queue a task=] to run these steps: + 9. [=Queue a task=] to run these steps: - 1. Set the [=request/done flag=] on |request|. + 1. Set the [=request/done flag=] on |request|. + + 2. If |result| is an error, then: - 2. If |result| is an error, then: + 1. Set the [=request/result=] of |request| to undefined. + 2. Set the [=request/error=] of |request| to |result|. + 3. [=Fire an error event=] at |request|. - 1. Set the [=request/result=] of |request| to undefined. - 2. Set the [=request/error=] of |request| to |result|. - 3. [=Fire an error event=] at |request|. + 3. Otherwise: - 3. Otherwise: + 1. Set the [=request/result=] of |request| to |result|. + 2. Set the [=request/error=] of |request| to undefined. + 3. [=Fire a success event=] at |request|. - 1. Set the [=request/result=] of |request| to |result|. - 2. Set the [=request/error=] of |request| to undefined. - 3. [=Fire a success event=] at |request|. +6. Return |request|.
                                            diff --git a/index.html b/index.html index 284a17d..f8853a3 100644 --- a/index.html +++ b/index.html @@ -1459,7 +1459,7 @@

                                            Indexed Database API 2.0

                                            -

                                            Editor’s Draft,

                                            +

                                            Editor’s Draft,

                                            This version: @@ -3153,39 +3153,42 @@

                                            Let request be a new open request.

                                          2. -

                                            Return a new IDBOpenDBRequest object for request, -but continue these steps in parallel.

                                            -
                                          3. -

                                            Let result be the result of running the steps to open a database, with origin, name, version if given and undefined +

                                            Run these steps in parallel:

                                            +
                                              +
                                            1. +

                                              Let result be the result of running the steps to open a database, with origin, name, version if given and undefined otherwise, and request.

                                              -
                                              - What happens if version is not given? - If version is not given and a database with that name already exists, a connection will be opened +
                                              + What happens if version is not given? + If version is not given and a database with that name already exists, a connection will be opened without changing the version. If version is not given and no database with that name exists, a new database will be created with version equal to 1. -
                                              -
                                            2. -

                                              Queue a task to run these steps:

                                              -
                                                -
                                              1. -

                                                If result is an error, set the error of request to result and fire an event named error at request with its bubbles and cancelable attributes initialized to true.

                                                +
                                            3. -

                                              Otherwise, set the result of request to result and fire an event named success at request. If the steps +

                                              Queue a task to run these steps:

                                              +
                                                +
                                              1. +

                                                If result is an error, set the error of request to result and fire an event named error at request with its bubbles and cancelable attributes initialized to true.

                                                +
                                              2. +

                                                Otherwise, set the result of request to result and fire an event named success at request. If the steps above resulted in an upgrade transaction being run, then firing the "success" event must be done after the upgrade transaction completes.

                                                -
                                            +
                                          4. +

                                            Return a new IDBOpenDBRequest object for request.

      3. @@ -3201,28 +3204,31 @@

        Let request be a new open request.

      4. -

        Return a new IDBOpenDBRequest object for request, -but continue these steps in parallel.

        -
      5. -

        Let result be the result of running the steps to delete a database, with origin, name, and request.

        -
      6. -

        Queue a task to run these steps:

        +

        Run these steps in parallel:

        1. -

          If result is an error set the error of request to result and fire an event named error at request with -its bubbles and cancelable attributes initialized to true.

          +

          Let result be the result of running the steps to delete a database, with origin, name, and request.

        2. -

          Otherwise, set the result of request to undefined and fire a version change event named success at request with result and +

          Queue a task to run these steps:

          +
            +
          1. +

            If result is an error set the error of request to result and fire an event named error at request with +its bubbles and cancelable attributes initialized to true.

            +
          2. +

            Otherwise, set the result of request to undefined and fire a version change event named success at request with result and null.

            -
            - Why aren’t the steps to fire a success event or fire an error event used? - There is no transaction associated with the request, so +
            + Why aren’t the steps to fire a success event or fire an error event used? + There is no transaction associated with the request, so those steps — which activate an associated transaction before dispatch and deactivate the transaction after dispatch — do not apply. -

            Also, the success event here is a IDBVersionChangeEvent which includes the oldVersion and newVersion details.

            -
            +

            Also, the success event here is a IDBVersionChangeEvent which includes the oldVersion and newVersion details.

            +
            +
        +
      7. +

        Return a new IDBOpenDBRequest object for request.

      @@ -5317,7 +5323,7 @@

      QuotaExceededError" or "UnknownError" DOMException.

    2. -

      Queue a task to run these steps

      +

      Queue a task to run these steps:

      1. Fire an event named complete at transaction.

        @@ -5397,41 +5403,45 @@

        Add request to the end of transaction’s request list.

      2. -

        Return request, but continue these steps in parallel.

        -
      3. -

        Wait until all previously added requests in transaction have their done flag set.

        -
      4. -

        Let result be the result of performing operation.

        -
      5. -

        If result is an error, then revert all changes made by operation.

        - -
      6. -

        Queue a task to run these steps:

        -
          +

          Run these steps in parallel:

          +
          1. -

            Set the done flag on request.

            +

            Wait until all previously added requests in transaction have their done flag set.

          2. -

            If result is an error, then:

            -
              -
            1. -

              Set the result of request to undefined.

              -
            2. -

              Set the error of request to result.

              -
            3. -

              Fire an error event at request.

              -
            +

            Let result be the result of performing operation.

            +
          3. +

            If result is an error, then revert all changes made by operation.

            +
          4. -

            Otherwise:

            +

            Queue a task to run these steps:

            1. -

              Set the result of request to result.

              +

              Set the done flag on request.

            2. -

              Set the error of request to undefined.

              +

              If result is an error, then:

              +
                +
              1. +

                Set the result of request to undefined.

                +
              2. +

                Set the error of request to result.

                +
              3. +

                Fire an error event at request.

                +
            3. -

              Fire a success event at request.

              +

              Otherwise:

              +
                +
              1. +

                Set the result of request to result.

                +
              2. +

                Set the error of request to undefined.

                +
              3. +

                Fire a success event at request.

                +
          +
        1. +

          Return request.

    3. 5.7. Running an upgrade transaction

      From 2bddeeda98304c60ed491ae4a17259baca58bbb0 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 8 May 2017 17:25:15 -0700 Subject: [PATCH 3/3] Fix numbering --- index.bs | 8 ++++---- index.html | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index e565716..449b146 100644 --- a/index.bs +++ b/index.bs @@ -5539,12 +5539,12 @@ created [=request=] belongs to is [=transaction/aborted=] using the steps to 5. Run these steps [=in parallel=]: - 6. Wait until all previously added [=requests=] in |transaction| + 1. Wait until all previously added [=requests=] in |transaction| have their [=request/done flag=] set. - 7. Let |result| be the result of performing |operation|. + 2. Let |result| be the result of performing |operation|. - 8. If |result| is an error, then revert all changes made by + 3. If |result| is an error, then revert all changes made by |operation|. - 9. [=Queue a task=] to run these steps: + 4. [=Queue a task=] to run these steps: 1. Set the [=request/done flag=] on |request|. diff --git a/index.html b/index.html index f8853a3..09aad2f 100644 --- a/index.html +++ b/index.html @@ -1459,7 +1459,7 @@

      Indexed Database API 2.0

      -

      Editor’s Draft,

      +

      Editor’s Draft,

      This version: @@ -5404,7 +5404,7 @@

      Add request to the end of transaction’s request list.

    4. Run these steps in parallel:

      -
        +
        1. Wait until all previously added requests in transaction have their done flag set.