Bug 1159742. Get rid of the pref annotation from test_interfaces, since it basically corresponds to disabling the test. r=jst
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 01 May 2015 11:42:37 -0400
changeset 242080 703c29db2fb2c4c60f3bba7b60c6c5a56a0b4dde
parent 242079 c6f21d65e5d2fd0c86257b9151b16c28633e6b09
child 242081 18631c5f81116c28c1037cdae0576fdc8b936484
push id28679
push userphilringnalda@gmail.com
push dateSat, 02 May 2015 17:02:29 +0000
treeherdermozilla-central@0f5eacc986e8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1159742
milestone40.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1159742. Get rid of the pref annotation from test_interfaces, since it basically corresponds to disabling the test. r=jst
dom/tests/mochitest/general/test_interfaces.html
dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
dom/workers/test/test_worker_interfaces.js
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -918,17 +918,17 @@ var interfaceNamesInGlobalScope =
     {name: "ServiceWorkerContainer", nightly: true, b2g: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "ServiceWorkerRegistration", nightly: true, b2g: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "SettingsLock",
 // 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!
     "SimpleGestureEvent",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "SimpleTest", xbl: false},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "SourceBuffer", android: false, linux: false, release: false},
@@ -1376,17 +1376,16 @@ var interfaceNamesInGlobalScope =
     {name: "XULTemplateBuilder", xbl: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
     {name: "XULTreeBuilder", xbl: true},
 // IMPORTANT: Do not change this list without review from a DOM peer!
   ];
 // 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");
   var isDesktop = !/Mobile|Tablet/.test(navigator.userAgent);
   var isB2G = !isDesktop && !navigator.userAgent.includes("Android");
   var isMac = /Mac OS/.test(navigator.oscpu);
   var isWindows = /Windows/.test(navigator.oscpu);
   var isLinux = /Linux/.test(navigator.oscpu);
@@ -1401,31 +1400,33 @@ function createInterfaceMap(isXBLScope) 
 
   var interfaceMap = {};
 
   function addInterfaces(interfaces)
   {
     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;
+	}
       }
     }
   }
 
   addInterfaces(ecmaGlobals);
   addInterfaces(interfaceNamesInGlobalScope);
   if (isXBLScope) {
     // We expose QueryInterface to XBL scopes. It's not an interface but we
--- a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
+++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js
@@ -187,51 +187,53 @@ var interfaceNamesInGlobalScope =
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WorkerLocation",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WorkerNavigator",
 // IMPORTANT: Do not change this list without review from a DOM peer!
   ];
 // 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);
   var isAndroid = !!navigator.userAgent.includes("Android");
 
   var interfaceMap = {};
 
   function addInterfaces(interfaces)
   {
     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;
+        }
       }
     }
   }
 
   addInterfaces(ecmaGlobals);
   addInterfaces(interfaceNamesInGlobalScope);
 
   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)) {
       continue;
     }
     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 service worker? Do not make a change to this file without a " +
@@ -244,45 +246,31 @@ function runTest(prefMap, permissionMap,
     if (!interfaceMap[name]) {
       delete interfaceMap[name];
     }
   }
   is(Object.keys(interfaceMap).length, 0,
      "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 &&
         permissions.indexOf(entry.permission) === -1) {
       permissions.push(entry.permission);
     }
   }
 }
 
 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();
       });
     });
   });
 });
--- a/dom/workers/test/test_worker_interfaces.js
+++ b/dom/workers/test/test_worker_interfaces.js
@@ -175,52 +175,54 @@ var interfaceNamesInGlobalScope =
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WorkerLocation",
 // IMPORTANT: Do not change this list without review from a DOM peer!
     "WorkerNavigator",
 // IMPORTANT: Do not change this list without review from a DOM peer!
   ];
 // 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);
   var isAndroid = !!navigator.userAgent.includes("Android");
 
   var interfaceMap = {};
 
   function addInterfaces(interfaces)
   {
     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;
+        }
       }
     }
   }
 
   addInterfaces(ecmaGlobals);
   addInterfaces(interfaceNamesInGlobalScope);
 
   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)) {
       continue;
     }
     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 " +
@@ -233,45 +235,31 @@ function runTest(prefMap, permissionMap,
     if (!interfaceMap[name]) {
       delete interfaceMap[name];
     }
   }
   is(Object.keys(interfaceMap).length, 0,
      "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 &&
         permissions.indexOf(entry.permission) === -1) {
       permissions.push(entry.permission);
     }
   }
 }
 
 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();
       });
     });
   });
 });