Bug 1442313 part 4. Use getJSTestingFunctions() in test_worker_interfaces.js. r=luke

MozReview-Commit-ID: IUQQX3ixkgl
This commit is contained in:
Boris Zbarsky 2018-03-01 14:24:20 -05:00
Родитель 6e53866b8e
Коммит bb7433ad51
1 изменённых файлов: 5 добавлений и 15 удалений

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

@ -76,11 +76,7 @@ var ecmaGlobals =
{name: "URIError", insecureContext: true},
{name: "WeakMap", insecureContext: true},
{name: "WeakSet", insecureContext: true},
// WebAssembly is not supported on some hardware configurations,
// but we have no way to check that from here. Just give up for
// now and don't check for it at all. Do NOT add any other uses
// of "optional"!
{name: "WebAssembly", insecureContext: true, optional: true},
{name: "WebAssembly", insecureContext: true, disabled: !getJSTestingFunctions().wasmIsSupportedByHardware()},
];
// IMPORTANT: Do not change the list above without review from
// a JavaScript Engine peer!
@ -291,8 +287,6 @@ function createInterfaceMap(version, userAgent) {
(isInsecureContext && !Boolean(entry.insecureContext)) ||
entry.disabled) {
interfaceMap[entry.name] = false;
} else if (entry.optional) {
interfaceMap[entry.name] = "optional";
} else {
interfaceMap[entry.name] = true;
}
@ -313,21 +307,17 @@ function runTest(version, userAgent) {
if (!/^[A-Z]/.test(name)) {
continue;
}
ok(interfaceMap[name] === "optional" || interfaceMap[name],
ok(interfaceMap[name],
"If this is failing: DANGER, are you sure you want to expose the new interface " + name +
" to all webpages as a property on the worker? Do not make a change to this file without a " +
" review from a DOM peer for that specific change!!! (or a JS peer for changes to ecmaGlobals)");
delete interfaceMap[name];
}
for (var name of Object.keys(interfaceMap)) {
if (interfaceMap[name] === "optional") {
ok(name in self === interfaceMap[name],
name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the global scope");
if (!interfaceMap[name]) {
delete interfaceMap[name];
} else {
ok(name in self === interfaceMap[name],
name + " should " + (interfaceMap[name] ? "" : " NOT") + " be defined on the global scope");
if (!interfaceMap[name]) {
delete interfaceMap[name];
}
}
}
is(Object.keys(interfaceMap).length, 0,