From 5aa77835b00b34365281945002bf1b7bd6dc2266 Mon Sep 17 00:00:00 2001
From: Daniel Ehrenberg Users agents that support JavaScript must also implement ECMAScript
+ Internationalization API. User agents that support JavaScript must also implement the BigInt proposal. User agents that support JavaScript must also implement the WeakRef proposal.
+ The following terms are defined there, and used in this specification: .
+
+ WebAssembly.Module
+
+
@@ -90505,6 +90523,41 @@ import "https://example.com/foo/../module2.mjs";
data-x="concept-script-record">record.FinalizationGroup classWeakRef class
The WeakRef proposal allows JavaScript to register objects with
+ FinalizationGroups, in order to schedule a cleanup action if they are found
+ to be unreachable by the garbage collector.
The timing and occurrence cleanup work is implementation-defined. UAs may differ in
+ when and whether an object is garbage collected, affecting both whether WeakRefs
+ become undefined, and whether FinalizationGroup cleanup callbacks occur. There are
+ well-known cases in popular web browsers where objects are not accessible to JavaScript but
+ remain retained by the garbage collector indefinitely. Authors should not depend on the
+ timing details of garbage collection implementations.
Cleanup actions taken by the WeakRef proposal do not take place interspersed
+ with synchronous JavaScript execution, but rather happen in queued tasks. This includes
+ both calling FinalizationGroup cleanup callbacks as well as letting the result of
+ dereferencing a WeakRef to change from an object to undefined. This section
+ defines the scheduling of those cleanup actions.
When there is a FinalizationGroup fg such that
+ CheckForEmptyCells(fg) is true, the user agent may
+ queue a task to perform FinalizationGroupCleanup(fg).
When there is an agent agent such that agent.[[KeptAlive]] + is not empty, the user agent may queue a task to perform + ClearKeptObjects(agent).
+ +The task source for any tasks that are queued in this section is the garbage collection task + source.
+Cleanup actions taken by the WeakRef proposal do not take place interspersed
- with synchronous JavaScript execution, but rather happen in queued tasks. This includes
- both calling FinalizationGroup cleanup callbacks as well as letting the result of
- dereferencing a WeakRef to change from an object to undefined. This section
- defines the scheduling of those cleanup actions.
FinalizationGroup
+ cleanup callbacks as well as letting the result of dereferencing a WeakRef to
+ change from an object to undefined. This section defines the scheduling of those cleanup
+ actions.
When there is a The WeakRef proposal allows JavaScript to register objects with
- The timing and occurrence cleanup work is implementation-defined. UAs may differ in
- when and whether an object is garbage collected, affecting both whether The timing and occurrence cleanup work is implementation-defined. User agents may differ in
+ when and whether an object is garbage collected, affecting both whether the return value of the
+ Cleanup actions taken by the WeakRef proposal do not take place interspersed
with synchronous JavaScript execution, but rather happen in queued
Date: Tue, 30 Apr 2019 17:22:09 +0200
Subject: [PATCH 04/23] Move WeakRef processing logic back to the WeakRef
specification
The role of HTML here is strictly limited to being a task scheduling
service for JavaScript.
---
source | 33 +++++++++++++++++++++++++--------
1 file changed, 25 insertions(+), 8 deletions(-)
diff --git a/source b/source
index e23f195f836..305877c8ef8 100644
--- a/source
+++ b/source
@@ -2876,10 +2876,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
The following terms are defined there, and used in this specification: .FinalizationGroup fg such that
CheckForEmptyCells(fg) is true, the user agent may
From 979b9fb32ec3fe375d8c7e043d56d218cc65d291 Mon Sep 17 00:00:00 2001
From: Daniel Ehrenberg FinalizationGroup classWeakRef classWeakRef.prototype.deref() methodIntegration with WeakRefs and FinalizationGroups
FinalizationGroups, in order to schedule a cleanup action if they are found
+ FinalizationGroup objects, in order to schedule a cleanup action if they are found
to be unreachable by the garbage collector. WeakRefs
- become undefined, and whether FinalizationGroup cleanup callbacks occur. There are
- well-known cases in popular web browsers where objects are not accessible to JavaScript but
- remain retained by the garbage collector indefinitely. Authors should not depend on the
- timing details of garbage collection implementations.WeakRef.prototype.deref() method is undefined, and whether
+ FinalizationGroup cleanup callbacks occur. There are well-known cases in popular web
+ browsers where objects are not accessible to JavaScript, but they remain retained by the garbage
+ collector indefinitely. Authors should not depend on the timing details of garbage collection
+ implementations.
-
@@ -90545,18 +90546,34 @@ import "https://example.com/foo/../module2.mjs";
change from an object to undefined. This section defines the scheduling of those cleanup
actions.FinalizationGroup classWeakRef classWeakRef.prototype.deref() method
When there is a FinalizationGroup fg such that
- CheckForEmptyCells(fg) is true, the user agent may
- queue a task to perform FinalizationGroupCleanup(fg).
When there is an agent agent such that agent.[[KeptAlive]] - is not empty, the user agent may queue a task to perform - ClearKeptObjects(agent).
+The WeakRef proposal contains an implementation-defined + HostClearKeptObjects(agent) + abstract operation. User agents must use the + following implementation:
+ +Queue a task on the garbage collection task source to perform + ClearKeptObjects(agent).
The WeakRef proposal contains an implementation-defined + HostCleanupFinalizationGroup(finalizationGroup) abstract operation. + User agents must use the following implementation:
+ +Queue a task on the garbage collection task source to perform + CleanupFinalizationGroup(finalizationGroup).
The task source for any tasks that are queued in this section is the garbage collection task source.
From 37de0137683bb58180721d6097c1dc3784c2f1bc Mon Sep 17 00:00:00 2001 From: Daniel EhrenbergFinalizationGroup classWeakRef classWeakRef.prototype.deref() methodCleanup actions taken by the WeakRef proposal do not take place interspersed
with synchronous JavaScript execution, but rather happen in queued tasks. This includes both calling FinalizationGroup
- cleanup callbacks as well as letting the result of dereferencing a WeakRef to
- change from an object to undefined. This section defines the scheduling of those cleanup
- actions.
The WeakRef proposal contains an implementation-defined - HostClearKeptObjects(agent) - abstract operation. User agents must use the - following implementation:
- -Queue a task on the garbage collection task source to perform - ClearKeptObjects(agent).
FinalizationGroup cleanup callbacks.
Cleanup Indexed Database transactions.
Perform ClearKeptObjects().
Set the event loop's performing a microtask checkpoint to false.
Queue a task on the garbage collection task source to perform - CleanupFinalizationGroup(finalizationGroup).
The task source for any tasks that are Date: Mon, 20 May 2019 13:50:03 +0200 Subject: [PATCH 07/23] Clean up definition of garbage collection task source --- source | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/source b/source index ede8e7b59c4..52348b5d47f 100644 --- a/source +++ b/source @@ -90551,15 +90551,11 @@ import "https://example.com/foo/../module2.mjs"; User agents must use the following implementation:
Queue a task on the garbage collection task source to perform +
Queue a task on the garbage collection task source to perform CleanupFinalizationGroup(finalizationGroup). If this throws an exception, catch it, and report the exception.
The task source for any tasks that are queued in this section is the garbage collection task - source.
-Queue a task on the garbage collection task source to perform - CleanupFinalizationGroup(finalizationGroup). If this throws an exception, - catch it, and report the exception.
Queue a task on the garbage collection task source to perform the + following step:
+Perform ? CleanupFinalizationGroup(finalizationGroup).
+If this throws an exception, catch it, and report the exception.
+FinalizationGroup classFinalizationRegistry classWeakRef classWeakRef.prototype.deref() methodThe WeakRef proposal allows JavaScript to register objects with
- FinalizationGroup objects, in order to schedule a cleanup action if they are found
+ FinalizationRegistry objects, in order to schedule a cleanup action if they are found
to be unreachable by the garbage collector.
The timing and occurrence cleanup work is implementation-defined. User agents may differ in
when and whether an object is garbage collected, affecting both whether the return value of the
WeakRef.prototype.deref() method is undefined, and whether
- FinalizationGroup cleanup callbacks occur. There are well-known cases in popular web
+ FinalizationRegistry cleanup callbacks occur. There are well-known cases in popular web
browsers where objects are not accessible to JavaScript, but they remain retained by the garbage
collector indefinitely. Authors should not depend on the timing details of garbage collection
implementations.
Cleanup actions taken by the WeakRef proposal do not take place interspersed
with synchronous JavaScript execution, but rather happen in queued tasks. This section defines the scheduling of calling
- FinalizationGroup cleanup callbacks.
FinalizationRegistry cleanup callbacks.
- The WeakRef proposal contains an implementation-defined - HostCleanupFinalizationGroup(finalizationGroup) abstract operation. + HostCleanupFinalizationRegistry(finalizationRegistry) abstract operation. User agents must use the following implementation:
Perform ? CleanupFinalizationGroup(finalizationGroup).
+Perform ? CleanupFinalizationRegistry(finalizationRegistry).
If this throws an exception, catch it, and report the exception.
Users agents that support JavaScript must also implement ECMAScript Internationalization API.
-User agents that support JavaScript must also implement the BigInt proposal.
-User agents that support JavaScript must also implement the WeakRef proposal. The following terms are defined there, and used in this specification: .
FinalizationRegistry classWeakRef classWeakRef.prototype.deref() methodFinalizationRegistry classFinalizationRegistry.prototype.cleanupSome() methodWeakRef classWeakRef.prototype.deref() methodUser agents must omit the normative but optional
+ FinalizationRegistry.prototype.cleanupSome() method.
Issue #5446 investigates
+ under what conditions FinalizationRegistry.prototype.cleanupSome() may be supported
+ in HTML user agents, if at all.
FinalizationRegistry objects, in order to schedule a cleanup action if they are found
to be unreachable by the garbage collector.
- The timing and occurrence cleanup work is implementation-defined. User agents may differ in
- when and whether an object is garbage collected, affecting both whether the return value of the
- WeakRef.prototype.deref() method is undefined, and whether
- FinalizationRegistry cleanup callbacks occur. There are well-known cases in popular web
- browsers where objects are not accessible to JavaScript, but they remain retained by the garbage
- collector indefinitely. Authors should not depend on the timing details of garbage collection
- implementations.
The timing and occurrence of cleanup work is implementation-defined. User agents
+ may differ in when and whether an object is garbage collected, affecting both whether the return
+ value of the WeakRef.prototype.deref() method is undefined, and whether
+ FinalizationRegistry cleanup callbacks occur. There are well-known cases in popular
+ web browsers where objects are not accessible to JavaScript, but they remain retained by the
+ garbage collector indefinitely. Authors should not depend on the timing details of garbage
+ collection implementations.
Cleanup actions taken by the WeakRef proposal do not take place interspersed
with synchronous JavaScript execution, but rather happen in queued
The WeakRef proposal contains an implementation-defined
+ The WeakRef proposal contains an implementation-defined
HostCleanupFinalizationRegistry(finalizationRegistry) abstract operation.
User agents must use the following implementation: Queue a task on the garbage collection task source to perform the
- following step:HostCleanupFinalizationRegistry(finalizationRegistry)
-
Perform ? CleanupFinalizationRegistry(finalizationRegistry).
-If this throws an exception, catch it, and report the exception.
+Let entry be finalizationGroup.[[CleanupCallback]].[[Realm]]'s + environment settings object.
+Check if we can run script with entry. If this returns + "do not run", then return.
+Prepare to run script with entry.
+ +This affects the entry concept + while the cleanup callback runs.
+Let incumbent be some appropriate environment settings object.
+ +It is not yet clear how to specify the environment settings + object that should be used here. In practice, this means that the incumbent concept is not correctly specified + while executing a cleanup callback. See discussion in pull + request #4571.
+Prepare to run a callback with incumbent.
+Let result be the result of performing + CleanupFinalizationRegistry(finalizationRegistry).
+Clean up after running a callback with incumbent.
+Clean up after running script with entry.
+If result is an abrupt completion, then report the + exception given by result.[[Value]].
Let entry be finalizationGroup.[[CleanupCallback]].[[Realm]]'s +
Let entry be finalizationRegistry.[[CleanupCallback]].[[Realm]]'s environment settings object.
Issue #5446 investigates
under what conditions FinalizationRegistry.prototype.cleanupSome() may be supported
- in HTML user agents, if at all.
Atomics objectDate classFinalizationRegistry classRegExp classSharedArrayBuffer classTypeError classRangeError classWeakRef classeval() functionWeakRef.prototype.deref() functionimport()import.metaWebAssembly.ModuleUsers agents that support JavaScript must also implement ECMAScript - Internationalization API.
- -User agents that support JavaScript must also implement the WeakRef proposal. - The following terms are defined there, and used in this specification: .
- -FinalizationRegistry classFinalizationRegistry.prototype.cleanupSome() methodWeakRef classWeakRef.prototype.deref() methodThe WeakRef proposal allows JavaScript to register objects with
FinalizationRegistry objects, in order to schedule a cleanup action if they are found
- to be unreachable by the garbage collector.
The timing and occurrence of cleanup work is implementation-defined. User agents may differ in when and whether an object is garbage collected, affecting both whether the return @@ -122898,9 +122887,6 @@ INSERT INTERFACES HERE
FinalizationRegistry cleanup callbacks.
- The WeakRef proposal contains an implementation-defined - HostCleanupFinalizationRegistry(finalizationRegistry) abstract operation. - User agents must use the following implementation:
+The WeakRef proposal contains an implementation-defined HostEnqueueFinalizationRegistryCleanupJob(finalizationRegistry) abstract operation. User agents must use the following + implementation:
Queue a task on the garbage collection task source to perform the +
Queue a task on the JavaScript engine task source to perform the following steps:
Let entry be finalizationRegistry.[[CleanupCallback]].[[Realm]]'s +
Let entry be finalizationRegistry.[[CleanupCallback]].[[Callback]].[[Realm]]'s environment settings object.
Let incumbent be some appropriate environment settings object.
- -It is not yet clear how to specify the environment settings - object that should be used here. In practice, this means that the incumbent concept is not correctly specified - while executing a cleanup callback. See discussion in pull - request #4571.
-Prepare to run a callback with incumbent.
-Let result be the result of performing CleanupFinalizationRegistry(finalizationRegistry).
Clean up after running a callback with incumbent.
-Clean up after running script with entry.
User agents must omit the normative but optional
- FinalizationRegistry.prototype.cleanupSome() method.
Issue #5446 investigates
- under what conditions FinalizationRegistry.prototype.cleanupSome() may be supported
- in user agents, if at all.
Return result.
JavaScript has the ability to register objects with FinalizationRegistry objects,
+ in order to schedule a cleanup action if they are found to be garbage collected. The JavaScript
+ specification contains an implementation-defined HostEnqueueFinalizationRegistryCleanupJob(finalizationRegistry)
+ abstract operation to schedule the cleanup action.
The timing and occurrence of cleanup work is implementation-defined
+ in the JavaScript specification. User agents might differ in when and whether an object is garbage
+ collected, affecting both whether the return value of the WeakRef.prototype.deref()
+ method is undefined, and whether FinalizationRegistry cleanup callbacks occur. There
+ are well-known cases in popular web browsers where objects are not accessible to JavaScript, but
+ they remain retained by the garbage collector indefinitely. Authors should not
+ depend on the timing details of garbage collection implementations.
Cleanup actions do not take place interspersed with synchronous JavaScript execution, but + rather happen in queued tasks. User agents must use the + following implementation:
+ +Let global be finalizationRegistry.[[Realm]]'s global object.
+Queue a global task on the JavaScript engine task source given + global to perform the following steps:
+ +Let entry be finalizationRegistry.[[CleanupCallback]].[[Callback]].[[Realm]]'s + environment settings object.
+Check if we can run script with entry. If this returns + "do not run", then return.
+Prepare to run script with entry.
+ +This affects the entry concept + while the cleanup callback runs.
+Let result be the result of performing + CleanupFinalizationRegistry(finalizationRegistry).
+Clean up after running script with entry.
+If result is an abrupt completion, then report the + exception given by result.[[Value]].
+The JavaScript specification defines a syntax for modules, as well as some host-agnostic parts @@ -90511,71 +90577,6 @@ import "https://example.com/foo/../module2.mjs"; data-x="concept-script-record">record.
-The WeakRef proposal allows JavaScript to register objects with
- FinalizationRegistry objects, in order to schedule a cleanup action if they are found
- to be unreachable by the garbage collector.
The timing and occurrence of cleanup work is implementation-defined. User agents
- may differ in when and whether an object is garbage collected, affecting both whether the return
- value of the WeakRef.prototype.deref() method is undefined, and whether
- FinalizationRegistry cleanup callbacks occur. There are well-known cases in popular
- web browsers where objects are not accessible to JavaScript, but they remain retained by the
- garbage collector indefinitely. Authors should not depend on the timing details of garbage
- collection implementations.
Cleanup actions taken by the WeakRef proposal do not take place interspersed
- with synchronous JavaScript execution, but rather happen in queued tasks. This section defines the scheduling of calling
- FinalizationRegistry cleanup callbacks.
The WeakRef proposal contains an implementation-defined HostEnqueueFinalizationRegistryCleanupJob(finalizationRegistry) abstract operation. User agents must use the following - implementation:
- -Queue a task on the JavaScript engine task source to perform the - following steps:
-Let entry be finalizationRegistry.[[CleanupCallback]].[[Callback]].[[Realm]]'s - environment settings object.
-Check if we can run script with entry. If this returns - "do not run", then return.
-Prepare to run script with entry.
- -This affects the entry concept - while the cleanup callback runs.
-Let result be the result of performing - CleanupFinalizationRegistry(finalizationRegistry).
-Clean up after running script with entry.
-If result is an abrupt completion, then report the - exception given by result.[[Value]].
-WeakRef.prototype.deref()
method is undefined, and whether FinalizationRegistry cleanup callbacks occur. There
are well-known cases in popular web browsers where objects are not accessible to JavaScript, but
- they remain retained by the garbage collector indefinitely. Authors should not
- depend on the timing details of garbage collection implementations.
+ they remain retained by the garbage collector indefinitely. HTML clears kept-alive
+ WeakRef objects in the perform a microtask checkpoint algorithm. Authors
+ should not depend on the timing details of garbage collection
+ implementations.
Cleanup actions do not take place interspersed with synchronous JavaScript execution, but rather happen in queued tasks. User agents must use the @@ -91140,7 +91142,12 @@ import "https://example.com/foo/../module2.mjs";
Cleanup Indexed Database transactions.
Perform ClearKeptObjects().
Perform ClearKeptObjects().
+ +When WeakRef.prototype.deref() returns an object, that object is
+ kept alive until the next invocation of ClearKeptObjects().
Set the event loop's performing a microtask checkpoint to false.
Perform ClearKeptObjects().
When WeakRef.prototype.deref() returns an object, that object is
- kept alive until the next invocation of ClearKeptObjects().
Set the event loop's performing a microtask checkpoint to
From f7041ef3ad24d2e865be6ddd5f9bd641d2015893 Mon Sep 17 00:00:00 2001
From: Shu-yu Guo
FinalizationRegistry callbacks by saving the
+ incumbent settings object and a JavaScript execution context for the
+ active script. User agents must use the following implementation:
Let incumbent settings be the incumbent settings object.
FinalizationRegistry callbacks by saving and
+ restoring the incumbent settings object and a JavaScript execution
+ context for the active script in JobCallbacks. This section defines them for
+ user agent hosts.
JavaScript contains an implementation-defined HostCallJobCallback(callback, V, argumentsList) abstract operation to let hosts restore state when invoking JavaScript - callbacks from inside tasks. HTML restores the incumbent settings object and the - active script. User agents must use the following implementation:
WeakRef objects in the perform a microtask checkpoint algorithm. Authors
- should not depend on the timing details of garbage collection
- implementations.
+ would be best off not depending on the timing details of garbage collection implementations.
Cleanup actions do not take place interspersed with synchronous JavaScript execution, but rather happen in queued tasks. User agents must use the @@ -90197,11 +90200,7 @@ dictionary PromiseRejectionEventInit : EventInit {
JavaScript contains an implementation-defined HostMakeJobCallback(callable) abstract operation
to let hosts attach state to JavaScript callbacks that are called from inside tasks. HTML tracks the incumbent settings
- object in promises and FinalizationRegistry callbacks by saving the
- incumbent settings object and a JavaScript execution context for the
- active script. User agents must use the following implementation: tasks. User agents must use the following implementation:
Let global be finalizationRegistry.[[Realm]]'s global object.
-Let global be finalizationRegistry.[[Realm]]'s global + object.
Queue a global task on the JavaScript engine task source given global to perform the following steps:
Let entry be finalizationRegistry.[[CleanupCallback]].[[Callback]].[[Realm]]'s - environment settings object.
-Let entry be + finalizationRegistry.[[CleanupCallback]].[[Callback]].[[Realm]]'s environment settings object.
Check if we can run script with entry. If this returns - "do not run", then return.
-Check if we can run script with entry. If this returns "do not + run", then return.
Prepare to run script with entry.
@@ -90109,19 +90105,13 @@ dictionary PromiseRejectionEventInit : EventInit { while the cleanup callback runs.Let result be the result of performing - CleanupFinalizationRegistry(finalizationRegistry).
-Let result be the result of performing + CleanupFinalizationRegistry(finalizationRegistry).
Clean up after running script with entry.
-Clean up after running script with entry.
If result is an abrupt completion, then report the - exception given by result.[[Value]].
-If result is an abrupt completion, then report the + exception given by result.[[Value]].