From 05a6622ba5ebce3b97e87e21bf984660b6f4d13b Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 11:29:15 -0400 Subject: [PATCH 1/9] Clarify that this is not available in parallel --- source | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/source b/source index ba560b1db50..d571b1e1723 100644 --- a/source +++ b/source @@ -114019,10 +114019,13 @@ import "https://example.com/foo/../module2.mjs";

The next complication is that, in algorithm sections that are in parallel, you must not create or manipulate objects associated to a specific realm, global, or environment settings object. (Stated in more - familiar terms, you must not directly access main-thread artifacts from a background thread.) - Doing so would create data races observable to JavaScript code, since after all, your algorithm - steps are running in parallel to the JavaScript code.

+ data-x="global object">global, or environment settings object. By extension, + you cannot access Web IDL's this value from steps running in parallel, + even if those steps were activated by an algorithm that does have access to the + this value. (Stated in more familiar terms, you must not directly access main-thread + artifacts from a background thread.) Doing so would create data races observable to JavaScript + code, since after all, your algorithm steps are running in parallel to the + JavaScript code.

You can, however, manipulate specification-level data structures and values from Infra, as those are realm-agnostic. They are never directly exposed to JavaScript without From 1a7990daaa88cae3f355d47c97d05c797131ddb3 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 12:06:17 -0400 Subject: [PATCH 2/9] Update offscreen canvas case --- source | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/source b/source index d571b1e1723..81e9a2954bd 100644 --- a/source +++ b/source @@ -72160,6 +72160,8 @@ interface OffscreenCanvas : EventTarget {

  • Let result be a new promise object.

  • +
  • Let offscreenCanvas be this.

  • +
  • Run these steps in parallel:

    @@ -72171,15 +72173,15 @@ interface OffscreenCanvas : EventTarget {
  • Queue a global task on the canvas blob serialization task source - given this's relevant global object to run these steps:

    + given offscreenCanvas's relevant global object to run these steps:

    1. If file is null, then reject result with an "EncodingError" DOMException.

    2. Otherwise, resolve result with a new Blob object, created in - this's relevant realm, representing - file. FILEAPI

    3. + offscreenCanvas's relevant realm, + representing file. FILEAPI

  • From 25926d44d5a39afb5fa62f508c3d293fbe175b0f Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 17:34:37 -0400 Subject: [PATCH 3/9] Fix explicit example --- source | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source b/source index 81e9a2954bd..80261ebfd0e 100644 --- a/source +++ b/source @@ -1637,14 +1637,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • Let p be a new promise created in this's relevant realm.

  • +
  • Let global be this's relevant global + object.

  • +
  • Run the following steps in parallel:

    1. If nameList contains name, then queue a global task on the DOM manipulation task source given - this's relevant global object to reject p with a - TypeError, and abort these steps.

    2. + global to reject p with a TypeError, and abort these + steps.

    3. Do some potentially lengthy work.

    4. @@ -1652,8 +1655,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute nameList.

    5. Queue a global task on the DOM manipulation task source - given this's relevant global object to resolve p with - undefined.

    6. + given global to resolve p with undefined.

  • @@ -1671,14 +1673,17 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
  • Let p be a new promise created in this's relevant realm.

  • +
  • Let global be this's relevant global + object.

  • +
  • Enqueue the following steps to nameListQueue:

    1. If nameList contains name, then queue a global task on the DOM manipulation task source given - this's relevant global object to reject p with a - TypeError, and abort these steps.

    2. + global to reject p with a TypeError, and abort these + steps.

    3. Do some potentially lengthy work.

    4. @@ -1686,8 +1691,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute nameList.

    5. Queue a global task on the DOM manipulation task source - given this's relevant global object to resolve p with - undefined.

    6. + given global to resolve p with undefined.

  • From d04591e198ce96ed1aa0ce817029dbb78c3f6d6b Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 17:42:11 -0400 Subject: [PATCH 4/9] Fix addModule() --- source | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/source b/source index 80261ebfd0e..2824c60490f 100644 --- a/source +++ b/source @@ -123960,20 +123960,22 @@ dictionary WorkletOptions {
  • Let promise be a new promise.

  • +
  • Let workletInstance be this.

  • +
  • Run the following steps in parallel:

    1. -

      If this's global scopes - is empty, then:

      +

      If workletInstance's global + scopes is empty, then:

        -
      1. Create a worklet global scope given this.

      2. +
      3. Create a worklet global scope given workletInstance.

      4. Optionally, create additional - global scope instances given this, depending on the specific worklet in question - and its specification.

      5. + global scope instances given workletInstance, depending on the specific worklet in + question and its specification.

      6. Wait for all steps of the creation process(es) — including those taking place within the worklet @@ -123981,7 +123983,7 @@ dictionary WorkletOptions {

    2. -
    3. Let pendingTasks be this's

      Let pendingTasks be workletInstance's global scopes's size.

    4. @@ -123989,19 +123991,19 @@ dictionary WorkletOptions {
    5. For each workletGlobalScope of - this's global scopes, - queue a global task on the networking task source given - workletGlobalScope to fetch a worklet script graph given - moduleURLRecord, outsideSettings, this's worklet - destination type, options["workletInstance's global + scopes, queue a global task on the networking task source + given workletGlobalScope to fetch a worklet script graph given + moduleURLRecord, outsideSettings, workletInstance's + worklet destination type, options["credentials"], workletGlobalScope's - relevant settings object, this's relevant settings object, workletInstance's module responses map, and the following steps given script:

      Only the first of these fetches will actually perform a network request; the ones for other WorkletGlobalScopes will reuse responses from this's responses from workletInstance's module responses map.

        @@ -124011,7 +124013,7 @@ dictionary WorkletOptions {
        1. Queue a global task on the networking task source given - this's relevant global object to perform the following + workletInstance's relevant global object to perform the following steps:

            @@ -124039,7 +124041,7 @@ dictionary WorkletOptions {
            1. Queue a global task on the networking task source given - this's relevant global object to perform the following + workletInstance's relevant global object to perform the following steps:

                @@ -124065,8 +124067,8 @@ dictionary WorkletOptions {
                1. Append moduleURLRecord to - this's added modules - list.

                2. + workletInstance's added + modules list.

                3. Set addedSuccessfully to true.

                @@ -124076,7 +124078,7 @@ dictionary WorkletOptions {
              1. Queue a global task on the - networking task source given this's relevant global + networking task source given workletInstance's relevant global object to perform the following steps:

                  From b2895d7ca1edfd05feb7f008d7e8281553f16efa Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 17:52:59 -0400 Subject: [PATCH 5/9] fmt --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 2824c60490f..49f15ee8605 100644 --- a/source +++ b/source @@ -1654,8 +1654,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
                1. Append name to nameList.

                2. -
                3. Queue a global task on the DOM manipulation task source - given global to resolve p with undefined.

                4. +
                5. Queue a global task on the DOM manipulation task source given + global to resolve p with undefined.

              2. From 3ea3f91397202f9bf5e9a0d32fad4ed25aae613e Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 17:55:50 -0400 Subject: [PATCH 6/9] More wrapping --- source | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source b/source index 49f15ee8605..5ae5d18d8c4 100644 --- a/source +++ b/source @@ -1690,8 +1690,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
              3. Append name to nameList.

              4. -
              5. Queue a global task on the DOM manipulation task source - given global to resolve p with undefined.

              6. +
              7. Queue a global task on the DOM manipulation task source given + global to resolve p with undefined.

            2. From 30d2af194dc8d4711e7da54c09205c7032e36967 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Wed, 12 Mar 2025 17:58:55 -0400 Subject: [PATCH 7/9] Last wrap --- source | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source b/source index 5ae5d18d8c4..837614f7bde 100644 --- a/source +++ b/source @@ -124077,9 +124077,9 @@ dictionary WorkletOptions {
            3. Run a module script given script.

            4. -

              Queue a global task on the - networking task source given workletInstance's relevant global - object to perform the following steps:

              +

              Queue a global task on the networking task source given + workletInstance's relevant global object to perform the following + steps:

              1. From 7f42de7b32706f58b7f8e1ba173e3b8ab00a5ad7 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Thu, 13 Mar 2025 17:45:47 -0400 Subject: [PATCH 8/9] Global vs offscreenCanvas --- source | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source b/source index 837614f7bde..62738c2e1c8 100644 --- a/source +++ b/source @@ -72164,7 +72164,7 @@ interface OffscreenCanvas : EventTarget {
              2. Let result be a new promise object.

              3. -
              4. Let offscreenCanvas be this.

              5. +
              6. Let global be this's relevant global object.

              7. Run these steps in parallel:

                @@ -72177,15 +72177,15 @@ interface OffscreenCanvas : EventTarget {
              8. Queue a global task on the canvas blob serialization task source - given offscreenCanvas's relevant global object to run these steps:

                + given global to run these steps:

                1. If file is null, then reject result with an "EncodingError" DOMException.

                2. Otherwise, resolve result with a new Blob object, created in - offscreenCanvas's relevant realm, - representing file. FILEAPI

                3. + global's relevant realm, representing + file. FILEAPI

              From fa7212b720030d438ec1486bc1bf56a3cd512622 Mon Sep 17 00:00:00 2001 From: Dominic Farolino Date: Thu, 13 Mar 2025 17:50:17 -0400 Subject: [PATCH 9/9] New paragraph --- source | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/source b/source index 62738c2e1c8..1563e37ac83 100644 --- a/source +++ b/source @@ -114025,13 +114025,14 @@ import "https://example.com/foo/../module2.mjs";

              The next complication is that, in algorithm sections that are in parallel, you must not create or manipulate objects associated to a specific realm, global, or environment settings object. By extension, - you cannot access Web IDL's this value from steps running in parallel, - even if those steps were activated by an algorithm that does have access to the - this value. (Stated in more familiar terms, you must not directly access main-thread - artifacts from a background thread.) Doing so would create data races observable to JavaScript - code, since after all, your algorithm steps are running in parallel to the - JavaScript code.

              + data-x="global object">global, or environment settings object. (Stated in more + familiar terms, you must not directly access main-thread artifacts from a background thread.) + Doing so would create data races observable to JavaScript code, since after all, your algorithm + steps are running in parallel to the JavaScript code.

              + +

              By extension, you cannot access Web IDL's this value from steps running in + parallel, even if those steps were activated by an algorithm that does have access + to the this value.

              You can, however, manipulate specification-level data structures and values from Infra, as those are realm-agnostic. They are never directly exposed to JavaScript without