Backed out changeset f9f7b5b1e6ec (bug 1585290) for bc failures on Database.jsm . CLOSED TREE
authorNarcis Beleuzu <nbeleuzu@mozilla.com>
Fri, 27 Mar 2020 19:17:41 +0200
changeset 520792 cdd7a121a36b9963a0086dc6f2ef2ec3327f2c15
parent 520791 375c96f5ab7a10e740aa3c87ed466067b1174c59
child 520793 777d941a0f0e748baff20cd44748f0540b550297
push id111324
push usernbeleuzu@mozilla.com
push dateFri, 27 Mar 2020 17:18:34 +0000
treeherderautoland@cdd7a121a36b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1585290
milestone76.0a1
backs outf9f7b5b1e6ec897fc1009fc5278fe7a650d57018
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
Backed out changeset f9f7b5b1e6ec (bug 1585290) for bc failures on Database.jsm . CLOSED TREE
toolkit/components/extensions/parent/ext-theme.js
toolkit/components/extensions/test/browser/browser.ini
toolkit/components/extensions/test/browser/browser_ext_themes_dynamic_getCurrent.js
toolkit/components/extensions/test/browser/browser_ext_themes_reset.js
--- a/toolkit/components/extensions/parent/ext-theme.js
+++ b/toolkit/components/extensions/parent/ext-theme.js
@@ -384,17 +384,17 @@ class Theme {
     let lwtData = {
       theme: null,
     };
 
     if (windowId) {
       lwtData.window = getWinUtils(
         windowTracker.getWindow(windowId)
       ).outerWindowID;
-      windowOverrides.delete(windowId);
+      windowOverrides.set(windowId, emptyTheme);
     } else {
       windowOverrides.clear();
       defaultTheme = emptyTheme;
       LightweightThemeManager.fallbackThemeData = null;
     }
     onUpdatedEmitter.emit("theme-updated", {}, windowId);
 
     Services.obs.notifyObservers(lwtData, "lightweight-theme-styling-update");
@@ -468,22 +468,22 @@ this.theme = class extends ExtensionAPI 
           });
         },
         reset: windowId => {
           if (windowId) {
             const browserWindow = windowTracker.getWindow(windowId, context);
             if (!browserWindow) {
               return Promise.reject(`Invalid window ID: ${windowId}`);
             }
+          } else if (defaultTheme.extension !== extension) {
+            return;
+          }
 
-            let theme = windowOverrides.get(windowId) || defaultTheme;
-            if (theme.extension !== extension) {
-              return;
-            }
-          } else if (defaultTheme.extension !== extension) {
+          if (!defaultTheme && !windowOverrides.has(windowId)) {
+            // If no theme has been initialized, nothing to do.
             return;
           }
 
           Theme.unload(windowId);
         },
         onUpdated: new EventManager({
           context,
           name: "theme.onUpdated",
--- a/toolkit/components/extensions/test/browser/browser.ini
+++ b/toolkit/components/extensions/test/browser/browser.ini
@@ -23,23 +23,23 @@ skip-if = verify
 [browser_ext_themes_lwtsupport.js]
 [browser_ext_themes_multiple_backgrounds.js]
 [browser_ext_themes_ntp_colors.js]
 [browser_ext_themes_ntp_colors_perwindow.js]
 [browser_ext_themes_persistence.js]
 [browser_ext_themes_reset.js]
 [browser_ext_themes_sanitization.js]
 [browser_ext_themes_separators.js]
+[browser_ext_themes_static_onUpdated.js]
 [browser_ext_themes_sidebars.js]
-[browser_ext_themes_static_onUpdated.js]
 [browser_ext_themes_tab_line.js]
 [browser_ext_themes_tab_loading.js]
-[browser_ext_themes_tab_selected.js]
 [browser_ext_themes_tab_separators.js]
 [browser_ext_themes_tab_text.js]
 [browser_ext_themes_toolbar_fields_focus.js]
 [browser_ext_themes_toolbar_fields.js]
-[browser_ext_themes_toolbarbutton_colors.js]
+[browser_ext_themes_toolbars.js]
 [browser_ext_themes_toolbarbutton_icons.js]
-[browser_ext_themes_toolbars.js]
+[browser_ext_themes_toolbarbutton_colors.js]
 [browser_ext_themes_theme_transition.js]
+[browser_ext_themes_tab_selected.js]
 [browser_ext_themes_warnings.js]
 [browser_ext_windows_popup_title.js]
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_dynamic_getCurrent.js
+++ b/toolkit/components/extensions/test/browser/browser_ext_themes_dynamic_getCurrent.js
@@ -140,27 +140,27 @@ add_task(async function test_get_current
       await focusChanged;
       testTheme2(await browser.theme.getCurrent());
       testTheme1(await browser.theme.getCurrent(firstWin.id));
       testTheme2(await browser.theme.getCurrent(secondWin.id));
 
       browser.test.log("Testing getCurrent() after theme.reset(windowId)");
       await browser.theme.reset(firstWin.id);
       testTheme2(await browser.theme.getCurrent());
-      testTheme1(await browser.theme.getCurrent(firstWin.id));
+      testEmptyTheme(await browser.theme.getCurrent(firstWin.id));
       testTheme2(await browser.theme.getCurrent(secondWin.id));
 
       browser.test.log(
         "Testing getCurrent() after reset and window focus change"
       );
       focusChanged = ensureWindowFocused(firstWin.id);
       await browser.windows.update(firstWin.id, { focused: true });
       await focusChanged;
-      testTheme1(await browser.theme.getCurrent());
-      testTheme1(await browser.theme.getCurrent(firstWin.id));
+      testEmptyTheme(await browser.theme.getCurrent());
+      testEmptyTheme(await browser.theme.getCurrent(firstWin.id));
       testTheme2(await browser.theme.getCurrent(secondWin.id));
 
       browser.test.log("Testing getCurrent() after theme.update(windowId)");
       await browser.theme.update(firstWin.id, theme1);
       testTheme1(await browser.theme.getCurrent());
       testTheme1(await browser.theme.getCurrent(firstWin.id));
       testTheme2(await browser.theme.getCurrent(secondWin.id));
 
--- a/toolkit/components/extensions/test/browser/browser_ext_themes_reset.js
+++ b/toolkit/components/extensions/test/browser/browser_ext_themes_reset.js
@@ -1,11 +1,11 @@
 "use strict";
 
-add_task(async function theme_reset_global_static_theme() {
+add_task(async function theme_reset_by_extension() {
   let global_theme_extension = ExtensionTestUtils.loadExtension({
     manifest: {
       theme: {
         colors: {
           frame: "#123456",
           tab_background_text: "#fedcba",
         },
       },
@@ -46,67 +46,8 @@ add_task(async function theme_reset_glob
   });
   await global_theme_extension.startup();
   await extension.startup();
   await extension.awaitMessage("done");
 
   await global_theme_extension.unload();
   await extension.unload();
 });
-
-add_task(async function theme_reset_by_windowId() {
-  let extension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      permissions: ["theme"],
-    },
-    async background() {
-      let theme = {
-        colors: {
-          frame: "#CF723F",
-        },
-      };
-
-      let { id: winId } = await browser.windows.getCurrent();
-      await browser.theme.update(winId, theme);
-      let update_theme = await browser.theme.getCurrent(winId);
-
-      browser.test.onMessage.addListener(async () => {
-        let current_theme = await browser.theme.getCurrent(winId);
-        browser.test.assertEq(
-          update_theme.colors.frame,
-          current_theme.colors.frame,
-          "Should not be reset by a reset(windowId) call from another extension"
-        );
-
-        browser.test.sendMessage("done");
-      });
-
-      browser.test.sendMessage("ready", winId);
-    },
-  });
-
-  let anotherExtension = ExtensionTestUtils.loadExtension({
-    manifest: {
-      permissions: ["theme"],
-    },
-    background() {
-      browser.test.onMessage.addListener(async winId => {
-        await browser.theme.reset(winId);
-        browser.test.sendMessage("done");
-      });
-    },
-  });
-
-  await extension.startup();
-  let winId = await extension.awaitMessage("ready");
-
-  await anotherExtension.startup();
-
-  // theme.reset should be ignored if the theme was set by another extension.
-  anotherExtension.sendMessage(winId);
-  await anotherExtension.awaitMessage("done");
-
-  extension.sendMessage();
-  await extension.awaitMessage("done");
-
-  await anotherExtension.unload();
-  await extension.unload();
-});