Update web-platform-tests to revision 41a7d8732d8e5c65728c153d29a34fe9d5192b29

This commit is contained in:
James Graham 2015-05-13 16:20:27 +01:00
parent b05c3fc0c0
commit 5e8b92f3de
77 changed files with 1871 additions and 1412 deletions

View file

@ -368,8 +368,20 @@ policies and contribution forms [3].
self.addEventListener("message",
function(event) {
if (event.data.type && event.data.type === "connect") {
this_obj._add_message_port(event.ports[0]);
event.ports[0].start();
if (event.ports && event.ports[0]) {
// If a MessageChannel was passed, then use it to
// send results back to the main window. This
// allows the tests to work even if the browser
// does not fully support MessageEvent.source in
// ServiceWorkers yet.
this_obj._add_message_port(event.ports[0]);
event.ports[0].start();
} else {
// If there is no MessageChannel, then attempt to
// use the MessageEvent.source to send results
// back to the main window.
this_obj._add_message_port(event.source);
}
}
});
@ -1476,15 +1488,24 @@ policies and contribution forms [3].
var message_port;
if (is_service_worker(worker)) {
// The ServiceWorker's implicit MessagePort is currently not
// reliably accessible from the ServiceWorkerGlobalScope due to
// Blink setting MessageEvent.source to null for messages sent via
// ServiceWorker.postMessage(). Until that's resolved, create an
// explicit MessageChannel and pass one end to the worker.
var message_channel = new MessageChannel();
message_port = message_channel.port1;
message_port.start();
worker.postMessage({type: "connect"}, [message_channel.port2]);
if (window.MessageChannel) {
// The ServiceWorker's implicit MessagePort is currently not
// reliably accessible from the ServiceWorkerGlobalScope due to
// Blink setting MessageEvent.source to null for messages sent
// via ServiceWorker.postMessage(). Until that's resolved,
// create an explicit MessageChannel and pass one end to the
// worker.
var message_channel = new MessageChannel();
message_port = message_channel.port1;
message_port.start();
worker.postMessage({type: "connect"}, [message_channel.port2]);
} else {
// If MessageChannel is not available, then try the
// ServiceWorker.postMessage() approach using MessageEvent.source
// on the other end.
message_port = navigator.serviceWorker;
worker.postMessage({type: "connect"});
}
} else if (is_shared_worker(worker)) {
message_port = worker.port;
} else {
@ -2335,7 +2356,15 @@ policies and contribution forms [3].
AssertionError.prototype = Object.create(Error.prototype);
AssertionError.prototype.get_stack = function() {
var lines = new Error().stack.split("\n");
var stack = new Error().stack;
if (!stack) {
try {
throw new Error();
} catch (e) {
stack = e.stack;
}
}
var lines = stack.split("\n");
var rv = [];
var re = /\/resources\/testharness\.js/;
var i = 0;