Bug 1605566 - MessagePort + wasm - part 5 - tests, r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D59616

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrea Marchesini 2020-01-24 07:59:31 +00:00
Родитель ce553d0097
Коммит 2b5eb657d7
6 изменённых файлов: 108 добавлений и 38 удалений

Просмотреть файл

@ -549,7 +549,7 @@ function test_messagePort() {
runTests({
clonableObjectsEveryWhere: true,
clonableObjectsSameProcess: false,
clonableObjectsSameProcess: true,
transferableObjects: true,
send(what, ports) {
return new Promise(function(r, rr) {

Просмотреть файл

@ -30,3 +30,4 @@ skip-if = (os == "win" && processor == "aarch64") #bug 1535784
[test_messageChannel_bug1224825.html]
[test_messageChannel_worker_forceClose.html]
[test_removedWindow.html]
[test_wasm.html]

Просмотреть файл

@ -0,0 +1,105 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>MessagePort + wasm</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script id='myWorker' type='text/worker'>
self.onmessage = e => {
e.ports[0].onmessage = ee => postMessage(ee.data);
};
</script>
<script type="application/javascript">
let wasmModule;
function create_wasmModule() {
info("Checking if we can play with WebAssembly...");
if (!SpecialPowers.Cu.getJSTestingFunctions().wasmIsSupported()) {
next();
return;
}
ok(WebAssembly, "WebAssembly object should exist");
ok(WebAssembly.compile, "WebAssembly.compile function should exist");
const wasmTextToBinary = SpecialPowers.unwrap(SpecialPowers.Cu.getJSTestingFunctions().wasmTextToBinary);
const fooModuleCode = wasmTextToBinary(`(module
(func $foo (result i32) (i32.const 42))
(export "foo" $foo)
)`);
WebAssembly.compile(fooModuleCode).then(m => {
ok(m instanceof WebAssembly.Module, "The WasmModule has been compiled.");
wasmModule = m;
next();
}, () => {
ok(false, "The compilation of the wasmModule failed.");
});
}
function test_simple() {
info("MessagePort without disentangling");
if (!wasmModule) {
next();
return;
}
const mc = new MessageChannel();
mc.port1.postMessage({ wasmModule });
mc.port2.onmessage = e => {
ok(e.data.wasmModule instanceof WebAssembly.Module, "WasmModule received");
next();
};
}
function test_worker() {
info("MessagePort sent to a worker");
if (!wasmModule) {
next();
return;
}
const mc = new MessageChannel();
mc.port1.postMessage({ wasmModule });
const blob = new Blob([document.getElementById('myWorker').textContent]);
const w = new Worker(URL.createObjectURL(blob));
w.postMessage(42, [ mc.port2 ]);
w.onmessage = e => {
ok(e.data.wasmModule instanceof WebAssembly.Module, "WasmModule received");
next();
};
}
const tests = [
create_wasmModule,
test_simple,
test_worker,
];
function next() {
if (tests.length === 0) {
SimpleTest.finish();
return;
}
const test = tests.shift();
test();
}
SimpleTest.waitForExplicitFinish();
next();
</script>
</body>
</html>

Просмотреть файл

@ -1,3 +0,0 @@
[window-messagechannel-success.html]
[postMessaging to a dedicated worker via MessageChannel allows them to instantiate]
expected: FAIL

Просмотреть файл

@ -1,4 +1,2 @@
[window-sharedworker-failure.html]
[WebAssembly.Modules cannot cross agent clusters, shared worker edition]
expected: FAIL
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1609990

Просмотреть файл

@ -1,31 +0,0 @@
[shared.html]
[Array ImageBitmap object, ImageBitmap 1x1 transparent non-black]
expected:
if (os == "win") and (processor == "x86_64") and not debug: ["FAIL", "PASS"]
FAIL
[Array ImageBitmap object, ImageBitmap 1x1 transparent black]
expected:
if (os == "win") and (processor == "x86_64") and not debug: ["FAIL", "PASS"]
FAIL
[ImageBitmap 1x1 non-transparent non-black]
expected:
if (os == "win") and (processor == "x86_64") and not debug: ["FAIL", "PASS"]
FAIL
[Object ImageBitmap object, ImageBitmap 1x1 transparent non-black]
expected:
if (os == "win") and (processor == "x86_64") and not debug: ["FAIL", "PASS"]
FAIL
[ImageBitmap 1x1 transparent black]
expected:
if (os == "win") and (processor == "x86_64") and not debug: ["FAIL", "PASS"]
FAIL
[Object ImageBitmap object, ImageBitmap 1x1 transparent black]
expected:
if (os == "win") and (processor == "x86_64") and not debug: ["FAIL", "PASS"]
FAIL