Bug 1130678 - Fix messaging ordering issue in broadcastchannel tests, r=mchang

This commit is contained in:
Andrea Marchesini 2015-02-09 08:33:01 +00:00
parent cf436b41a2
commit 9563da72b3
2 changed files with 2 additions and 4 deletions

View File

@ -2,8 +2,8 @@ onconnect = function(evt) {
evt.ports[0].onmessage = function(evt) {
var bc = new BroadcastChannel('foobar');
bc.addEventListener('message', function(event) {
evt.target.postMessage(event.data == "hello world from the window" ? "OK" : "KO");
bc.postMessage("hello world from the worker");
bc.postMessage(event.data == "hello world from the window" ?
"hello world from the worker" : "KO");
bc.close();
}, false);

View File

@ -29,8 +29,6 @@ function runTests() {
if (event.data == "READY") {
ok(true, "SharedWorker is ready!");
bc.postMessage('hello world from the window');
} else if(event.data == "OK") {
ok(true, "SharedWorker has received the message");
} else {
ok(false, "Something wrong happened");
}