Bug 1134224 - test_bug1132395.html must wait until the port is actually available before sending messages, r=ehsan

This commit is contained in:
Andrea Marchesini 2015-04-08 17:59:08 +01:00
parent 46995e9f97
commit 0b8961ab7c
2 changed files with 8 additions and 4 deletions

View File

@ -1,5 +1,7 @@
onconnect = function(evt) {
var blob = new Blob(['123'], { type: 'text/plain' });
var url = URL.createObjectURL(blob);
evt.ports[0].postMessage('alive \\o/');
evt.ports[0].onmessage = function(e) {
var blob = new Blob(['123'], { type: 'text/plain' });
var url = URL.createObjectURL(blob);
evt.ports[0].postMessage('alive \\o/');
};
}

View File

@ -16,9 +16,11 @@
SpecialPowers.pushPrefEnv({ set: [["dom.workers.sharedWorkers.enabled", true]] }, function() {
var sw = new SharedWorker('bug1132395_sharedWorker.js');
sw.port.onmessage = function(event) {
ok(true, "We didn't crash.");
ok(true, "We didn't crash.");
SimpleTest.finish();
}
sw.port.postMessage('go');
});
SimpleTest.waitForExplicitFinish();