Skip to content

Commit

Permalink
update broadcastchannel test to reflect closed check move into queued…
Browse files Browse the repository at this point in the history
… task.
  • Loading branch information
gterzian committed Feb 25, 2020
1 parent eb21d5f commit 99e4d74
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/wpt/metadata/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -550029,7 +550029,7 @@
],
"broadcastchannel": {
"basics.html": [
"ed16e32f5437dc430b5cc11b967e6538ef6cf393",
"3d8ba76fb1ba35658c44702059925fe53e3fb6f6",
[
null,
{}
Expand Down
6 changes: 3 additions & 3 deletions tests/wpt/mozilla/meta/MANIFEST.json
Original file line number Diff line number Diff line change
Expand Up @@ -10971,7 +10971,7 @@
[]
],
"interfaces.js": [
"c46c336f8a8a2db777f75d6236b1241c717a02dd",
"689016240d603459ee1b633a5e80009291376396",
[]
],
"nested_asap_script.js": [
Expand Down Expand Up @@ -13863,14 +13863,14 @@
]
],
"interfaces.html": [
"163ab416b1627e07347b83aa210712364182343a",
"12f1d0b7f17be6575d4527423aed0ec845c4c2d5",
[
null,
{}
]
],
"interfaces.worker.js": [
"3f77783a6cc31e7803dd61873ba17c92ce12eccc",
"c1223084790b2980c8184e3cd9ab5ae17bc8b303",
[
"mozilla/interfaces.worker.html",
{}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,17 @@
c1.postMessage('test');
}, 'messages aren\'t delivered to a closed port');

async_test(t => {
let c1 = new BroadcastChannel('closed');
let c2 = new BroadcastChannel('closed');
let c3 = new BroadcastChannel('closed');

c2.onmessage = t.unreached_func();
c3.onmessage = t.step_func(() => t.done());
c1.postMessage('test');
c2.close();
}, 'messages aren\'t delivered to a port closed after calling postMessage.');

async_test(t => {
let c1 = new BroadcastChannel('create-in-onmessage');
let c2 = new BroadcastChannel('create-in-onmessage');
Expand All @@ -87,8 +98,6 @@
c2.postMessage('second');
}, 'closing and creating channels during message delivery works correctly');

// TODO(mek): Depending on https://github.com/whatwg/html/issues/1371 adjust
// this test to match the correct behavior.
async_test(t => {
let c1 = new BroadcastChannel('close-in-onmessage');
let c2 = new BroadcastChannel('close-in-onmessage');
Expand All @@ -108,13 +117,12 @@
assert_array_equals(events, [
'c2: first',
'c3: first',
'c2: done',
'c3: done']);
t.done();
}
}));
c1.postMessage('first');
c1.postMessage('done');
}, 'Closing a channel in onmessage doesn\'t cancel already queued events');
}, 'Closing a channel in onmessage prevents already queued tasks from firing onmessage events');

</script>

0 comments on commit 99e4d74

Please sign in to comment.