Summary:

This feature allows developers to create weak references to JavaScript objects. 
 Finalizers are also provided that allow developers to perform actions when an 
object is garbage collected, without keeping that object alive.

This is an advanced feature that is not expected to be widely used but is 
necessary for some use important use cases such as exposing WebAssembly memory 
to JavaScript.

Bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=1561074

Standard:

Proposal: https://github.com/tc39/proposal-weakrefs
JS spec changes: https://tc39.es/proposal-weakrefs/
HTML spec changes: https://github.com/whatwg/html/pull/4571

The proposal is at stage 3.

Platform coverage:

This is a new JavaScript language feature and will be available in all contexts.

Preference:

This feature will be controlled by the javascript.options.weakrefs pref, which 
will be off by default.

DevTools bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=1589707

Other browsers:

  Chrome: implemented behind a flag
  Safari: believed to have an implementation

web-platform-tests:

There are test262 tests covering this feature:

https://github.com/tc39/test262/tree/master/test/built-ins/WeakRef
https://github.com/tc39/test262/tree/master/test/built-ins/FinalizationGroup

Web platform tests will be added in the following bug:

https://bugzilla.mozilla.org/show_bug.cgi?id=1589714

Secure contexts: 

This is a JS language feature and is thus present in all contexts where scripts 
are executed.

Is this feature enabled by default in sandboxed iframes? If not, is there a 
proposed sandbox flag to enable it? If allowed, does it preserve the current 
invariants in terms of what sandboxed iframes can do?

Where enabled, this feature will be allowed by default in sandboxed iframes. It 
does not change the invariants in terms of what sandboxed iframes can do.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform

Reply via email to