diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index f9dc582b4e49..21ad5985a526 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -923,7 +923,7 @@ var interfaceNamesInGlobalScope = // IMPORTANT: Do not change this list without review from a DOM peer! "SettingsManager", // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "ShadowRoot", pref: "dom.webcomponents.enabled"}, + "ShadowRoot", // Bogus, but the test harness forces it on. See bug 1159768. // IMPORTANT: Do not change this list without review from a DOM peer! "SharedWorker", // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1381,7 +1381,6 @@ var interfaceNamesInGlobalScope = // IMPORTANT: Do not change the list above without review from a DOM peer! function createInterfaceMap(isXBLScope) { - var prefs = SpecialPowers.Services.prefs; var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version; var isNightly = version.endsWith("a1"); var isRelease = !version.includes("a"); @@ -1406,21 +1405,23 @@ function createInterfaceMap(isXBLScope) { for (var entry of interfaces) { if (typeof(entry) === "string") { interfaceMap[entry] = true; - } else if ((entry.nightly === !isNightly) || - (entry.xbl === !isXBLScope) || - (entry.desktop === !isDesktop) || - (entry.b2g === !isB2G) || - (entry.windows === !isWindows) || - (entry.mac === !isMac) || - (entry.linux === !isLinux) || - (entry.android === !isAndroid) || - (entry.release === !isRelease) || - (entry.pref && !prefs.getBoolPref(entry.pref)) || - (entry.permission && !hasPermission(entry.permission)) || - entry.disabled) { - interfaceMap[entry.name] = false; } else { - interfaceMap[entry.name] = true; + ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); + if ((entry.nightly === !isNightly) || + (entry.xbl === !isXBLScope) || + (entry.desktop === !isDesktop) || + (entry.b2g === !isB2G) || + (entry.windows === !isWindows) || + (entry.mac === !isMac) || + (entry.linux === !isLinux) || + (entry.android === !isAndroid) || + (entry.release === !isRelease) || + (entry.permission && !hasPermission(entry.permission)) || + entry.disabled) { + interfaceMap[entry.name] = false; + } else { + interfaceMap[entry.name] = true; + } } } } diff --git a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js index 92aeeba4d1c9..13caa0baf8a8 100644 --- a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js +++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js @@ -192,7 +192,7 @@ var interfaceNamesInGlobalScope = ]; // IMPORTANT: Do not change the list above without review from a DOM peer! -function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { +function createInterfaceMap(permissionMap, version, userAgent, isB2G) { var isNightly = version.endsWith("a1"); var isRelease = !version.includes("a"); var isDesktop = !/Mobile|Tablet/.test(userAgent); @@ -205,16 +205,18 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { for (var entry of interfaces) { if (typeof(entry) === "string") { interfaceMap[entry] = true; - } else if ((entry.nightly === !isNightly) || - (entry.desktop === !isDesktop) || - (entry.android === !isAndroid) || - (entry.b2g === !isB2G) || - (entry.release === !isRelease) || - (entry.pref && !prefMap[entry.pref]) || - (entry.permission && !permissionMap[entry.permission])) { - interfaceMap[entry.name] = false; } else { - interfaceMap[entry.name] = true; + ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); + if ((entry.nightly === !isNightly) || + (entry.desktop === !isDesktop) || + (entry.android === !isAndroid) || + (entry.b2g === !isB2G) || + (entry.release === !isRelease) || + (entry.permission && !permissionMap[entry.permission])) { + interfaceMap[entry.name] = false; + } else { + interfaceMap[entry.name] = true; + } } } } @@ -225,8 +227,8 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { return interfaceMap; } -function runTest(prefMap, permissionMap, version, userAgent, isB2G) { - var interfaceMap = createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G); +function runTest(permissionMap, version, userAgent, isB2G) { + var interfaceMap = createInterfaceMap(permissionMap, version, userAgent, isB2G); for (var name of Object.getOwnPropertyNames(self)) { // An interface name should start with an upper case character. if (!/^[A-Z]/.test(name)) { @@ -249,18 +251,6 @@ function runTest(prefMap, permissionMap, version, userAgent, isB2G) { "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", ")); } -function appendPrefs(prefs, interfaces) { - for (var entry of interfaces) { - if (entry.pref !== undefined && prefs.indexOf(entry.pref) === -1) { - prefs.push(entry.pref); - } - } -} - -var prefs = []; -appendPrefs(prefs, ecmaGlobals); -appendPrefs(prefs, interfaceNamesInGlobalScope); - function appendPermissions(permissions, interfaces) { for (var entry of interfaces) { if (entry.permission !== undefined && @@ -274,14 +264,12 @@ var permissions = []; appendPermissions(permissions, ecmaGlobals); appendPermissions(permissions, interfaceNamesInGlobalScope); -workerTestGetPrefs(prefs, function(prefMap) { - workerTestGetPermissions(permissions, function(permissionMap) { - workerTestGetVersion(function(version) { - workerTestGetUserAgent(function(userAgent) { - workerTestGetIsB2G(function(isB2G) { - runTest(prefMap, permissionMap, version, userAgent, isB2G); - workerTestDone(); - }); +workerTestGetPermissions(permissions, function(permissionMap) { + workerTestGetVersion(function(version) { + workerTestGetUserAgent(function(userAgent) { + workerTestGetIsB2G(function(isB2G) { + runTest(permissionMap, version, userAgent, isB2G); + workerTestDone(); }); }); }); diff --git a/dom/workers/test/test_worker_interfaces.js b/dom/workers/test/test_worker_interfaces.js index e7aa419a45c1..01aebda8db89 100644 --- a/dom/workers/test/test_worker_interfaces.js +++ b/dom/workers/test/test_worker_interfaces.js @@ -180,7 +180,7 @@ var interfaceNamesInGlobalScope = ]; // IMPORTANT: Do not change the list above without review from a DOM peer! -function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { +function createInterfaceMap(permissionMap, version, userAgent, isB2G) { var isNightly = version.endsWith("a1"); var isRelease = !version.includes("a"); var isDesktop = !/Mobile|Tablet/.test(userAgent); @@ -193,17 +193,19 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { for (var entry of interfaces) { if (typeof(entry) === "string") { interfaceMap[entry] = true; - } else if ((entry.nightly === !isNightly) || - (entry.desktop === !isDesktop) || - (entry.android === !isAndroid) || - (entry.b2g === !isB2G) || - (entry.release === !isRelease) || - (entry.pref && !prefMap[entry.pref]) || - (entry.permission && !permissionMap[entry.permission]) || - entry.disabled) { - interfaceMap[entry.name] = false; } else { - interfaceMap[entry.name] = true; + ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); + if ((entry.nightly === !isNightly) || + (entry.desktop === !isDesktop) || + (entry.android === !isAndroid) || + (entry.b2g === !isB2G) || + (entry.release === !isRelease) || + (entry.permission && !permissionMap[entry.permission]) || + entry.disabled) { + interfaceMap[entry.name] = false; + } else { + interfaceMap[entry.name] = true; + } } } } @@ -214,8 +216,8 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { return interfaceMap; } -function runTest(prefMap, permissionMap, version, userAgent, isB2G) { - var interfaceMap = createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G); +function runTest(permissionMap, version, userAgent, isB2G) { + var interfaceMap = createInterfaceMap(permissionMap, version, userAgent, isB2G); for (var name of Object.getOwnPropertyNames(self)) { // An interface name should start with an upper case character. if (!/^[A-Z]/.test(name)) { @@ -238,18 +240,6 @@ function runTest(prefMap, permissionMap, version, userAgent, isB2G) { "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", ")); } -function appendPrefs(prefs, interfaces) { - for (var entry of interfaces) { - if (entry.pref !== undefined && prefs.indexOf(entry.pref) === -1) { - prefs.push(entry.pref); - } - } -} - -var prefs = []; -appendPrefs(prefs, ecmaGlobals); -appendPrefs(prefs, interfaceNamesInGlobalScope); - function appendPermissions(permissions, interfaces) { for (var entry of interfaces) { if (entry.permission !== undefined && @@ -263,14 +253,12 @@ var permissions = []; appendPermissions(permissions, ecmaGlobals); appendPermissions(permissions, interfaceNamesInGlobalScope); -workerTestGetPrefs(prefs, function(prefMap) { - workerTestGetPermissions(permissions, function(permissionMap) { - workerTestGetVersion(function(version) { - workerTestGetUserAgent(function(userAgent) { - workerTestGetIsB2G(function(isB2G) { - runTest(prefMap, permissionMap, version, userAgent, isB2G); - workerTestDone(); - }); +workerTestGetPermissions(permissions, function(permissionMap) { + workerTestGetVersion(function(version) { + workerTestGetUserAgent(function(userAgent) { + workerTestGetIsB2G(function(isB2G) { + runTest(permissionMap, version, userAgent, isB2G); + workerTestDone(); }); }); });