mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Update web-platform-tests to revision 14cfa4d648cc1c853b4153268df672d21425f8c1
This commit is contained in:
parent
1b73cf3352
commit
75736751d9
1213 changed files with 19434 additions and 12344 deletions
|
@ -0,0 +1,45 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title> postMessage() with a Blob </title>
|
||||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id=log></div>
|
||||
<script>
|
||||
var TARGET = null;
|
||||
var SOURCE = null;
|
||||
var description = "Messages can contain Blobs.";
|
||||
|
||||
var t = async_test("Test Description: " + description);
|
||||
|
||||
var channel = new MessageChannel();
|
||||
SOURCE = channel.port1;
|
||||
TARGET = channel.port2;
|
||||
TARGET.start();
|
||||
TARGET.addEventListener("message", t.step_func(TestMessageEvent), true);
|
||||
|
||||
(function() {
|
||||
SOURCE.postMessage({blob: new Blob(['foo', 'bar'])});
|
||||
})();
|
||||
// TODO(https://github.com/w3c/web-platform-tests/issues/7899): Change to
|
||||
// some sort of cross-browser GC trigger.
|
||||
if (self.gc) self.gc();
|
||||
|
||||
function TestMessageEvent(evt)
|
||||
{
|
||||
assert_true('blob' in evt.data);
|
||||
assert_true(evt.data.blob instanceof Blob);
|
||||
assert_equals(evt.data.blob.size, 6);
|
||||
const reader = new FileReader();
|
||||
reader.onerror = t.unreached_func('Reading blob failed');
|
||||
reader.onload = t.step_func(() => {
|
||||
assert_equals(reader.result, 'foobar');
|
||||
t.done();
|
||||
});
|
||||
reader.readAsText(evt.data.blob);
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -3,7 +3,6 @@
|
|||
<script src="/resources/testharness.js"></script>
|
||||
<script src="/resources/testharnessreport.js"></script>
|
||||
<script>
|
||||
|
||||
async_test(t => {
|
||||
const c1 = new BroadcastChannel('blob');
|
||||
const c2 = new BroadcastChannel('blob');
|
||||
|
@ -25,7 +24,12 @@ async_test(t => {
|
|||
reader.readAsText(e.data.blob);
|
||||
});
|
||||
c3.onmessage = c2.onmessage;
|
||||
c1.postMessage({blob: new Blob(['foo', 'bar'])});
|
||||
(() => {
|
||||
c1.postMessage({blob: new Blob(['foo', 'bar'])});
|
||||
})();
|
||||
// TODO(https://github.com/w3c/web-platform-tests/issues/7899): Change to
|
||||
// some sort of cross-browser GC trigger.
|
||||
if (self.gc) self.gc();
|
||||
}, 'Blobs work on BroadcastChannel');
|
||||
|
||||
async_test(t => {
|
||||
|
|
|
@ -6,7 +6,12 @@ function handler(e, reply) {
|
|||
return;
|
||||
}
|
||||
if (e.data.blob) {
|
||||
c.postMessage({blob: new Blob(e.data.blob)});
|
||||
(() => {
|
||||
c.postMessage({blob: new Blob(e.data.blob)});
|
||||
})();
|
||||
// TODO(https://github.com/w3c/web-platform-tests/issues/7899): Change to
|
||||
// some sort of cross-browser GC trigger.
|
||||
if (self.gc) self.gc();
|
||||
}
|
||||
c = new BroadcastChannel(e.data.channel);
|
||||
let messages = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue