Bug 1403680 - Screenshot configurations should supply a relative CSS selector. r?jaws draft
authorRand Mustafa <rndmustafa@gmail.com>
Thu, 05 Oct 2017 13:29:06 -0400
changeset 676259 3d0b23702ebe54666ebb50b73421839b4ce268d0
parent 675508 53bbdaaa2b8c1819061be26101b075c081b23260
child 677309 4c97624f9779a25598ee23c53acc45a824e41120
child 677311 8267c9dd29b79fee29a3e065a1753e786afa4d98
child 680426 b885e9b6b1ae0d543c86e0fddca2bf81818c4f98
push id83451
push userbmo:rndmustafa@gmail.com
push dateFri, 06 Oct 2017 23:53:17 +0000
reviewersjaws
bugs1403680
milestone58.0a1
Bug 1403680 - Screenshot configurations should supply a relative CSS selector. r?jaws Each configuration now has the selectors property, an array of strings containing it's css selectors. These selectors will be used to implement the automated cropping feature. MozReview-Commit-ID: GNqNiFhwIRk
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/AppMenu.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Buttons.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/CustomizeMode.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/DevTools.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/LightweightThemes.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/TabsInTitlebar.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Toolbars.jsm
browser/tools/mozscreenshots/mozscreenshots/extension/configurations/WindowSize.jsm
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/AppMenu.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/AppMenu.jsm
@@ -11,32 +11,35 @@ const {classes: Cc, interfaces: Ci, util
 Cu.import("resource://gre/modules/Services.jsm");
 
 this.AppMenu = {
 
   init(libDir) {},
 
   configurations: {
     appMenuClosed: {
+      selectors: ["#appMenu-popup"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         browserWindow.PanelUI.hide();
       },
     },
 
     appMenuMainView: {
+      selectors: ["#appMenu-popup"],
       applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let promise = browserWindow.PanelUI.show();
         browserWindow.PanelUI.showMainView();
         return promise;
       },
     },
 
     appMenuHistorySubview: {
+      selectors: ["#appMenu-popup"],
       applyConfig() {
         // History has a footer
         if (isCustomizing()) {
           return Promise.reject("Can't show subviews while customizing");
         }
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let promise = browserWindow.PanelUI.show();
         return promise.then(() => {
@@ -44,16 +47,17 @@ this.AppMenu = {
           browserWindow.document.getElementById("history-panelmenu").click();
         });
       },
 
       verifyConfig: verifyConfigHelper,
     },
 
     appMenuHelpSubview: {
+      selectors: ["#appMenu-popup"],
       applyConfig() {
         if (isCustomizing()) {
           return Promise.reject("Can't show subviews while customizing");
         }
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let promise = browserWindow.PanelUI.show();
         return promise.then(() => {
           browserWindow.PanelUI.showMainView();
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Buttons.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Buttons.jsm
@@ -14,42 +14,46 @@ Cu.import("resource://gre/modules/Servic
 this.Buttons = {
 
   init(libDir) {
     createWidget();
   },
 
   configurations: {
     navBarButtons: {
+      selectors: ["#nav-bar"],
       applyConfig: async () => {
         CustomizableUI.addWidgetToArea("screenshot-widget", CustomizableUI.AREA_NAVBAR);
       },
     },
 
     tabsToolbarButtons: {
+      selectors: ["#TabsToolbar"],
       applyConfig: async () => {
         CustomizableUI.addWidgetToArea("screenshot-widget", CustomizableUI.AREA_TABSTRIP);
       },
     },
 
     menuPanelButtons: {
+      selectors: ["#widget-overflow"],
       applyConfig: async () => {
-        CustomizableUI.addWidgetToArea("screenshot-widget", CustomizableUI.AREA_PANEL);
+        CustomizableUI.addWidgetToArea("screenshot-widget", CustomizableUI.AREA_FIXED_OVERFLOW_PANEL);
       },
 
       verifyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         if (browserWindow.PanelUI.panel.state == "closed") {
           return Promise.reject("The button isn't shown when the panel isn't open.");
         }
         return Promise.resolve("menuPanelButtons.verifyConfig");
       },
     },
 
     custPaletteButtons: {
+      selectors: ["#customization-palette"],
       applyConfig: async () => {
         CustomizableUI.removeWidgetFromArea("screenshot-widget");
       },
 
       verifyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         if (browserWindow.document.documentElement.getAttribute("customizing") != "true") {
           return Promise.reject("The button isn't shown when we're not in customize mode.");
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/ControlCenter.jsm
@@ -26,23 +26,25 @@ const MIXED_ACTIVE_CONTENT_URL = `https:
 const MIXED_PASSIVE_CONTENT_URL = `https://example.com/${RESOURCE_PATH}/mixed_passive.html`;
 const TRACKING_PAGE = `http://tracking.example.org/${RESOURCE_PATH}/tracking.html`;
 
 this.ControlCenter = {
   init(libDir) { },
 
   configurations: {
     about: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage("about:home");
         await openIdentityPopup();
       },
     },
 
     localFile: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         let channel = NetUtil.newChannel({
             uri: "chrome://mozscreenshots/content/lib/mozscreenshots.html",
             loadUsingSystemPrincipal: true
         });
         channel = channel.QueryInterface(Ci.nsIFileChannel);
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let gBrowser = browserWindow.gBrowser;
@@ -52,167 +54,186 @@ this.ControlCenter = {
       },
 
       async verifyConfig() {
         return Promise.reject("Bug 1373563: intermittent controlCenter_localFile on Taskcluster");
       },
     },
 
     http: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(HTTP_PAGE);
         await openIdentityPopup();
       },
     },
 
     httpSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(HTTP_PAGE);
         await openIdentityPopup(true);
       },
     },
 
     https: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(HTTPS_PAGE);
         await openIdentityPopup();
       },
     },
 
     httpsSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(HTTPS_PAGE);
         await openIdentityPopup(true);
       },
     },
 
     singlePermission: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         let uri = Services.io.newURI(PERMISSIONS_PAGE);
         SitePermissions.set(uri, "camera", SitePermissions.ALLOW);
 
         await loadPage(PERMISSIONS_PAGE);
         await openIdentityPopup();
       },
     },
 
     allPermissions: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         // TODO: (Bug 1330601) Rewrite this to consider temporary (TAB) permission states.
         // There are 2 possible non-default permission states, so we alternate between them.
         let states = [SitePermissions.ALLOW, SitePermissions.BLOCK];
         let uri = Services.io.newURI(PERMISSIONS_PAGE);
         SitePermissions.listPermissions().forEach(function(permission, index) {
           SitePermissions.set(uri, permission, states[index % 2]);
         });
 
         await loadPage(PERMISSIONS_PAGE);
         await openIdentityPopup();
       },
     },
 
     mixed: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(MIXED_CONTENT_URL);
         await openIdentityPopup();
       },
     },
 
     mixedSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(MIXED_CONTENT_URL);
         await openIdentityPopup(true);
       },
     },
 
     mixedPassive: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(MIXED_PASSIVE_CONTENT_URL);
         await openIdentityPopup();
       },
     },
 
     mixedPassiveSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(MIXED_PASSIVE_CONTENT_URL);
         await openIdentityPopup(true);
       },
     },
 
     mixedActive: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(MIXED_ACTIVE_CONTENT_URL);
         await openIdentityPopup();
       },
     },
 
     mixedActiveSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(MIXED_ACTIVE_CONTENT_URL);
         await openIdentityPopup(true);
       },
     },
 
     mixedActiveUnblocked: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let gBrowser = browserWindow.gBrowser;
         await loadPage(MIXED_ACTIVE_CONTENT_URL);
         gBrowser.ownerGlobal.gIdentityHandler.disableMixedContentProtection();
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, MIXED_ACTIVE_CONTENT_URL);
         await openIdentityPopup();
       },
     },
 
     mixedActiveUnblockedSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let gBrowser = browserWindow.gBrowser;
         await loadPage(MIXED_ACTIVE_CONTENT_URL);
         gBrowser.ownerGlobal.gIdentityHandler.disableMixedContentProtection();
         await BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser, false, MIXED_ACTIVE_CONTENT_URL);
         await openIdentityPopup(true);
       },
     },
 
     httpPassword: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(HTTP_PASSWORD_PAGE);
         await openIdentityPopup();
       },
     },
 
     httpPasswordSubView: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         await loadPage(HTTP_PASSWORD_PAGE);
         await openIdentityPopup(true);
       },
     },
 
     trackingProtectionNoElements: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
 
         await loadPage(HTTP_PAGE);
         await openIdentityPopup();
       },
     },
 
     trackingProtectionEnabled: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
         Services.prefs.setIntPref("privacy.trackingprotection.introCount", 20);
         await UrlClassifierTestUtils.addTestTrackers();
 
         await loadPage(TRACKING_PAGE);
         await openIdentityPopup();
       },
     },
 
     trackingProtectionDisabled: {
+      selectors: ["#identity-popup"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let gBrowser = browserWindow.gBrowser;
         Services.prefs.setBoolPref("privacy.trackingprotection.enabled", true);
         Services.prefs.setIntPref("privacy.trackingprotection.introCount", 20);
         await UrlClassifierTestUtils.addTestTrackers();
 
         await loadPage(TRACKING_PAGE);
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/CustomizeMode.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/CustomizeMode.jsm
@@ -12,16 +12,17 @@ Cu.import("resource://gre/modules/Servic
 Cu.import("resource://gre/modules/Timer.jsm");
 
 this.CustomizeMode = {
 
   init(libDir) {},
 
   configurations: {
     notCustomizing: {
+      selectors: ["#navigator-toolbox"],
       applyConfig() {
         return new Promise((resolve) => {
           let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
           if (!browserWindow.document.documentElement.hasAttribute("customizing")) {
             resolve("notCustomizing: already not customizing");
             return;
           }
           function onCustomizationEnds() {
@@ -33,16 +34,17 @@ this.CustomizeMode = {
           browserWindow.gNavToolbox.addEventListener("aftercustomization",
                                                      onCustomizationEnds);
           browserWindow.gCustomizeMode.exit();
         });
       },
     },
 
     customizing: {
+      selectors: ["#navigator-toolbox", "#customization-container"],
       applyConfig() {
         return new Promise((resolve) => {
           let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
           if (browserWindow.document.documentElement.hasAttribute("customizing")) {
             resolve("customizing: already customizing");
             return;
           }
           function onCustomizing() {
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/DevTools.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/DevTools.jsm
@@ -23,36 +23,41 @@ function getTargetForSelectedTab() {
 
 this.DevTools = {
   init(libDir) {
     let panels = ["options", "webconsole", "jsdebugger", "styleeditor",
                   "performance", "netmonitor"];
 
     panels.forEach(panel => {
       this.configurations[panel] = {};
+      this.configurations[panel].selectors = ["#toolbox-container"];
       this.configurations[panel].applyConfig = async function() {
         await gDevTools.showToolbox(getTargetForSelectedTab(), panel, "bottom");
         await new Promise(resolve => setTimeout(resolve, 500));
       };
     });
   },
 
   configurations: {
     bottomToolbox: {
+      selectors: ["#toolbox-container"],
       async applyConfig() {
         await gDevTools.showToolbox(getTargetForSelectedTab(), "inspector", "bottom");
         await new Promise(resolve => setTimeout(resolve, 1000));
       },
     },
     sideToolbox: {
+      selectors: ["#toolbox-container"],
       async applyConfig() {
         await gDevTools.showToolbox(getTargetForSelectedTab(), "inspector", "side");
         await new Promise(resolve => setTimeout(resolve, 500));
       },
     },
     undockedToolbox: {
+      selectors: ["#toolbox-container"],
+      windowType: "devtools:toolbox",
       async applyConfig() {
         await gDevTools.showToolbox(getTargetForSelectedTab(), "inspector", "window");
         await new Promise(resolve => setTimeout(resolve, 500));
       },
     }
   },
 };
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/LightweightThemes.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/LightweightThemes.jsm
@@ -22,22 +22,24 @@ this.LightweightThemes = {
     // convert -size 3000x200 canvas:#eee white_theme.png
     let whiteImage = libDir.clone();
     whiteImage.append("white_theme.png");
     this._whiteImageURL = Services.io.newFileURI(whiteImage).spec;
   },
 
   configurations: {
     noLWT: {
+      selectors: ["#navigator-toolbox"],
       async applyConfig() {
         LightweightThemeManager.currentTheme = null;
       },
     },
 
     darkLWT: {
+      selectors: ["#navigator-toolbox"],
       applyConfig() {
         LightweightThemeManager.setLocalTheme({
           id:          "black",
           name:        "black",
           headerURL:   LightweightThemes._blackImageURL,
           textcolor:   "#eeeeee",
           accentcolor: "#111111",
         });
@@ -47,16 +49,17 @@ this.LightweightThemes = {
           setTimeout(() => {
             resolve("darkLWT");
           }, 500);
         });
       },
     },
 
     lightLWT: {
+      selectors: ["#navigator-toolbox"],
       applyConfig() {
         LightweightThemeManager.setLocalTheme({
           id:          "white",
           name:        "white",
           headerURL:   LightweightThemes._whiteImageURL,
           textcolor:   "#111111",
           accentcolor: "#eeeeee",
         });
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/PermissionPrompts.jsm
@@ -23,81 +23,91 @@ this.PermissionPrompts = {
     Services.prefs.setCharPref("media.getusermedia.screensharing.allowed_domains",
                                "test1.example.com");
     Services.prefs.setBoolPref("extensions.install.requireBuiltInCerts", false);
     Services.prefs.setBoolPref("signon.rememberSignons", true);
   },
 
   configurations: {
     shareDevices: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#webRTC-shareDevices");
       },
     },
 
     shareMicrophone: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#webRTC-shareMicrophone");
       },
     },
 
     shareVideoAndMicrophone: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#webRTC-shareDevices2");
       },
     },
 
     shareScreen: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#webRTC-shareScreen");
       },
     },
 
     geo: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#geo");
       },
     },
 
     persistentStorage: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#persistent-storage");
       },
     },
 
     loginCapture: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#login-capture");
       },
     },
 
     notifications: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         await closeLastTab();
         await clickOn("#web-notifications");
       },
     },
 
     addons: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         Services.prefs.setBoolPref("xpinstall.whitelist.required", true);
 
         await closeLastTab();
         await clickOn("#addons");
       },
     },
 
     addonsNoWhitelist: {
+      selectors: ["#notification-popup"],
       async applyConfig() {
         Services.prefs.setBoolPref("xpinstall.whitelist.required", false);
 
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let notification = browserWindow.document.getElementById("addon-install-confirmation-notification");
 
         await closeLastTab();
         await clickOn("#addons");
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Preferences.jsm
@@ -30,16 +30,17 @@ this.Preferences = {
     ];
 
     for (let [primary, customFn] of panes) {
       let configName = primary.replace(/^pane/, "prefs");
       if (customFn) {
         configName += "-" + customFn.name;
       }
       this.configurations[configName] = {};
+      this.configurations[configName].selectors = ["#browser"];
       this.configurations[configName].applyConfig = prefHelper.bind(null, primary, customFn);
     }
   },
 
   configurations: {},
 };
 
 let prefHelper = async function(primary, customFn = null) {
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Tabs.jsm
@@ -16,27 +16,29 @@ const DEFAULT_FAVICON_TAB = `data:text/h
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/Timer.jsm");
 
 this.Tabs = {
   init(libDir) {},
 
   configurations: {
     fiveTabs: {
+      selectors: ["#tabbrowser-tabs"],
       async applyConfig() {
         fiveTabsHelper();
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         hoverTab(browserWindow.gBrowser.tabs[3]);
         await new Promise((resolve, reject) => {
           setTimeout(resolve, 3000);
         });
       },
     },
 
     fourPinned: {
+      selectors: ["#tabbrowser-tabs"],
       async applyConfig() {
         fiveTabsHelper();
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let tab = browserWindow.gBrowser.addTab(PREFS_TAB);
         browserWindow.gBrowser.pinTab(tab);
         tab = browserWindow.gBrowser.addTab(CUST_TAB);
         browserWindow.gBrowser.pinTab(tab);
         tab = browserWindow.gBrowser.addTab("about:privatebrowsing");
@@ -53,16 +55,17 @@ this.Tabs = {
                       setAttribute("beforehovered", true);
         await new Promise((resolve, reject) => {
           setTimeout(resolve, 3000);
         });
       },
     },
 
     twoPinnedWithOverflow: {
+      selectors: ["#tabbrowser-tabs"],
       async applyConfig() {
         fiveTabsHelper();
 
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         browserWindow.gBrowser.loadTabs([
           PREFS_TAB,
           CUST_TAB,
           "about:home",
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/TabsInTitlebar.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/TabsInTitlebar.jsm
@@ -13,25 +13,27 @@ const PREF_TABS_IN_TITLEBAR = "browser.t
 Cu.import("resource://gre/modules/Services.jsm");
 
 this.TabsInTitlebar = {
 
   init(libDir) {},
 
   configurations: {
     tabsInTitlebar: {
+      selectors: ["#navigator-toolbox"],
       async applyConfig() {
         if (Services.appinfo.OS == "Linux") {
           return Promise.reject("TabsInTitlebar isn't supported on Linux");
         }
         Services.prefs.setBoolPref(PREF_TABS_IN_TITLEBAR, true);
         return undefined;
       },
     },
 
     tabsOutsideTitlebar: {
+      selectors: ["#navigator-toolbox", "#titlebar"],
       async applyConfig() {
         Services.prefs.setBoolPref(PREF_TABS_IN_TITLEBAR, false);
       },
     },
 
   },
 };
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Toolbars.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/Toolbars.jsm
@@ -10,25 +10,27 @@ const {classes: Cc, interfaces: Ci, util
 
 Cu.import("resource://gre/modules/Services.jsm");
 
 this.Toolbars = {
   init(libDir) {},
 
   configurations: {
     onlyNavBar: {
+      selectors: ["#navigator-toolbox"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let personalToolbar = browserWindow.document.getElementById("PersonalToolbar");
         browserWindow.setToolbarVisibility(personalToolbar, false);
         toggleMenubarIfNecessary(false);
       },
     },
 
     allToolbars: {
+      selectors: ["#navigator-toolbox"],
       async applyConfig() { // Boookmarks and menubar
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         let personalToolbar = browserWindow.document.getElementById("PersonalToolbar");
         browserWindow.setToolbarVisibility(personalToolbar, true);
         toggleMenubarIfNecessary(true);
       },
 
       async verifyConfig() {
--- a/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/WindowSize.jsm
+++ b/browser/tools/mozscreenshots/mozscreenshots/extension/configurations/WindowSize.jsm
@@ -15,43 +15,46 @@ Cu.import("resource://testing-common/Bro
 this.WindowSize = {
 
   init(libDir) {
     Services.prefs.setBoolPref("browser.fullscreen.autohide", false);
   },
 
   configurations: {
     maximized: {
+      selectors: [":root"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         await toggleFullScreen(browserWindow, false);
 
         // Wait for the Lion fullscreen transition to end as there doesn't seem to be an event
         // and trying to maximize while still leaving fullscreen doesn't work.
         await new Promise((resolve, reject) => {
           setTimeout(function waitToLeaveFS() {
             browserWindow.maximize();
             resolve();
           }, 5000);
         });
       },
     },
 
     normal: {
+      selectors: [":root"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         await toggleFullScreen(browserWindow, false);
         browserWindow.restore();
         await new Promise((resolve, reject) => {
           setTimeout(resolve, 5000);
         });
       },
     },
 
     fullScreen: {
+      selectors: [":root"],
       async applyConfig() {
         let browserWindow = Services.wm.getMostRecentWindow("navigator:browser");
         await toggleFullScreen(browserWindow, true);
         // OS X Lion fullscreen transition takes a while
         await new Promise((resolve, reject) => {
           setTimeout(resolve, 5000);
         });
       },