Skip to content
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

Should we specify behavior for using objects from detached contexts? #1221

Open
mfalken opened this issue Nov 8, 2017 · 8 comments
Open

Comments

@mfalken
Copy link
Member

mfalken commented Nov 8, 2017

Chromium has some tests which I'm looking to upstream to WPT that do something like:

var registration = iframe.contentWindow.getRegistration(...);
iframe.remove();
registration.unregister();  // expect InvalidStateError

Or

var worker = frame.contentWindow.navigator.serviceWorker.controller;
frame.remove();
worker.postMessage('');  // expect InvalidStateError

I was just going to upstream them, but discovered we originally didn't plan to make these WPT tests because the spec doesn't specify behavior for these detached window cases.

Should the spec specify behavior for these? Any concerns if we just upstream them as WPT tests now even if there might not be spec text?

@wanderview
Copy link
Member

I doubt we are aligned here yet, but it would be good to do so. I would say land the test with a comment that clarifies this is currently underspecified and there is room for improvement. We can then iterate on the test.

@mfalken
Copy link
Member Author

mfalken commented Nov 9, 2017

Upstreamed as detached-context.https.html

https://chromium-review.googlesource.com/c/chromium/src/+/759136

@wanderview
Copy link
Member

Thanks for landing the test. It seems it touches on a somewhat contentious bit of the promise spec, though. Apparently chrome calls resolve()/reject() callbacks when the promise's owning global is detached, but firefox does not. This make the check for promise rejection timeout in firefox:

https://github.com/w3c/web-platform-tests/blob/master/service-workers/service-worker/detached-context.https.html#L44

@mattto Would you be ok if we loosened this part of the check somehow?

@wanderview
Copy link
Member

See:

whatwg/html#2087
whatwg/html#2621

@mfalken
Copy link
Member Author

mfalken commented Feb 8, 2018 via email

@wanderview
Copy link
Member

I was thinking we could make the test verify that update() and unregister() don't resolve, but not require them to reject. We could use the "register and activate another dummy scope" to determine how long to wait before declaring that they successfully did not resolve.

@wanderview
Copy link
Member

I'm going to fix this in gecko and then uplift since ./wpt serve is not working for me today.

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

@wanderview
Copy link
Member

The update to detached-context.https.html to avoid the explicit check for promise rejection has landed upstream in:

web-platform-tests/wpt#9485

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants