Auto merge of #26983 - jdm:websocket-panic, r=nox

Silently ignore failures to queue websocket tasks

- [x] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [x] These changes fix #26977
- [x] There are tests for these changes
This commit is contained in:
bors-servo 2020-06-22 08:15:48 -04:00 committed by GitHub
commit 1dc41b3277
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 14 deletions

View file

@ -11248,6 +11248,10 @@
[]
]
},
"websocket_disconnect_worker.js": [
"b8b61957913572b0b121b0aa77c2ec247235fcaa",
[]
],
"worker_member_test.js": [
"abca5cd280ac07914cb21ee4968ac4d27e7feb68",
[]
@ -14598,6 +14602,13 @@
{}
]
],
"websocket_disconnect.html": [
"797342743a4bc69d6c8748d0f2dd6841566e6ca5",
[
null,
{}
]
],
"window-postmessage-sameorigin.html": [
"cb3bc26e8821b73bcee0455c765362ab731bf3fa",
[

View file

@ -0,0 +1,14 @@
<html>
<head>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/common/get-host-info.sub.js"></script>
<script>
async_test((t) => {
let w = new Worker('websocket_disconnect_worker.js');
w.onmessage = () => {
w.terminate();
t.step_timeout(t.step_func_done(), 0);
};
}, "Web socket doesn't panic when worker disappears");
</script>

View file

@ -0,0 +1,10 @@
// Create a websocket and queue up a bunch of activity, then signal the parent to
// terminate this worker before the queued activity is complete.
importScripts('/websockets/websocket.sub.js');
var w = CreateWebSocket(false, true, false);
w.onopen = () => {
postMessage("close");
for (var i = 0; i < 1000; i++) {
w.send('hello' + i);
}
};