Bug 1159742. Get rid of the pref annotation from test_interfaces, since it basically corresponds to disabling the test. r=jst

This commit is contained in:
Boris Zbarsky 2015-05-01 11:42:37 -04:00
parent 3cbf261a57
commit 2b6cdc5b73
3 changed files with 58 additions and 81 deletions

View File

@ -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;
}
}
}
}

View File

@ -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();
});
});
});

View File

@ -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();
});
});
});