Update web-platform-tests to revision 78f764c05c229883e87ad135c7153051a66e2851

This commit is contained in:
WPT Sync Bot 2019-03-06 20:32:15 -05:00
parent 55347aa39f
commit bf84a079f9
1983 changed files with 58006 additions and 31437 deletions

View file

@ -0,0 +1,40 @@
onmessage = function(evt) {
if (evt.data == "port") {
if (evt.ports) {
postMessage("PASS: Received message port");
evt.ports[0].onmessage = pingBack;
evt.ports[0].start();
} else {
postMessage("FAIL: Did not receive expected MessagePort");
}
} else if (evt.data == "noport") {
if (!evt.ports || evt.ports.length) {
postMessage("FAIL: Received message port or null ports array");
} else {
postMessage("PASS: evt.ports = [] as expected");
}
} else if (evt.data == "spam") {
for (var i = 0 ; i < 1000 ; i++) {
evt.ports[0].postMessage(i);
}
postMessage("spamDone");
} else if (evt.data == "getport") {
var channel = new MessageChannel();
postMessage("port", [channel.port1]);
channel.port2.onmessage = pingBack;
channel.port2.start();
} else {
postMessage("Unknown message:" + evt.data);
}
}
function pingBack(evt) {
// Make sure we got the expected data and send a return message over
// the port.
if (evt.data == "ping") {
evt.target.postMessage("pong");
} else {
postMessage("FAIL: unknown message: " + evt.data);
}
}

View file

@ -0,0 +1 @@
while(1);

View file

@ -0,0 +1,15 @@
self.onmessage = function(evt) {
if (evt.data.operation == 'find-edges' &&
ArrayBuffer.prototype.isPrototypeOf(evt.data.input) &&
evt.data.input.byteLength == 20 &&
evt.data.threshold == 0.6) {
self.postMessage("PASS: Worker receives correct structure message.");
self.postMessage({
operation: evt.data.operation,
input: evt.data.input,
threshold: evt.data.threshold
});
}
else
self.postMessage("FAIL: Worker receives error structure message.");
}

View file

@ -0,0 +1,43 @@
onmessage = function(event) {
if (event.data == "noport") {
if (event.ports && !event.ports.length)
testPassed("event.ports is non-null and zero length when no port sent");
else
testFailed("event.ports is null or non-zero length when no port sent");
} else if (event.data == "zero ports") {
if (event.ports && !event.ports.length)
testPassed("event.ports is non-null and zero length when empty array sent");
else
testFailed("event.ports is null or non-zero length when empty array sent");
} else if (event.data == "two ports") {
if (!event.ports) {
testFailed("event.ports should be non-null when ports sent");
return;
}
if (event.ports.length == 2)
testPassed("event.ports contains two ports when two ports sent");
else
testFailed("event.ports contained " + event.ports.length + " when two ports sent");
} else if (event.data == "failed ports") {
if (event.ports.length == 2)
testPassed("event.ports contains two ports when two ports re-sent after error");
else
testFailed("event.ports contained " + event.ports.length + " when two ports re-sent after error");
} else if (event.data == "noargs") {
try {
postMessage();
testFailed("postMessage() did not throw");
} catch (e) {
testPassed("postMessage() threw exception: " + e);
}
} else
testFailed("Received unexpected message: " + event.data);
};
function testPassed(msg) {
postMessage("PASS"+msg);
}
function testFailed(msg) {
postMessage("FAIL"+msg);
}

View file

@ -0,0 +1,7 @@
// The test will create 2 timeouts and cancel the first one. If only the second
// timeout executes then the test passes.
self.addEventListener('message', function(e) {
var t1 = setTimeout(function () { postMessage(1); }, 5);
setTimeout(function () { postMessage(2); }, 10);
clearTimeout(t1);
}, false);

View file

@ -0,0 +1,7 @@
// The test will create 3 timeouts with their intervals decreasing.
// If the timeouts execute in order then the test is PASS.
self.addEventListener('message', function(e) {
setTimeout(function () { postMessage(3); }, 15);
setTimeout(function () { postMessage(2); }, 10);
setTimeout(function () { postMessage(1); }, 5);
}, false);

View file

@ -0,0 +1,7 @@
// The test will create 3 timeouts with their intervals increasing.
// If the timeouts execute in order then the test is PASS.
self.addEventListener('message', function(e) {
setTimeout(function () { postMessage(1); }, 5);
setTimeout(function () { postMessage(2); }, 10);
setTimeout(function () { postMessage(3); }, 15);
}, false);

View file

@ -0,0 +1,43 @@
// Check to see if the worker handles pending events. Messages after close() will not be sent to the parent page, so we use exceptions instead to report failures after close().
onmessage = function(evt)
{
if (evt.data == "closeWithPendingEvents") {
// Set a timer to generate an event - minimum timeout is 1ms.
setTimeout(function() {
postMessage("pending event processed");
throw "should not be executed";
}, 1);
var start = new Date().getTime();
// Loop for 10 ms so the timer is ready to fire
while (new Date().getTime() - start < 100)
;
// Now close - timer should not fire
close();
} else if (evt.data == "typeofClose") {
postMessage("typeof close: " + (typeof close));
} else if (evt.data == "close") {
close();
postMessage("Should be delivered");
} else if (evt.data == "ping") {
postMessage("pong");
} else if (evt.data == "throw") {
throw "should never be executed";
} else if (evt.data == "closeWithError") {
close();
nonExistentFunction(); // Undefined function - throws exception
} else if (evt.data == "close_post_loop") {
close();
postMessage("closed");
while(true) {} // Should loop forever.
} else if (evt.data == "take_port") {
messagePort = evt.ports[0];
messagePort.onmessage = function(event) {
close();
postMessage("echo_" + event.data);
}
} else if (evt.data == "start_port") {
messagePort.start();
} else {
postMessage("FAIL: Unknown message type: " + evt.data);
}
}

View file

@ -0,0 +1 @@
importScripts("importScripts-2.js");

View file

@ -0,0 +1 @@
importScripts("importScripts-3.js");

View file

@ -0,0 +1 @@
importScripts("invalidScript.js");

View file

@ -0,0 +1 @@
SELECT * FROM TABLE; // an invalid script.