Skip to content

Commit 77de7f1

Browse files
Make transactions inactive during clone (#310)
To avoid side effects from getters during cloning operations (part of put/add/update calls), make transactions temporarily inactive. Implemented in Blink, pending implementation in Gecko.
1 parent e71f613 commit 77de7f1

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

index.bs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2983,7 +2983,7 @@ To <dfn>add or put</dfn> with |handle|, |value|, |key|, and |no-overwrite flag|,
29832983

29842984
1. Let |targetRealm| be a user-agent defined [=Realm=].
29852985

2986-
1. Let |clone| be a [=clone=] of |value| in |targetRealm|.
2986+
1. Let |clone| be a [=clone=] of |value| in |targetRealm| during |transaction|.
29872987
Rethrow any exceptions.
29882988

29892989
<details class=note>
@@ -4680,7 +4680,7 @@ invoked, must run these steps:
46804680

46814681
1. Let |targetRealm| be a user-agent defined [=Realm=].
46824682

4683-
1. Let |clone| be a [=clone=] of |value| in |targetRealm|.
4683+
1. Let |clone| be a [=clone=] of |value| in |targetRealm| during |transaction|.
46844684
Rethrow any exceptions.
46854685

46864686
<details class=note>
@@ -5528,8 +5528,7 @@ To <dfn>abort an upgrade transaction</dfn> with |transaction|, run these steps:
55285528

55295529
<div class=algorithm>
55305530

5531-
To <dfn>fire a success event</dfn> at a |request|,
5532-
the implementation must run these steps:
5531+
To <dfn>fire a success event</dfn> at a |request|, run these steps:
55335532

55345533
1. Let |event| be the result of [=creating an event=] using {{Event}}.
55355534

@@ -5568,8 +5567,7 @@ the implementation must run these steps:
55685567

55695568
<div class=algorithm>
55705569

5571-
To <dfn>fire an error event</dfn> at a |request|,
5572-
the implementation must run these steps:
5570+
To <dfn>fire an error event</dfn> at a |request|, run these steps:
55735571

55745572
1. Let |event| be the result of [=creating an event=] using {{Event}}.
55755573

@@ -5621,13 +5619,23 @@ the implementation must run these steps:
56215619

56225620
<div class=algorithm>
56235621

5624-
To make a <dfn>clone</dfn> of |value| in |targetRealm|,
5625-
the implementation must run these steps:
5622+
To make a <dfn>clone</dfn> of |value| in |targetRealm| during |transaction|,
5623+
run these steps:
5624+
5625+
1. [=/Assert=]: |transaction|'s [=transaction/state=] is [=transaction/active=].
5626+
5627+
1. Set |transaction|'s [=transaction/state=] to [=transaction/inactive=].
5628+
5629+
<aside class=note>
5630+
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.
5631+
</aside>
56265632

56275633
1. Let |serialized| be [=?=] <a abstract-op>StructuredSerializeForStorage</a>(|value|).
56285634

56295635
1. Let |clone| be [=?=] <a abstract-op>StructuredDeserialize</a>(|serialized|, |targetRealm|).
56305636

5637+
1. Set |transaction|'s [=transaction/state=] to [=transaction/active=].
5638+
56315639
1. Return |clone|.
56325640

56335641
</div>
@@ -6815,6 +6823,7 @@ For the revision history of the second edition, see [that document's Revision Hi
68156823
* Removed handling for nonstandard `lastModifiedDate` property of {{File}} objects. ([Issue #215](https://github.com/w3c/IndexedDB/issues/215))
68166824
* Remove escaping {{IDBKeyRange/includes()}} method. ([Issue #294](https://github.com/w3c/IndexedDB/issues/294))
68176825
* Restrict array keys to [=/Array exotic objects=] (i.e. disallow proxies). ([Issue #309](https://github.com/w3c/IndexedDB/issues/309])
6826+
* Transactions are now temporarily made inactive during clone operations.
68186827

68196828
<!-- ============================================================ -->
68206829
# Acknowledgements # {#acknowledgements}

0 commit comments

Comments
 (0)