Backed out changeset b55dd9178815 (bug 1330349)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Thu, 02 Mar 2017 00:01:39 +0100
changeset 374507 e4892021456db27fc569175f85cb1b279f37f7cc
parent 374506 79cfb75f621a059c82bbc0b77174437a27b1d97b
child 374508 62879a0799e3ebda99768b5559908fbc954b911e
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1330349
milestone54.0a1
backs outb55dd917881523cace3c6ccf7152d8540806436d
Backed out changeset b55dd9178815 (bug 1330349)
toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
--- a/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_temporary.js
@@ -302,50 +302,18 @@ add_task(function*() {
     // temporary add-on is installed and started
     do_check_neq(addon, null);
     do_check_eq(addon.version, "5.0");
     do_check_eq(addon.name, "Test WebExtension 1 (temporary)");
     do_check_true(addon.isCompatible);
     do_check_false(addon.appDisabled);
     do_check_true(addon.isActive);
     do_check_eq(addon.type, "extension");
-    do_check_true(addon.isWebExtension);
     do_check_eq(addon.signedState, mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_SIGNED : AddonManager.SIGNEDSTATE_NOT_REQUIRED);
 
-    // test reloading a webextension with the same name, but a different type.
-    webext.remove(false);
-    webext = createTempWebExtensionFile({
-      manifest: {
-        version: "6.0",
-        name: "Test WebExtension 1 (temporary)",
-        applications: {
-          gecko: {
-            id: ID
-          }
-        },
-        theme: { images: { headerURL: "https://example.com/example.png" } }
-      }
-    });
-
-    yield Promise.all([
-      AddonManager.installTemporaryAddon(webext),
-      promiseAddonStartup(),
-    ]);
-    addon = yield promiseAddonByID(ID);
-
-    do_check_neq(addon, null);
-    do_check_eq(addon.version, "6.0");
-    do_check_eq(addon.name, "Test WebExtension 1 (temporary)");
-    do_check_true(addon.isCompatible);
-    do_check_false(addon.appDisabled);
-    do_check_true(addon.isActive);
-    // This is what we're really interested in:
-    do_check_eq(addon.type, "theme");
-    do_check_true(addon.isWebExtension);
-
     restartManager();
 
     BootstrapMonitor.checkAddonInstalled(ID, "1.0");
     BootstrapMonitor.checkAddonStarted(ID, "1.0");
 
     addon = yield promiseAddonByID(ID);
 
     // existing add-on is back
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
@@ -25,21 +25,18 @@ function promiseAddonStartup() {
 
     Management.on("ready", listener);
   });
 }
 
 function promiseInstallWebExtension(aData) {
   let addonFile = createTempWebExtensionFile(aData);
 
-  return promiseInstallAllFiles([addonFile]).then(installs => {
+  return promiseInstallAllFiles([addonFile]).then(() => {
     Services.obs.notifyObservers(addonFile, "flush-cache-entry", null);
-    // Since themes are disabled by default, it won't start up.
-    if ("theme" in aData.manifest)
-      return installs[0].addon;
     return promiseAddonStartup();
   });
 }
 
 add_task(function*() {
   equal(GlobalManager.extensionMap.size, 0);
 
   yield Promise.all([
@@ -416,53 +413,8 @@ add_task(function* authorNotString() {
       }
     });
 
     addon = yield promiseAddonByID(addon.id);
     equal(addon.creator, null);
     addon.uninstall();
   }
 });
-
-add_task(function* testThemeExtension() {
-  let addon = yield promiseInstallWebExtension({
-    manifest: {
-      "author": "Some author",
-      manifest_version: 2,
-      name: "Web Extension Name",
-      version: "1.0",
-      theme: { images: { headerURL: "https://example.com/example.png" } },
-    }
-  });
-
-  addon = yield promiseAddonByID(addon.id);
-  do_check_neq(addon, null);
-  do_check_eq(addon.creator, "Some author");
-  do_check_eq(addon.version, "1.0");
-  do_check_eq(addon.name, "Web Extension Name");
-  do_check_true(addon.isCompatible);
-  do_check_false(addon.appDisabled);
-  do_check_false(addon.isActive);
-  do_check_true(addon.userDisabled);
-  do_check_false(addon.isSystem);
-  do_check_eq(addon.type, "theme");
-  do_check_true(addon.isWebExtension);
-  do_check_eq(addon.signedState, mozinfo.addon_signing ? AddonManager.SIGNEDSTATE_SIGNED : AddonManager.SIGNEDSTATE_NOT_REQUIRED);
-
-  addon.uninstall();
-
-  // Also test one without a proper 'theme' section.
-  addon = yield promiseInstallWebExtension({
-    manifest: {
-      "author": "Some author",
-      manifest_version: 2,
-      name: "Web Extension Name",
-      version: "1.0",
-      theme: null,
-    }
-  });
-
-  addon = yield promiseAddonByID(addon.id);
-  do_check_eq(addon.type, "extension");
-  do_check_true(addon.isWebExtension);
-
-  addon.uninstall();
-});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension_icons.js
@@ -19,22 +19,37 @@ function promiseAddonStartup() {
       Management.off("startup", listener);
       resolve(extension);
     };
 
     Management.on("startup", listener);
   });
 }
 
-function* testSimpleIconsetParsing(manifest) {
-  yield promiseWriteWebManifestForExtension(manifest, profileDir);
+// Test simple icon set parsing
+add_task(function*() {
+  yield promiseWriteWebManifestForExtension({
+    name: "Web Extension Name",
+    version: "1.0",
+    manifest_version: 2,
+    applications: {
+      gecko: {
+        id: ID
+      }
+    },
+    icons: {
+      16: "icon16.png",
+      32: "icon32.png",
+      48: "icon48.png",
+      64: "icon64.png"
+    }
+  }, profileDir);
 
   yield promiseRestartManager();
-  if (!manifest.theme)
-    yield promiseAddonStartup();
+  yield promiseAddonStartup();
 
   let uri = do_get_addon_root_uri(profileDir, ID);
 
   let addon = yield promiseAddonByID(ID);
   do_check_neq(addon, null);
 
   function check_icons(addon_copy) {
     deepEqual(addon_copy.icons, {
@@ -56,35 +71,50 @@ function* testSimpleIconsetParsing(manif
     equal(AddonManager.getPreferredIconURL(addon, 64), uri + "icon64.png");
     equal(AddonManager.getPreferredIconURL(addon, 128), uri + "icon64.png");
   }
 
   check_icons(addon);
 
   // check if icons are persisted through a restart
   yield promiseRestartManager();
-  if (!manifest.theme)
-    yield promiseAddonStartup();
+  yield promiseAddonStartup();
 
   addon = yield promiseAddonByID(ID);
   do_check_neq(addon, null);
 
   check_icons(addon);
 
   addon.uninstall();
 
   yield promiseRestartManager();
-}
+});
 
-function* testRetinaIconsetParsing(manifest) {
-  yield promiseWriteWebManifestForExtension(manifest, profileDir);
+// Test AddonManager.getPreferredIconURL for retina screen sizes
+add_task(function*() {
+  yield promiseWriteWebManifestForExtension({
+    name: "Web Extension Name",
+    version: "1.0",
+    manifest_version: 2,
+    applications: {
+      gecko: {
+        id: ID
+      }
+    },
+    icons: {
+      32: "icon32.png",
+      48: "icon48.png",
+      64: "icon64.png",
+      128: "icon128.png",
+      256: "icon256.png"
+    }
+  }, profileDir);
 
   yield promiseRestartManager();
-  if (!manifest.theme)
-    yield promiseAddonStartup();
+  yield promiseAddonStartup();
 
   let addon = yield promiseAddonByID(ID);
   do_check_neq(addon, null);
 
   let uri = do_get_addon_root_uri(profileDir, ID);
 
   // AddonManager displays larger icons for higher pixel density
   equal(AddonManager.getPreferredIconURL(addon, 32, {
@@ -97,136 +127,40 @@ function* testRetinaIconsetParsing(manif
 
   equal(AddonManager.getPreferredIconURL(addon, 64, {
     devicePixelRatio: 2
   }), uri + "icon128.png");
 
   addon.uninstall();
 
   yield promiseRestartManager();
-}
+});
 
-function* testNoIconsParsing(manifest) {
-  yield promiseWriteWebManifestForExtension(manifest, profileDir);
+// Handles no icons gracefully
+add_task(function*() {
+  yield promiseWriteWebManifestForExtension({
+    name: "Web Extension Name",
+    version: "1.0",
+    manifest_version: 2,
+    applications: {
+      gecko: {
+        id: ID
+      }
+    }
+  }, profileDir);
 
   yield promiseRestartManager();
-  if (!manifest.theme)
-    yield promiseAddonStartup();
+  yield promiseAddonStartup();
 
   let addon = yield promiseAddonByID(ID);
   do_check_neq(addon, null);
 
   deepEqual(addon.icons, {});
 
   equal(addon.iconURL, null);
   equal(addon.icon64URL, null);
 
   equal(AddonManager.getPreferredIconURL(addon, 128), null);
 
   addon.uninstall();
 
   yield promiseRestartManager();
-}
-
-// Test simple icon set parsing
-add_task(function*() {
-  yield* testSimpleIconsetParsing({
-    name: "Web Extension Name",
-    version: "1.0",
-    manifest_version: 2,
-    applications: {
-      gecko: {
-        id: ID
-      }
-    },
-    icons: {
-      16: "icon16.png",
-      32: "icon32.png",
-      48: "icon48.png",
-      64: "icon64.png"
-    }
-  });
-
-  // Now for theme-type extensions too.
-  yield* testSimpleIconsetParsing({
-    name: "Web Extension Name",
-    version: "1.0",
-    manifest_version: 2,
-    applications: {
-      gecko: {
-        id: ID
-      }
-    },
-    icons: {
-      16: "icon16.png",
-      32: "icon32.png",
-      48: "icon48.png",
-      64: "icon64.png"
-    },
-    theme: { images: { headerURL: "https://example.com/example.png" } }
-  });
 });
-
-// Test AddonManager.getPreferredIconURL for retina screen sizes
-add_task(function*() {
-  yield* testRetinaIconsetParsing({
-    name: "Web Extension Name",
-    version: "1.0",
-    manifest_version: 2,
-    applications: {
-      gecko: {
-        id: ID
-      }
-    },
-    icons: {
-      32: "icon32.png",
-      48: "icon48.png",
-      64: "icon64.png",
-      128: "icon128.png",
-      256: "icon256.png"
-    }
-  });
-
-  yield* testRetinaIconsetParsing({
-    name: "Web Extension Name",
-    version: "1.0",
-    manifest_version: 2,
-    applications: {
-      gecko: {
-        id: ID
-      }
-    },
-    icons: {
-      32: "icon32.png",
-      48: "icon48.png",
-      64: "icon64.png",
-      128: "icon128.png",
-      256: "icon256.png"
-    },
-    theme: { images: { headerURL: "https://example.com/example.png" } }
-  });
-});
-
-// Handles no icons gracefully
-add_task(function*() {
-  yield* testNoIconsParsing({
-    name: "Web Extension Name",
-    version: "1.0",
-    manifest_version: 2,
-    applications: {
-      gecko: {
-        id: ID
-      }
-    }
-  });
-
-  yield* testNoIconsParsing({
-    name: "Web Extension Name",
-    version: "1.0",
-    manifest_version: 2,
-    applications: {
-      gecko: {
-        id: ID
-      }
-    },
-    theme: { images: { headerURL: "https://example.com/example.png" } }
-  });
-});