New issue
Advanced search Search tips

Issue 897927 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug



Sign in to add a comment

Disallow execution of functions created by a detached context

Project Member Reported by dcheng@chromium.org, Oct 22

Issue description

We should experiment with disallowing execution of functions created by a context which is detached. Based on the attached test case, the current behavior between different browsers is:

- Edge: disallows
- Firefox: allows
- Chrome: allows

having this would be nice for two reasons:
- it would enable us to more aggressively prune memory for navigated contexts
- it would let us be consistent about how to treat microtasks in a detached context. otherwise, it could result in strange behavior where executing an async function would never complete (if we dropped microtasks).

Though now that I think about this more... if we execute an async function on a detached context today... does that work?
 
detached-context-test.html
928 bytes View Download
Behaviors on detached contexts are already inconsistent in many ways. Many DOM access stops working, callback functions / interfaces stop running etc etc. The behaviors are inconsistent among user agents.

I'd suggest just making the change and seeing how it goes :)

verwaest: Would you mind creating a CL that forbids calling functions on detached contexts? (If you're busy, the binding team is happy about sending intent-to-intervention, running Finch etc.)

Re: #1 yeah, I was surprised by this yesterday on https://chromium-review.googlesource.com/c/chromium/src/+/1288674/3 -- a promise rejected after the associated context is already detached never invokes its reject handler.
Toon: Would you mind creating a V8 side patch to throw an exception when a function is going to be executed on a detached global window?

I want to send it to Finch and see how it goes.


Cc: -verwa...@chromium.org
Owner: verwa...@chromium.org
Status: Assigned (was: Untriaged)
I don't have cycles for this right now, but I'll get back to this in Q1.

Sign in to add a comment