mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Update web-platform-tests to revision b'468d01bbd84da2babf265c6af46947be68713440'
This commit is contained in:
parent
35e95f55a1
commit
58e8ee674b
9438 changed files with 266112 additions and 106976 deletions
|
@ -0,0 +1,34 @@
|
|||
// META: title=postMessage() with a Blob
|
||||
|
||||
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/web-platform-tests/wpt/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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue