-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Normative: Propagate active ScriptOrModule with JobCallback Record #3195
base: main
Are you sure you want to change the base?
Conversation
4ba7b72
to
4b17b46
Compare
This should be discussed together with #3160 — we should move towards less dynamic scoping, not more. |
Updated the example moving away from indirect eval. HTML propagates incumbent settings with HostMakeJobCallback and this should be aligned with ecma262 notes. |
1. Set the ScriptOrModule of _jobContext_ to _scriptOrModule_. | ||
1. Perform any necessary implementation-defined initialization of _jobContext_. | ||
1. Let _result_ be Completion(Call(_jobCallback_.[[Callback]], _V_, _argumentsList_)). | ||
1. Remove _jobContext_ from the execution context stack and restore _callerContext_ as the running execution context. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In #2962, we change this phrasing. Depending on the order these land, the latter PR will need to account for the former.
Otherwise LGTM editorially. |
HTML HostEnqueuePromiseJob doesn't follow the requirements of ecma262 HostEnqueuePromiseJob as ecma262 defines that
However, HTML spec defines that the active ScriptOrModule is saved at the time of HostMakeJobCallback is invoked rather than at the time of HostEnqueuePromiseJob is invoked. The two host hooks are invoked with the same active script or module consecutively.
Update the steps of HostMakeJobCallback, HostCallJobCallback, and HostEnqueuePromiseJob to fix the inconsistency between ecma262 and the HTML spec.
This change also mandates that the active scripts are propagated through promise jobs and FinalizationRegistry cleanup callbacks. For example, the following example uses the original script's incumbent document URL appropriately.
This proposed behavior exists in the HTML spec since HTML HostMakeJobCallback already propagates the active script. This PR fixes the inconsistent requirement on ecma262 HostEnqueuePromiseJob and HTML HostMakeJobCallback.