|
495 | 495 | be thought of as completely serializing the execution of all scripts in all <span data-x="browsing
|
496 | 496 | context">browsing contexts</span>.</p>
|
497 | 497 |
|
| 498 | + <p>The exception to this general design principle is the JavaScript <code>SharedArrayBuffer</code> |
| 499 | + class. Using <code>SharedArrayBuffer</code>s, it can in fact be observed that scripts in other |
| 500 | + <span data-x="event loop">event loops</span> are executing simultaneously. Furthermore, due to the |
| 501 | + JavaScript memory model, there are situations which not only are un-representable via serialized |
| 502 | + <em>script</em> execution, but also un-representable via serialized <em>statement</em> execution |
| 503 | + among those scripts.</p> |
| 504 | + |
498 | 505 | </div>
|
499 | 506 |
|
500 | 507 |
|
@@ -2912,6 +2919,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
|
2912 | 2919 | <li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-isconstructor">IsConstructor</dfn> abstract operation</li>
|
2913 | 2920 | <li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-isdatadescriptor">IsDataDescriptor</dfn> abstract operation</li>
|
2914 | 2921 | <li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-isdetachedbuffer">IsDetachedBuffer</dfn> abstract operation</li>
|
| 2922 | + <li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-issharedarraybuffer">IsSharedArrayBuffer</dfn> abstract operation</li> |
2915 | 2923 | <li>The <dfn data-x="js-NewObjectEnvironment" data-x-href="https://tc39.github.io/ecma262/#sec-newobjectenvironment">NewObjectEnvironment</dfn> abstract operation</li>
|
2916 | 2924 | <!-- the next set of Ordinary* abstract operations are in order of appearance -->
|
2917 | 2925 | <li>The <dfn data-x-href="https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof">OrdinaryGetPrototypeOf</dfn> abstract operation</li>
|
@@ -7858,23 +7866,36 @@ interface <dfn>DOMStringList</dfn> {
|
7858 | 7866 | <p>Otherwise, if <var>value</var> has an [[ArrayBufferData]] internal slot, then:</p>
|
7859 | 7867 |
|
7860 | 7868 | <ol>
|
7861 |
| - <li><p>If <span>IsDetachedBuffer</span>(<var>value</var>) is true, then throw a |
7862 |
| - <span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li> |
7863 |
| - |
7864 | 7869 | <li><p>Let <var>size</var> be <var>value</var>.[[ArrayBufferByteLength]].</p></li>
|
7865 | 7870 |
|
| 7871 | + <li><p>If <span>IsSharedArrayBuffer</span>(<var>value</var>) is true, then set |
| 7872 | + <var>serialized</var> to { [[Type]]: "SharedArrayBuffer", [[ArrayBufferData]]: |
| 7873 | + <var>value</var>.[[ArrayBufferData]], [[ArrayBufferByteLength]]: <var>size</var>, |
| 7874 | + [[EventLoop]]: <span>current Realm Record</span>'s <span |
| 7875 | + data-x="concept-realm-settings-object">settings object</span>'s <span>responsible event |
| 7876 | + loop</span> }.</p></li> |
| 7877 | + |
7866 | 7878 | <li>
|
7867 |
| - <p>Let <var>dataCopy</var> be ? <span>CreateByteDataBlock</span>(<var>size</var>).</p> |
| 7879 | + <p>Otherwise:</p> |
7868 | 7880 |
|
7869 |
| - <p class="note">This can throw a <code data-x="js-RangeError">RangeError</code> exception upon |
7870 |
| - allocation failure.</p> |
7871 |
| - </li> |
| 7881 | + <ol> |
| 7882 | + <li><p>If <span>IsDetachedBuffer</span>(<var>value</var>) is true, then throw a |
| 7883 | + <span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li> |
| 7884 | + |
| 7885 | + <li> |
| 7886 | + <p>Let <var>dataCopy</var> be ? <span>CreateByteDataBlock</span>(<var>size</var>).</p> |
7872 | 7887 |
|
7873 |
| - <li><p>Perform ! <span>CopyDataBlockBytes</span>(<var>dataCopy</var>, 0, |
7874 |
| - <var>value</var>.[[ArrayBufferData]], 0, <var>size</var>).</p></li> |
| 7888 | + <p class="note">This can throw a <code data-x="js-RangeError">RangeError</code> exception |
| 7889 | + upon allocation failure.</p> |
| 7890 | + </li> |
| 7891 | + |
| 7892 | + <li><p>Perform ! <span>CopyDataBlockBytes</span>(<var>dataCopy</var>, 0, |
| 7893 | + <var>value</var>.[[ArrayBufferData]], 0, <var>size</var>).</p></li> |
7875 | 7894 |
|
7876 |
| - <li><p>Set <var>serialized</var> to { [[Type]]: "ArrayBuffer", [[ArrayBufferData]]: |
7877 |
| - <var>dataCopy</var>, [[ArrayBufferByteLength]]: <var>size</var> }.</p></li> |
| 7895 | + <li><p>Set <var>serialized</var> to { [[Type]]: "ArrayBuffer", [[ArrayBufferData]]: |
| 7896 | + <var>dataCopy</var>, [[ArrayBufferByteLength]]: <var>size</var> }.</p></li> |
| 7897 | + </ol> |
| 7898 | + </li> |
7878 | 7899 | </ol>
|
7879 | 7900 | </li>
|
7880 | 7901 |
|
@@ -8261,11 +8282,30 @@ o.myself = o;</pre>
|
8261 | 8282 | <var>serialized</var>.[[OriginalFlags]].</p></li>
|
8262 | 8283 |
|
8263 | 8284 | <li>
|
8264 |
| - <p>Otherwise, if <var>serialized</var>.[[Type]] is "ArrayBuffer", then set <var>value</var> to a new ArrayBuffer |
8265 |
| - object in <var>targetRealm</var> whose [[ArrayBufferData]] internal slot value is |
8266 |
| - <var>serialized</var>.[[ArrayBufferData]], and whose [[ArrayBufferByteLength]] internal slot |
| 8285 | + <p>Otherwise, if <var>serialized</var>.[[Type]] is "SharedArrayBuffer", then:</p> |
| 8286 | + |
| 8287 | + <ol> |
| 8288 | + <li><p>If <var>targetRealm</var>'s <span data-x="concept-realm-settings-object">settings |
| 8289 | + object</span>'s <span>responsible event loop</span> is not in the same <span>unit of |
| 8290 | + share-within-able event loops</span> as <var>serialized</var>.[[EventLoop]], then then throw a |
| 8291 | + <span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li> |
| 8292 | + |
| 8293 | + <li><p>Otherwise, set <var>value</var> to a new SharedArrayBuffer object in |
| 8294 | + <var>targetRealm</var> whose [[ArrayBufferData]] internal slot value is |
| 8295 | + <var>serialized</var>.[[ArrayBufferData]] and whose [[ArrayBufferByteLength]] internal slot |
| 8296 | + value is <var>serialized</var>.[[ArrayBufferByteLength]].</p></li> |
| 8297 | + </ol> |
| 8298 | + </li> |
| 8299 | + |
| 8300 | + <li> |
| 8301 | + <p>Otherwise, if <var>serialized</var>.[[Type]] is "ArrayBuffer", then set <var>value</var> to a |
| 8302 | + new ArrayBuffer object in <var>targetRealm</var> whose [[ArrayBufferData]] internal slot value |
| 8303 | + is <var>serialized</var>.[[ArrayBufferData]], and whose [[ArrayBufferByteLength]] internal slot |
8267 | 8304 | value is <var>serialized</var>.[[ArrayBufferByteLength]].</p>
|
8268 | 8305 |
|
| 8306 | + <p>If this throws an exception, then throw a <span>"<code>DataCloneError</code>"</span> |
| 8307 | + <code>DOMException</code>.</p> |
| 8308 | + |
8269 | 8309 | <p class="note">This step might throw an exception if there is not enough memory available to
|
8270 | 8310 | create such an ArrayBuffer object.</p>
|
8271 | 8311 | </li>
|
@@ -8474,7 +8514,8 @@ o.myself = o;</pre>
|
8474 | 8514 | <span>[[Detached]]</span> internal slot, then throw a
|
8475 | 8515 | <span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
|
8476 | 8516 |
|
8477 |
| - <li><p>If <var>transferable</var> has an [[ArrayBufferData]] internal slot and ! |
| 8517 | + <li><p>If <var>transferable</var> has an [[ArrayBufferData]] internal slot and either ! |
| 8518 | + <span>IsSharedArrayBuffer</span>(<var>transferable</var>) is true or ! |
8478 | 8519 | <span>IsDetachedBuffer</span>(<var>transferable</var>) is true, then throw a
|
8479 | 8520 | <span>"<code>DataCloneError</code>"</span> <code>DOMException</code>.</p></li>
|
8480 | 8521 |
|
|
0 commit comments