@@ -3060,6 +3060,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
3060
3060
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-eval-x"><code>eval()</code></dfn> function</li>
3061
3061
<li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-IsHTMLDDA-internal-slot">[[IsHTMLDDA]]</dfn> internal slot</li>
3062
3062
<li>The <dfn data-x="js-typeof" data-x-href="https://tc39.github.io/ecma262/#sec-typeof-operator"><code>typeof</code></dfn> operator</li>
3063
+ <li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-delete-operator"><code>delete</code></dfn> operator</li>
3063
3064
<li><dfn data-x-href="https://tc39.github.io/ecma262/#table-49">The <var>TypedArray</var> Constructors</dfn> table</li>
3064
3065
</ul>
3065
3066
@@ -98192,7 +98193,7 @@ interface <dfn>WorkerLocation</dfn> {
98192
98193
-->
98193
98194
98194
98195
<p>The second storage mechanism is designed for storage that spans multiple windows, and lasts
98195
- beyond the current session. In particular, Web applications may wish to store megabytes of user
98196
+ beyond the current session. In particular, Web applications might wish to store megabytes of user
98196
98197
data, such as entire user-authored documents or a user's mailbox, on the client side for
98197
98198
performance reasons.</p>
98198
98199
@@ -98260,6 +98261,53 @@ interface <dfn>Storage</dfn> {
98260
98261
implementing the <code>Storage</code> interface can all be associated with the same list of
98261
98262
key/value pairs simultaneously.</p>
98262
98263
98264
+ <dl class="domintro">
98265
+
98266
+ <dt><var>storage</var> . <code subdfn data-x="dom-Storage-length">length</code></dt>
98267
+ <dd>
98268
+ <p>Returns the number of key/value pairs currently present in the list associated with the
98269
+ object.</p>
98270
+ <dd>
98271
+
98272
+ <dt><var>storage</var> . <code subdfn data-x="dom-Storage-key">key</code> ( <var>n</var> )</dt>
98273
+ <dd>
98274
+ <p>Returns the name of the <var>n</var>th key in the list, or null if <var>n</var> is greater
98275
+ than or equal to the number of key/value pairs in the object.</p>
98276
+ <dd>
98277
+
98278
+ <dt><var>value</var> = <var>storage</var> . <code subdfn data-x="dom-Storage-getItem">getItem</code> ( <var>key</var> )</dt>
98279
+ <dt><var>value</var> = <var>storage</var>[<var>key</var>]</dt>
98280
+ <dd>
98281
+ <p>Returns the current value associated with the given <var>key</var>, or null if the given
98282
+ <var>key</var> does not exist in the list associated with the object.</p>
98283
+ <dd>
98284
+
98285
+ <dt><var>storage</var> . <code subdfn data-x="dom-Storage-setItem">setItem</code> ( <var>key</var>, <var>value</var> )</dt>
98286
+ <dt><var>storage</var>[<var>key</var>] = <var>value</var></dt>
98287
+ <dd>
98288
+ <p>Sets the value of the pair identified by <var>key</var> to <var>value</var>, creating a new
98289
+ key/value pair if none existed for <var>key</var> previously.</p>
98290
+
98291
+ <p>Throws a <span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code> exception
98292
+ if the new value couldn't be set. (Setting could fail if, e.g., the user has disabled storage
98293
+ for the site, or if the quota has been exceeded.)</p>
98294
+
98295
+ <dt><var>storage</var> . <code subdfn data-x="dom-Storage-removeItem">removeItem</code> ( <var>key</var> )</dt>
98296
+ <dt><code>delete</code> <var>storage</var>[<var>key</var>]</dt>
98297
+ <dd>
98298
+ <p>Removes the key/value pair with the given <var>key</var> from the list associated with the
98299
+ object, if a key/value pair with the given <var>key</var> exists.</p>
98300
+ </dd>
98301
+
98302
+ <dt><var>storage</var> . <code subdfn data-x="dom-Storage-clear">clear</code>()</dt>
98303
+ <dd>
98304
+ <p>Empties the list associated with the object of all key/value pairs, if there are any.</p>
98305
+ </dd>
98306
+
98307
+ </dl>
98308
+
98309
+ <div w-nodev>
98310
+
98263
98311
<p>The <dfn><code data-x="dom-Storage-length">length</code></dfn> attribute must return the number
98264
98312
of key/value pairs currently present in the list associated with the object.</p>
98265
98313
@@ -98291,8 +98339,7 @@ interface <dfn>Storage</dfn> {
98291
98339
the method must do nothing.</p>
98292
98340
98293
98341
<p>If it couldn't set the new value, the method must throw a
98294
- <span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code> exception. (Setting could
98295
- fail if, e.g., the user has disabled storage for the site, or if the quota has been exceeded.)</p>
98342
+ <span>"<code>QuotaExceededError</code>"</span> <code>DOMException</code> exception.</p>
98296
98343
98297
98344
<p>The <dfn><code data-x="dom-Storage-removeItem">removeItem(<var>key</var>)</code></dfn>
98298
98345
method must cause the key/value pair with the given <var>key</var> to be removed from the
@@ -98308,6 +98355,8 @@ interface <dfn>Storage</dfn> {
98308
98355
list associated with the object to be emptied of all key/value pairs, if there are any. If there
98309
98356
are none, then the method must do nothing.</p>
98310
98357
98358
+ </div>
98359
+
98311
98360
<p class="note">When the <code data-x="dom-Storage-setItem">setItem()</code>, <code
98312
98361
data-x="dom-Storage-removeItem">removeItem()</code>, and <code
98313
98362
data-x="dom-Storage-clear">clear()</code> methods are invoked, events are fired on the
@@ -98334,6 +98383,14 @@ interface <dfn>WindowSessionStorage</dfn> {
98334
98383
<p>The <dfn><code data-x="dom-sessionStorage">sessionStorage</code></dfn> attribute represents the
98335
98384
set of storage areas specific to the current <span>top-level browsing context</span>.</p>
98336
98385
98386
+ <dl class="domintro">
98387
+ <dt><var>window</var> . <code subdfn data-x="dom-sessionStorage">sessionStorage</code></dt>
98388
+ <dd>
98389
+ <p>Returns the <code>Storage</code> object associated with that origin's session storage
98390
+ area.</p>
98391
+ </dd>
98392
+ </dl>
98393
+
98337
98394
<p>Each <span>top-level browsing context</span> has a unique set of session storage areas, one for
98338
98395
each <span>origin</span>.</p>
98339
98396
@@ -98345,6 +98402,8 @@ interface <dfn>WindowSessionStorage</dfn> {
98345
98402
be discarded with it, as the API described in this specification provides no way for that data to
98346
98403
ever be subsequently retrieved.</p>
98347
98404
98405
+ <div w-nodev>
98406
+
98348
98407
<p class="note">The lifetime of a browsing context can be unrelated to the lifetime of the actual
98349
98408
user agent process itself, as the user agent can support resuming sessions after a restart.</p>
98350
98409
@@ -98361,19 +98420,21 @@ interface <dfn>WindowSessionStorage</dfn> {
98361
98420
98362
98421
<p>The <code data-x="dom-sessionStorage">sessionStorage</code> attribute must return a
98363
98422
<code>Storage</code> object associated with the <code>Document</code>'s assigned session storage
98364
- area, if any, or null if there isn't one. Each <code>Document</code> object must have a separate
98365
- object for its <code>Window</code>'s <code data-x="dom-sessionStorage">sessionStorage</code>
98366
- attribute.</p>
98423
+ area. Each <code>Document</code> object must have a separate object for its <code>Window</code>'s
98424
+ <code data-x="dom-sessionStorage">sessionStorage</code> attribute.</p>
98367
98425
98368
98426
<p>While <span>creating a new browsing context</span>, the session storage area <a
98369
98427
href="#copy-session-storage">is sometimes copied</a> over.</p>
98370
98428
98429
+ </div>
98430
+
98371
98431
<p id="sessionStorageEvent">When the <code data-x="dom-Storage-setItem">setItem()</code>, <code
98372
98432
data-x="dom-Storage-removeItem">removeItem()</code>, and <code
98373
98433
data-x="dom-Storage-clear">clear()</code> methods are called on a <code>Storage</code> object <var>x</var> that is associated with a session storage area, if the methods did not throw an
98374
98434
exception or "do nothing" as defined above, then for every <code>Document</code> object whose
98375
98435
<code>Window</code> object's <code data-x="dom-sessionStorage">sessionStorage</code> attribute's
98376
- <code>Storage</code> object is associated with the same storage area, other than <var>x</var>, <span>send a storage notification</span>.</p>
98436
+ <code>Storage</code> object is associated with the same storage area, other than <var>x</var>,
98437
+ <span w-nohtml>user agents</span> <span>send a storage notification</span>.</p>
98377
98438
98378
98439
98379
98440
<h4>The <code data-x="dom-localStorage">localStorage</code> attribute</h4>
@@ -98390,6 +98451,20 @@ interface <dfn>WindowLocalStorage</dfn> {
98390
98451
<!--INSERT FINGERPRINT-->
98391
98452
</p>
98392
98453
98454
+ <dl class="domintro">
98455
+ <dt><var>window</var> . <code subdfn data-x="dom-localStorage">localStorage</code></dt>
98456
+ <dd>
98457
+ <p>Returns the <code>Storage</code> object associated with that origin's local storage
98458
+ area.</p>
98459
+ <p>Throws a <span>"<code>SecurityError</code>"</span> <code>DOMException</code> if the
98460
+ <code>Document</code>'s <span>origin</span> is an <span data-x="concept-origin-opaque">opaque
98461
+ origin</span> or if the request violates a policy decision (e.g. if the user agent is
98462
+ configured to not allow the page to persist data).</p>
98463
+ </dd>
98464
+ </dl>
98465
+
98466
+ <div w-nodev>
98467
+
98393
98468
<p>User agents must have a set of local storage areas, one for each <span>origin</span>.</p>
98394
98469
98395
98470
<p>User agents should expire data from the local storage areas only for security reasons or when
@@ -98404,10 +98479,10 @@ interface <dfn>WindowLocalStorage</dfn> {
98404
98479
98405
98480
<ol>
98406
98481
98407
- <li><p>The user agent may throw a <span>"<code>SecurityError</code>"</span>
98408
- <code>DOMException</code> instead of returning a <code>Storage</code>
98409
- object if the request violates a policy decisions (e.g. if the user agent is configured to not
98410
- allow the page to persist data). </p></li>
98482
+ <li><p>If the request violates a policy decision (e.g. if the user agent is configured to not
98483
+ allow the page to persist data), the user agent may throw a
98484
+ <span>"<code>SecurityError</code>"</span> <code>DOMException</code> instead of returning a
98485
+ <code>Storage</code> object </p></li>
98411
98486
98412
98487
<li><p>If the <code>Document</code>'s <span>origin</span> is an <span
98413
98488
data-x="concept-origin-opaque">opaque origin</span>, then throw a
@@ -98424,12 +98499,15 @@ interface <dfn>WindowLocalStorage</dfn> {
98424
98499
98425
98500
</ol>
98426
98501
98502
+ </div>
98503
+
98427
98504
<p id="localStorageEvent">When the <code data-x="dom-Storage-setItem">setItem()</code>, <code
98428
98505
data-x="dom-Storage-removeItem">removeItem()</code>, and <code
98429
98506
data-x="dom-Storage-clear">clear()</code> methods are called on a <code>Storage</code> object <var>x</var> that is associated with a local storage area, if the methods did not throw an
98430
98507
exception or "do nothing" as defined above, then for every <code>Document</code> object whose
98431
98508
<code>Window</code> object's <code data-x="dom-localStorage">localStorage</code> attribute's
98432
- <code>Storage</code> object is associated with the same storage area, other than <var>x</var>, <span>send a storage notification</span>.
98509
+ <code>Storage</code> object is associated with the same storage area, other than <var>x</var>,
98510
+ <span w-nohtml>user agents</span> <span>send a storage notification</span>.
98433
98511
98434
98512
<p class="warning">The <code data-x="dom-localStorage">localStorage</code> attribute provides
98435
98513
access to shared state. This specification does not define the interaction with other browsing
@@ -98442,10 +98520,13 @@ interface <dfn>WindowLocalStorage</dfn> {
98442
98520
98443
98521
<h4>The <code data-x="event-storage">storage</code> event</h4>
98444
98522
98445
- <p>The <code data-x="event-storage">storage</code> event is fired on a <code>Document</code>'s
98446
- <code>Window</code> object when a storage area changes, as described in the previous two sections
98447
- (<a href="#sessionStorageEvent">for session storage</a>, <a href="#localStorageEvent">for local
98448
- storage</a>).</p>
98523
+ <p><span subdfn data-x="send a storage notification">The <code
98524
+ data-x="event-storage">storage</code> event is fired on a <code>Document</code>'s
98525
+ <code>Window</code> object when a storage area changes</span>, as described in the previous two
98526
+ sections (<a href="#sessionStorageEvent">for session storage</a>, <a href="#localStorageEvent">for
98527
+ local storage</a>).</p>
98528
+
98529
+ <div w-nodev>
98449
98530
98450
98531
<p>When a user agent is to <dfn>send a storage notification</dfn> for a <code>Document</code>, the
98451
98532
user agent must <span>queue a task</span> to <span data-x="concept-event-fire">fire an
@@ -98481,6 +98562,8 @@ interface <dfn>WindowLocalStorage</dfn> {
98481
98562
<code>Document</code> that represents the same kind of <code>Storage</code> area as was affected
98482
98563
(i.e. session or local).</p>
98483
98564
98565
+ </div>
98566
+
98484
98567
98485
98568
<h5>The <code>StorageEvent</code> interface</h5>
98486
98569
@@ -98502,21 +98585,50 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
98502
98585
<span>Storage</span>? storageArea = null;
98503
98586
};</pre>
98504
98587
98505
- <p>The <dfn><code data-x="dom-StorageEvent-key">key</code></dfn> attribute must return the value
98506
- it was initialized to. It represents the key being changed.</p>
98588
+ <dl class="domintro">
98507
98589
98508
- <p>The <dfn><code data-x="dom-StorageEvent-oldValue">oldValue</code></dfn> attribute must return
98509
- the value it was initialized to. It represents the old value of the key being changed.</p>
98590
+ <dt><var>event</var> . <code subdfn data-x="dom-StorageEvent-key">key</code></dt>
98510
98591
98511
- <p>The <dfn><code data-x="dom-StorageEvent-newValue">newValue</code></dfn> attribute must return
98512
- the value it was initialized to. It represents the new value of the key being changed.</p>
98592
+ <dd>
98593
+ <p>Returns the key of the storage item being changed.</p>
98594
+ </dd>
98595
+
98596
+ <dt><var>event</var> . <code subdfn data-x="dom-StorageEvent-oldValue">oldValue</code></dt>
98597
+
98598
+ <dd>
98599
+ <p>Returns the old value of the key of the storage item whose value is being changed.</p>
98600
+ </dd>
98513
98601
98514
- <p>The <dfn><code data-x="dom-StorageEvent-url">url</code></dfn> attribute must return the value
98515
- it was initialized to. It represents the <span>URL</span> of the document whose key changed.</p>
98602
+ <dt><var>event</var> . <code subdfn data-x="dom-StorageEvent-newValue">newValue</code></dt>
98516
98603
98517
- <p>The <dfn><code data-x="dom-StorageEvent-storageArea">storageArea</code></dfn> attribute must
98518
- return the value it was initialized to. It represents the <code>Storage</code> object that was
98519
- affected.</p>
98604
+ <dd>
98605
+ <p>Returns the new value of the key of the storage item whose value is being changed.</p>
98606
+ </dd>
98607
+
98608
+ <dt><var>event</var> . <code subdfn data-x="dom-StorageEvent-url">url</code></dt>
98609
+
98610
+ <dd>
98611
+ <p>Returns the <span>URL</span> of the document whose storage item changed.</p>
98612
+ </dd>
98613
+
98614
+ <dt><var>event</var> . <code subdfn data-x="dom-StorageEvent-storageArea">storageArea</code></dt>
98615
+
98616
+ <dd>
98617
+ <p>Returns the <code>Storage</code> object that was affected.</p>
98618
+ </dd>
98619
+
98620
+ </dl>
98621
+
98622
+ <div w-nodev>
98623
+
98624
+ <p>The <dfn><code data-x="dom-StorageEvent-key">key</code></dfn>, <dfn><code
98625
+ data-x="dom-StorageEvent-oldValue">oldValue</code></dfn>, <dfn><code
98626
+ data-x="dom-StorageEvent-newValue">newValue</code></dfn>, <dfn><code
98627
+ data-x="dom-StorageEvent-url">url</code></dfn>, and <dfn><code
98628
+ data-x="dom-StorageEvent-storageArea">storageArea</code></dfn> attributes must return the values
98629
+ they were initialized to.</p>
98630
+
98631
+ </div>
98520
98632
98521
98633
98522
98634
<h3>Disk space</h3>
@@ -98648,6 +98760,7 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
98648
98760
user-specific data (e.g. user-agent headers and configuration settings) to combine separate
98649
98761
sessions into coherent user profiles.</p>
98650
98762
98763
+ <div w-nodev>
98651
98764
98652
98765
<h4>Sensitivity of data</h4>
98653
98766
@@ -98658,6 +98771,8 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
98658
98771
<p>To this end, user agents should ensure that when deleting data, it is promptly deleted from the
98659
98772
underlying storage.</p>
98660
98773
98774
+ </div>
98775
+
98661
98776
98662
98777
<!--ADD-TOPIC:Security-->
98663
98778
<h3 id="security-storage">Security</h3>
@@ -98683,6 +98798,8 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
98683
98798
path.</p>
98684
98799
98685
98800
98801
+ <div w-nodev>
98802
+
98686
98803
<h4>Implementation risks</h4>
98687
98804
98688
98805
<p>The two primary risks when implementing these persistent storage features are letting hostile
@@ -98703,6 +98820,8 @@ dictionary <dfn>StorageEventInit</dfn> : <span>EventInit</span> {
98703
98820
important for user security.</p>
98704
98821
<!--REMOVE-TOPIC:Security-->
98705
98822
98823
+ </div>
98824
+
98706
98825
98707
98826
98708
98827
<h2 split-filename="syntax" id="syntax"><dfn>The HTML syntax</dfn></h2>
0 commit comments