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

Worker: Don't touch SharedWorkerClient when a connecting document may get destroyed #16841

Merged
merged 1 commit into from May 16, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
28 changes: 28 additions & 0 deletions workers/SharedWorker-detach-frame-in-error-event.html
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<title>Test frame detach in shared worker's error handler</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<body>
<iframe id="frame"></iframe>
</body>
<script>
promise_test(t => {
const frame = document.getElementById('frame');

const promise = new Promise(resolve => {
window.detachFrame = () => {
frame.remove();
resolve();
};
});

// Start a new worker with an invalid script in the frame, and detach the
// frame in the worker's error handler. This shouldn't crash.
const s = frame.contentWindow.document.createElement('script');
s.innerHTML = "const worker = new SharedWorker('error');" +
"worker.onerror = () => { window.parent.detachFrame(); };";
frame.contentWindow.document.body.appendChild(s);

return promise;
});
</script>