Bug 1242137 - Fix eslint errors in /browser/components/customizableui. r?gijs draft
authorJared Wein <jwein@mozilla.com>
Sat, 23 Jan 2016 14:55:27 -0500
changeset 324610 768fb80e4652c1f0e14eea9e32da8eff795f1659
parent 324375 819fff092e3df644b03575577fd68af89dbbdf13
child 324612 9b67107d2e1f38d5b1ee5cb7ed7aeee5420397b2
push id9936
push userjwein@mozilla.com
push dateSat, 23 Jan 2016 19:55:54 +0000
reviewersgijs
bugs1242137
milestone46.0a1
Bug 1242137 - Fix eslint errors in /browser/components/customizableui. r?gijs
.eslintignore
browser/components/customizableui/CustomizableUI.jsm
browser/components/customizableui/CustomizableWidgets.jsm
browser/components/customizableui/CustomizeMode.jsm
browser/components/customizableui/PanelWideWidgetTracker.jsm
browser/components/customizableui/content/panelUI.js
browser/components/customizableui/logging.js
browser/components/customizableui/moz.build
browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
browser/components/customizableui/test/browser_1058573_showToolbarsDropdown.js
browser/components/customizableui/test/browser_1087303_button_fullscreen.js
browser/components/customizableui/test/browser_1087303_button_preferences.js
browser/components/customizableui/test/browser_873501_handle_specials.js
browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
browser/components/customizableui/test/browser_877006_missing_view.js
browser/components/customizableui/test/browser_877178_unregisterArea.js
browser/components/customizableui/test/browser_877447_skip_missing_ids.js
browser/components/customizableui/test/browser_878452_drag_to_panel.js
browser/components/customizableui/test/browser_880164_customization_context_menus.js
browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
browser/components/customizableui/test/browser_884402_customize_from_overflow.js
browser/components/customizableui/test/browser_885052_customize_mode_observers_disabed.js
browser/components/customizableui/test/browser_885530_showInPrivateBrowsing.js
browser/components/customizableui/test/browser_886323_buildArea_removable_nodes.js
browser/components/customizableui/test/browser_887438_currentset_shim.js
browser/components/customizableui/test/browser_888817_currentset_updating.js
browser/components/customizableui/test/browser_889120_customize_tab_merging.js
browser/components/customizableui/test/browser_890140_orphaned_placeholders.js
browser/components/customizableui/test/browser_890262_destroyWidget_after_add_to_panel.js
browser/components/customizableui/test/browser_892955_isWidgetRemovable_for_removed_widgets.js
browser/components/customizableui/test/browser_892956_destroyWidget_defaultPlacements.js
browser/components/customizableui/test/browser_901207_searchbar_in_panel.js
browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js
browser/components/customizableui/test/browser_913972_currentset_overflow.js
browser/components/customizableui/test/browser_914138_widget_API_overflowable_toolbar.js
browser/components/customizableui/test/browser_914863_disabled_help_quit_buttons.js
browser/components/customizableui/test/browser_918049_skipintoolbarset_dnd.js
browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
browser/components/customizableui/test/browser_927717_customize_drag_empty_toolbar.js
browser/components/customizableui/test/browser_932928_show_notice_when_palette_empty.js
browser/components/customizableui/test/browser_934113_menubar_removable.js
browser/components/customizableui/test/browser_934951_zoom_in_toolbar.js
browser/components/customizableui/test/browser_938980_navbar_collapsed.js
browser/components/customizableui/test/browser_940013_registerToolbarNode_calls_registerArea.js
browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
browser/components/customizableui/test/browser_940946_removable_from_navbar_customizemode.js
browser/components/customizableui/test/browser_942581_unregisterArea_keeps_placements.js
browser/components/customizableui/test/browser_943683_migration_test.js
browser/components/customizableui/test/browser_944887_destroyWidget_should_destroy_in_palette.js
browser/components/customizableui/test/browser_945739_showInPrivateBrowsing_customize_mode.js
browser/components/customizableui/test/browser_946320_tabs_from_other_computers.js
browser/components/customizableui/test/browser_947914_button_addons.js
browser/components/customizableui/test/browser_947914_button_copy.js
browser/components/customizableui/test/browser_947914_button_cut.js
browser/components/customizableui/test/browser_947914_button_find.js
browser/components/customizableui/test/browser_947914_button_history.js
browser/components/customizableui/test/browser_947914_button_newPrivateWindow.js
browser/components/customizableui/test/browser_947914_button_newWindow.js
browser/components/customizableui/test/browser_947914_button_paste.js
browser/components/customizableui/test/browser_947914_button_print.js
browser/components/customizableui/test/browser_947914_button_savePage.js
browser/components/customizableui/test/browser_947914_button_zoomIn.js
browser/components/customizableui/test/browser_947914_button_zoomOut.js
browser/components/customizableui/test/browser_947914_button_zoomReset.js
browser/components/customizableui/test/browser_947987_removable_default.js
browser/components/customizableui/test/browser_952963_areaType_getter_no_area.js
browser/components/customizableui/test/browser_956602_remove_special_widget.js
browser/components/customizableui/test/browser_962884_opt_in_disable_hyphens.js
browser/components/customizableui/test/browser_963639_customizing_attribute_non_customizable_toolbar.js
browser/components/customizableui/test/browser_967000_button_charEncoding.js
browser/components/customizableui/test/browser_967000_button_feeds.js
browser/components/customizableui/test/browser_967000_button_sync.js
browser/components/customizableui/test/browser_968447_bookmarks_toolbar_items_in_panel.js
browser/components/customizableui/test/browser_968565_insert_before_hidden_items.js
browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js
browser/components/customizableui/test/browser_970511_undo_restore_default.js
browser/components/customizableui/test/browser_972267_customizationchange_events.js
browser/components/customizableui/test/browser_973641_button_addon.js
browser/components/customizableui/test/browser_973932_addonbar_currentset.js
browser/components/customizableui/test/browser_975719_customtoolbars_behaviour.js
browser/components/customizableui/test/browser_976792_insertNodeInWindow.js
browser/components/customizableui/test/browser_978084_dragEnd_after_move.js
browser/components/customizableui/test/browser_980155_add_overflow_toolbar.js
browser/components/customizableui/test/browser_981305_separator_insertion.js
browser/components/customizableui/test/browser_981418-widget-onbeforecreated-handler.js
browser/components/customizableui/test/browser_982656_restore_defaults_builtin_widgets.js
browser/components/customizableui/test/browser_985815_propagate_setToolbarVisibility.js
browser/components/customizableui/test/browser_987640_charEncoding.js
browser/components/customizableui/test/browser_989751_subviewbutton_class.js
browser/components/customizableui/test/browser_panel_toggle.js
browser/components/customizableui/test/head.js
toolkit/modules/AppConstants.jsm
toolkit/modules/moz.build
--- a/.eslintignore
+++ b/.eslintignore
@@ -59,17 +59,16 @@ b2g/locales/en-US/b2g-l10n.js
 
 # browser/ exclusions
 browser/app/**
 browser/base/content/browser-social.js
 browser/base/content/nsContextMenu.js
 browser/base/content/sanitizeDialog.js
 browser/base/content/test/**
 browser/base/content/newtab/**
-browser/components/customizableui/**
 browser/components/downloads/**
 browser/components/feeds/**
 browser/components/migration/**
 browser/components/nsBrowserGlue.js
 browser/components/pocket/**
 browser/components/preferences/**
 browser/components/privatebrowsing/**
 browser/components/sessionstore/**
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -5,16 +5,17 @@
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["CustomizableUI"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PanelWideWidgetTracker",
   "resource:///modules/PanelWideWidgetTracker.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableWidgets",
   "resource:///modules/CustomizableWidgets.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask",
   "resource://gre/modules/DeferredTask.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
@@ -36,17 +37,16 @@ const kSpecialWidgetPfx = "customizableu
 const kPrefCustomizationState        = "browser.uiCustomization.state";
 const kPrefCustomizationAutoAdd      = "browser.uiCustomization.autoAdd";
 const kPrefCustomizationDebug        = "browser.uiCustomization.debug";
 const kPrefDrawInTitlebar            = "browser.tabs.drawInTitlebar";
 const kPrefWebIDEInNavbar            = "devtools.webide.widget.inNavbarByDefault";
 
 const kExpectedWindowURL = "chrome://browser/content/browser.xul";
 
-
 /**
  * The keys are the handlers that are fired when the event type (the value)
  * is fired on the subview. A widget that provides a subview has the option
  * of providing onViewShowing and onViewHiding event handlers.
  */
 const kSubviewEvents = [
   "ViewShowing",
   "ViewHiding"
@@ -151,22 +151,33 @@ var gSingleWrapperCache = new WeakMap();
 var gListeners = new Set();
 
 var gUIStateBeforeReset = {
   uiCustomizationState: null,
   drawInTitlebar: null,
   gUIStateBeforeReset: null,
 };
 
-var gModuleName = "[CustomizableUI]";
-#include logging.js
+XPCOMUtils.defineLazyGetter(this, "log", () => {
+  let scope = {};
+  Cu.import("resource://gre/modules/Console.jsm", scope);
+  let debug;
+  try {
+    debug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
+  } catch (ex) {}
+  let consoleOptions = {
+    maxLogLevel: debug ? "all" : "log",
+    prefix: "CustomizableUI",
+  };
+  return new scope.ConsoleAPI(consoleOptions);
+});
 
 var CustomizableUIInternal = {
   initialize: function() {
-    LOG("Initializing");
+    log.debug("Initializing");
 
     this.addListener(this);
     this._defineBuiltInWidgets();
     this.loadSavedState();
     this._introduceNewBuiltinWidgets();
     this._markObsoleteBuiltinButtonsSeen();
 
     let panelPlacements = [
@@ -176,30 +187,31 @@ var CustomizableUIInternal = {
       "privatebrowsing-button",
       "save-page-button",
       "print-button",
       "history-panelmenu",
       "fullscreen-button",
       "find-button",
       "preferences-button",
       "add-ons-button",
-#ifndef MOZ_DEV_EDITION
-      "developer-button",
-#endif
       "sync-button",
     ];
 
-#ifdef E10S_TESTING_ONLY
-    if (gPalette.has("e10s-button")) {
-      let newWindowIndex = panelPlacements.indexOf("new-window-button");
-      if (newWindowIndex > -1) {
-        panelPlacements.splice(newWindowIndex + 1, 0, "e10s-button");
+    if (!AppConstants.MOZ_DEV_EDITION) {
+      panelPlacements.splice(-1, 0, "developer-button");
+    }
+
+    if (AppConstants.E10S_TESTING_ONLY) {
+      if (gPalette.has("e10s-button")) {
+        let newWindowIndex = panelPlacements.indexOf("new-window-button");
+        if (newWindowIndex > -1) {
+          panelPlacements.splice(newWindowIndex + 1, 0, "e10s-button");
+        }
       }
     }
-#endif
 
     let showCharacterEncoding = Services.prefs.getComplexValue(
       "browser.menu.showCharacterEncoding",
       Ci.nsIPrefLocalizedString
     ).data;
     if (showCharacterEncoding == "true") {
       panelPlacements.push("characterencoding-button");
     }
@@ -209,59 +221,62 @@ var CustomizableUIInternal = {
       type: CustomizableUI.TYPE_MENU_PANEL,
       defaultPlacements: panelPlacements
     }, true);
     PanelWideWidgetTracker.init();
 
     let navbarPlacements = [
       "urlbar-container",
       "search-container",
-#ifdef MOZ_DEV_EDITION
-      "developer-button",
-#endif
       "bookmarks-menu-button",
       "downloads-button",
       "home-button",
       "loop-button",
     ];
 
+    if (AppConstants.MOZ_DEV_EDITION) {
+      navbarPlacements.splice(2, 0, "developer-button");
+    }
+
     if (Services.prefs.getBoolPref(kPrefWebIDEInNavbar)) {
       navbarPlacements.push("webide-button");
     }
 
     this.registerArea(CustomizableUI.AREA_NAVBAR, {
       legacy: true,
       type: CustomizableUI.TYPE_TOOLBAR,
       overflowable: true,
       defaultPlacements: navbarPlacements,
       defaultCollapsed: false,
     }, true);
-#ifndef XP_MACOSX
-    this.registerArea(CustomizableUI.AREA_MENUBAR, {
-      legacy: true,
-      type: CustomizableUI.TYPE_TOOLBAR,
-      defaultPlacements: [
-        "menubar-items",
-      ],
-      get defaultCollapsed() {
-#ifdef MENUBAR_CAN_AUTOHIDE
-#if defined(MOZ_WIDGET_GTK) || defined(MOZ_WIDGET_QT)
-        return true;
-#else
-        // This is duplicated logic from /browser/base/jar.mn
-        // for win6BrowserOverlay.xul.
-        return Services.appinfo.OS == "WINNT" &&
-               Services.sysinfo.getProperty("version") != "5.1";
-#endif
-#else
-        return false;
-#endif
-      }
-    }, true);
-#endif
+
+    if (AppConstants.platform != "macosx") {
+      this.registerArea(CustomizableUI.AREA_MENUBAR, {
+        legacy: true,
+        type: CustomizableUI.TYPE_TOOLBAR,
+        defaultPlacements: [
+          "menubar-items",
+        ],
+        get defaultCollapsed() {
+          if (AppConstants.MENUBAR_CAN_AUTOHIDE) {
+            if (AppConstants.platform == "linux") {
+              return true;
+            } else {
+              // This is duplicated logic from /browser/base/jar.mn
+              // for win6BrowserOverlay.xul.
+              return Services.appinfo.OS == "WINNT" &&
+                     Services.sysinfo.getProperty("version") != "5.1";
+            }
+          } else {
+            return false;
+          }
+        }
+      }, true);
+    }
+
     this.registerArea(CustomizableUI.AREA_TABSTRIP, {
       legacy: true,
       type: CustomizableUI.TYPE_TOOLBAR,
       defaultPlacements: [
         "tabbrowser-tabs",
         "new-tab-button",
         "alltabs-button",
       ],
@@ -280,25 +295,26 @@ var CustomizableUIInternal = {
       type: CustomizableUI.TYPE_TOOLBAR,
       legacy: true,
       defaultPlacements: ["addonbar-closebutton", "status-bar"],
       defaultCollapsed: false,
     }, true);
   },
 
   get _builtinToolbars() {
-    return new Set([
+    let toolbars = new Set([
       CustomizableUI.AREA_NAVBAR,
       CustomizableUI.AREA_BOOKMARKS,
       CustomizableUI.AREA_TABSTRIP,
       CustomizableUI.AREA_ADDONBAR,
-#ifndef XP_MACOSX
-      CustomizableUI.AREA_MENUBAR,
-#endif
     ]);
+    if (AppConstants.platform != "macosx") {
+      toolbars.add(CustomizableUI.AREA_MENUBAR);
+    }
+    return toolbars;
   },
 
   _defineBuiltInWidgets: function() {
     for (let widgetDefinition of CustomizableWidgets) {
       this.createBuiltinWidget(widgetDefinition);
     }
   },
 
@@ -686,17 +702,17 @@ var CustomizableUIInternal = {
 
         if (this.isSpecialWidget(id) && areaIsPanel) {
           placementsToRemove.add(id);
           continue;
         }
 
         let [provider, node] = this.getWidgetNode(id, window);
         if (!node) {
-          LOG("Unknown widget: " + id);
+          log.debug("Unknown widget: " + id);
           continue;
         }
 
         // If the placements have items in them which are (now) no longer removable,
         // we shouldn't be moving them:
         if (provider == CustomizableUI.PROVIDER_API) {
           let widgetInfo = gPalette.get(id);
           if (!widgetInfo.removable && aArea != widgetInfo.defaultArea) {
@@ -751,18 +767,18 @@ var CustomizableUIInternal = {
               if (palette && !this.isSpecialWidget(node.id)) {
                 palette.appendChild(node);
                 this.removeLocationAttributes(node);
               } else {
                 container.removeChild(node);
               }
             } else {
               node.setAttribute("removable", false);
-              LOG("Adding non-removable widget to placements of " + aArea + ": " +
-                  node.id);
+              log.debug("Adding non-removable widget to placements of " + aArea + ": " +
+                        node.id);
               gPlacements.get(aArea).push(node.id);
               gDirty = true;
             }
           }
           node = previousSibling;
         }
       }
 
@@ -851,33 +867,33 @@ var CustomizableUIInternal = {
                        this.createSpecialWidget(aWidgetId, document);
       return [ CustomizableUI.PROVIDER_SPECIAL, widgetNode];
     }
 
     let widget = gPalette.get(aWidgetId);
     if (widget) {
       // If we have an instance of this widget already, just use that.
       if (widget.instances.has(document)) {
-        LOG("An instance of widget " + aWidgetId + " already exists in this "
-            + "document. Reusing.");
+        log.debug("An instance of widget " + aWidgetId + " already exists in this "
+                  + "document. Reusing.");
         return [ CustomizableUI.PROVIDER_API,
                  widget.instances.get(document) ];
       }
 
       return [ CustomizableUI.PROVIDER_API,
                this.buildWidget(document, widget) ];
     }
 
-    LOG("Searching for " + aWidgetId + " in toolbox.");
+    log.debug("Searching for " + aWidgetId + " in toolbox.");
     let node = this.findWidgetInWindow(aWidgetId, aWindow);
     if (node) {
       return [ CustomizableUI.PROVIDER_XUL, node ];
     }
 
-    LOG("No node for " + aWidgetId + " found.");
+    log.debug("No node for " + aWidgetId + " found.");
     return [null, null];
   },
 
   registerMenuPanel: function(aPanelContents) {
     if (gBuildAreas.has(CustomizableUI.AREA_PANEL) &&
         gBuildAreas.get(CustomizableUI.AREA_PANEL).has(aPanelContents)) {
       return;
     }
@@ -937,17 +953,17 @@ var CustomizableUIInternal = {
 
       let container = areaNode.customizationTarget;
       let widgetNode = window.document.getElementById(aWidgetId);
       if (widgetNode && isOverflowable) {
         container = areaNode.overflowable.getContainerFor(widgetNode);
       }
 
       if (!widgetNode || !container.contains(widgetNode)) {
-        INFO("Widget " + aWidgetId + " not found, unable to remove from " + aArea);
+        log.info("Widget " + aWidgetId + " not found, unable to remove from " + aArea);
         continue;
       }
 
       this.notifyListeners("onWidgetBeforeDOMChange", widgetNode, null, container, true);
 
       // We remove location attributes here to make sure they're gone too when a
       // widget is removed from a toolbar to the palette. See bug 930950.
       this.removeLocationAttributes(widgetNode);
@@ -1089,18 +1105,18 @@ var CustomizableUIInternal = {
   insertNode: function(aWidgetId, aArea, aPosition, isNew) {
     let areaNodes = gBuildAreas.get(aArea);
     if (!areaNodes) {
       return;
     }
 
     let placements = gPlacements.get(aArea);
     if (!placements) {
-      ERROR("Could not find any placements for " + aArea +
-            " when moving a widget.");
+      log.error("Could not find any placements for " + aArea +
+                " when moving a widget.");
       return;
     }
 
     // Go through each of the nodes associated with this area and move the
     // widget to the requested location.
     for (let areaNode of areaNodes) {
       this.insertNodeInWindow(aWidgetId, areaNode, isNew);
     }
@@ -1113,17 +1129,17 @@ var CustomizableUIInternal = {
                               : true;
 
     if (!showInPrivateBrowsing && PrivateBrowsingUtils.isWindowPrivate(window)) {
       return;
     }
 
     let [, widgetNode] = this.getWidgetNode(aWidgetId, window);
     if (!widgetNode) {
-      ERROR("Widget '" + aWidgetId + "' not found, unable to move");
+      log.error("Widget '" + aWidgetId + "' not found, unable to move");
       return;
     }
 
     let areaId = aAreaNode.id;
     if (isNew) {
       this.ensureButtonContextMenu(widgetNode, aAreaNode);
       if (widgetNode.localName == "toolbarbutton" && areaId == CustomizableUI.AREA_PANEL) {
         widgetNode.setAttribute("wrap", "true");
@@ -1233,17 +1249,17 @@ var CustomizableUIInternal = {
    * for an API-provided widget or a special widget.
    */
   findWidgetInWindow: function(aId, aWindow) {
     if (!gBuildWindows.has(aWindow)) {
       throw new Error("Build window not registered");
     }
 
     if (!aId) {
-      ERROR("findWidgetInWindow was passed an empty string.");
+      log.error("findWidgetInWindow was passed an empty string.");
       return null;
     }
 
     let document = aWindow.document;
 
     // look for a node with the same id, as the node may be
     // in a different toolbar.
     let node = document.getElementById(aId);
@@ -1300,25 +1316,25 @@ var CustomizableUIInternal = {
     }
     if (typeof aWidget == "string") {
       aWidget = gPalette.get(aWidget);
     }
     if (!aWidget) {
       throw new Error("buildWidget was passed a non-widget to build.");
     }
 
-    LOG("Building " + aWidget.id + " of type " + aWidget.type);
+    log.debug("Building " + aWidget.id + " of type " + aWidget.type);
 
     let node;
     if (aWidget.type == "custom") {
       if (aWidget.onBuild) {
         node = aWidget.onBuild(aDocument);
       }
       if (!node || !(node instanceof aDocument.defaultView.XULElement))
-        ERROR("Custom widget with id " + aWidget.id + " does not return a valid node");
+        log.error("Custom widget with id " + aWidget.id + " does not return a valid node");
     }
     else {
       if (aWidget.onBeforeCreated) {
         aWidget.onBeforeCreated(aDocument);
       }
       node = aDocument.createElementNS(kNSXUL, "toolbarbutton");
 
       node.setAttribute("id", aWidget.id);
@@ -1331,18 +1347,18 @@ var CustomizableUIInternal = {
       node.setAttribute("overflows", aWidget.overflows);
       node.setAttribute("label", this.getLocalizedProperty(aWidget, "label"));
       let additionalTooltipArguments = [];
       if (aWidget.shortcutId) {
         let keyEl = aDocument.getElementById(aWidget.shortcutId);
         if (keyEl) {
           additionalTooltipArguments.push(ShortcutUtils.prettifyShortcut(keyEl));
         } else {
-          ERROR("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id +
-                "' not found!");
+          log.error("Key element with id '" + aWidget.shortcutId + "' for widget '" + aWidget.id +
+                    "' not found!");
         }
       }
 
       let tooltip = this.getLocalizedProperty(aWidget, "tooltiptext", additionalTooltipArguments);
       if (tooltip) {
         node.setAttribute("tooltiptext", tooltip);
       }
       node.setAttribute("class", "toolbarbutton-1 chromeclass-toolbar-additional");
@@ -1350,35 +1366,35 @@ var CustomizableUIInternal = {
       let commandHandler = this.handleWidgetCommand.bind(this, aWidget, node);
       node.addEventListener("command", commandHandler, false);
       let clickHandler = this.handleWidgetClick.bind(this, aWidget, node);
       node.addEventListener("click", clickHandler, false);
 
       // If the widget has a view, and has view showing / hiding listeners,
       // hook those up to this widget.
       if (aWidget.type == "view") {
-        LOG("Widget " + aWidget.id + " has a view. Auto-registering event handlers.");
+        log.debug("Widget " + aWidget.id + " has a view. Auto-registering event handlers.");
         let viewNode = aDocument.getElementById(aWidget.viewId);
 
         if (viewNode) {
           // PanelUI relies on the .PanelUI-subView class to be able to show only
           // one sub-view at a time.
           viewNode.classList.add("PanelUI-subView");
 
           for (let eventName of kSubviewEvents) {
             let handler = "on" + eventName;
             if (typeof aWidget[handler] == "function") {
               viewNode.addEventListener(eventName, aWidget[handler], false);
             }
           }
 
-          LOG("Widget " + aWidget.id + " showing and hiding event handlers set.");
+          log.debug("Widget " + aWidget.id + " showing and hiding event handlers set.");
         } else {
-          ERROR("Could not find the view node with id: " + aWidget.viewId +
-                ", for widget: " + aWidget.id + ".");
+          log.error("Could not find the view node with id: " + aWidget.viewId +
+                    ", for widget: " + aWidget.id + ".");
         }
       }
 
       if (aWidget.onCreated) {
         aWidget.onCreated(node);
       }
     }
 
@@ -1414,17 +1430,17 @@ var CustomizableUIInternal = {
         return gWidgetsBundle.formatStringFromName(name, aFormatArgs,
           aFormatArgs.length) || def;
       }
       return gWidgetsBundle.GetStringFromName(name) || def;
     } catch(ex) {
       // If an empty string was explicitly passed, treat it as an actual
       // value rather than a missing property.
       if (!def && (name != "" || kReqStringProps.includes(aProp))) {
-        ERROR("Could not localize property '" + name + "'.");
+        log.error("Could not localize property '" + name + "'.");
       }
     }
     return def;
   },
 
   addShortcut: function(aShortcutNode, aTargetNode) {
     if (!aTargetNode)
       aTargetNode = aShortcutNode;
@@ -1446,24 +1462,24 @@ var CustomizableUIInternal = {
     if (!shortcut) {
       return;
     }
 
     aTargetNode.setAttribute("shortcut", ShortcutUtils.prettifyShortcut(shortcut));
   },
 
   handleWidgetCommand: function(aWidget, aNode, aEvent) {
-    LOG("handleWidgetCommand");
+    log.debug("handleWidgetCommand");
 
     if (aWidget.type == "button") {
       if (aWidget.onCommand) {
         try {
           aWidget.onCommand.call(null, aEvent);
         } catch (e) {
-          ERROR(e);
+          log.error(e);
         }
       } else {
         //XXXunf Need to think this through more, and formalize.
         Services.obs.notifyObservers(aNode,
                                      "customizedui-widget-command",
                                      aWidget.id);
       }
     } else if (aWidget.type == "view") {
@@ -1477,17 +1493,17 @@ var CustomizableUIInternal = {
           anchor = wrapper.anchor;
         }
       }
       ownerWindow.PanelUI.showSubView(aWidget.viewId, anchor, area);
     }
   },
 
   handleWidgetClick: function(aWidget, aNode, aEvent) {
-    LOG("handleWidgetClick");
+    log.debug("handleWidgetClick");
     if (aWidget.onClick) {
       try {
         aWidget.onClick.call(null, aEvent);
       } catch(e) {
         Cu.reportError(e);
       }
     } else {
       //XXXunf Need to think this through more, and formalize.
@@ -1641,17 +1657,17 @@ var CustomizableUIInternal = {
       // If consumers don't want this to happen, they should specify the closemenu
       // attribute.
 
     } else if (aEvent.type != "command") { // mouse events:
       if (aEvent.defaultPrevented || aEvent.button != 0) {
         return;
       }
       let isInteractive = this._isOnInteractiveElement(aEvent);
-      LOG("maybeAutoHidePanel: interactive ? " + isInteractive);
+      log.debug("maybeAutoHidePanel: interactive ? " + isInteractive);
       if (isInteractive) {
         return;
       }
     }
 
     // We can't use event.target because we might have passed a panelview
     // anonymous content boundary as well, and so target points to the
     // panelmultiview in that case. Unfortunately, this means we get
@@ -1701,19 +1717,19 @@ var CustomizableUIInternal = {
     for (let [id, widget] of gPalette) {
       if (!widget.currentArea) {
         if (widget.showInPrivateBrowsing || !isWindowPrivate) {
           widgets.add(id);
         }
       }
     }
 
-    LOG("Iterating the actual nodes of the window palette");
+    log.debug("Iterating the actual nodes of the window palette");
     for (let node of aWindowPalette.children) {
-      LOG("In palette children: " + node.id);
+      log.debug("In palette children: " + node.id);
       if (node.id && !this.getPlacementOfWidget(node.id)) {
         widgets.add(node.id);
       }
     }
 
     return [...widgets];
   },
 
@@ -1902,33 +1918,33 @@ var CustomizableUIInternal = {
   // built lazily - and therefore wouldn't otherwise result in restoring its
   // state immediately when a browser window opens, which is important for
   // other consumers of this API.
   loadSavedState: function() {
     let state = null;
     try {
       state = Services.prefs.getCharPref(kPrefCustomizationState);
     } catch (e) {
-      LOG("No saved state found");
+      log.debug("No saved state found");
       // This will fail if nothing has been customized, so silently fall back to
       // the defaults.
     }
 
     if (!state) {
       return;
     }
     try {
       gSavedState = JSON.parse(state);
       if (typeof gSavedState != "object" || gSavedState === null) {
         throw "Invalid saved state";
       }
     } catch(e) {
       Services.prefs.clearUserPref(kPrefCustomizationState);
       gSavedState = {};
-      LOG("Error loading saved UI customization state, falling back to defaults.");
+      log.debug("Error loading saved UI customization state, falling back to defaults.");
     }
 
     if (!("placements" in gSavedState)) {
       gSavedState.placements = {};
     }
 
     if (!("currentVersion" in gSavedState)) {
       gSavedState.currentVersion = 0;
@@ -1943,46 +1959,46 @@ var CustomizableUIInternal = {
     let placementsPreexisted = gPlacements.has(aArea);
 
     this.beginBatchUpdate();
     try {
       gRestoring = true;
 
       let restored = false;
       if (placementsPreexisted) {
-        LOG("Restoring " + aArea + " from pre-existing placements");
+        log.debug("Restoring " + aArea + " from pre-existing placements");
         for (let [position, id] in Iterator(gPlacements.get(aArea))) {
           this.moveWidgetWithinArea(id, position);
         }
         gDirty = false;
         restored = true;
       } else {
         gPlacements.set(aArea, []);
       }
 
       if (!restored && gSavedState && aArea in gSavedState.placements) {
-        LOG("Restoring " + aArea + " from saved state");
+        log.debug("Restoring " + aArea + " from saved state");
         let placements = gSavedState.placements[aArea];
         for (let id of placements)
           this.addWidgetToArea(id, aArea);
         gDirty = false;
         restored = true;
       }
 
       if (!restored && aLegacyState) {
-        LOG("Restoring " + aArea + " from legacy state");
+        log.debug("Restoring " + aArea + " from legacy state");
         for (let id of aLegacyState)
           this.addWidgetToArea(id, aArea);
         // Don't override dirty state, to ensure legacy state is saved here and
         // therefore only used once.
         restored = true;
       }
 
       if (!restored) {
-        LOG("Restoring " + aArea + " from default state");
+        log.debug("Restoring " + aArea + " from default state");
         let defaults = gAreas.get(aArea).get("defaultPlacements");
         if (defaults) {
           for (let id of defaults)
             this.addWidgetToArea(id, aArea, null, true);
         }
         gDirty = false;
       }
 
@@ -1990,17 +2006,17 @@ var CustomizableUIInternal = {
       // to be restored. This can occur when add-ons register widgets for a
       // lazily-restored area before it's been restored.
       if (gFuturePlacements.has(aArea)) {
         for (let id of gFuturePlacements.get(aArea))
           this.addWidgetToArea(id, aArea);
         gFuturePlacements.delete(aArea);
       }
 
-      LOG("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t"));
+      log.debug("Placements for " + aArea + ":\n\t" + gPlacements.get(aArea).join("\n\t"));
 
       gRestoring = false;
     } finally {
       this.endBatchUpdate();
     }
   },
 
   saveState: function() {
@@ -2021,19 +2037,19 @@ var CustomizableUIInternal = {
       for (let area of Object.keys(gSavedState.placements)) {
         if (!state.placements.has(area)) {
           let placements = gSavedState.placements[area];
           state.placements.set(area, placements);
         }
       }
     }
 
-    LOG("Saving state.");
+    log.debug("Saving state.");
     let serialized = JSON.stringify(state, this.serializerHelper);
-    LOG("State saved as: " + serialized);
+    log.debug("State saved as: " + serialized);
     Services.prefs.setCharPref(kPrefCustomizationState, serialized);
     gDirty = false;
   },
 
   serializerHelper: function(aKey, aValue) {
     if (typeof aValue == "object" && aValue.constructor.name == "Map") {
       let result = {};
       for (let [mapKey, mapValue] of aValue)
@@ -2082,17 +2098,17 @@ var CustomizableUIInternal = {
     }
 
     for (let listener of gListeners) {
       try {
         if (typeof listener[aEvent] == "function") {
           listener[aEvent].apply(listener, aArgs);
         }
       } catch (e) {
-        ERROR(e + " -- " + e.fileName + ":" + e.lineNumber);
+        log.error(e + " -- " + e.fileName + ":" + e.lineNumber);
       }
     }
   },
 
   _dispatchToolboxEventToWindow: function(aEventType, aDetails, aWindow) {
     let evt = new aWindow.CustomEvent(aEventType, {
       bubbles: true,
       cancelable: true,
@@ -2109,17 +2125,18 @@ var CustomizableUIInternal = {
       this._dispatchToolboxEventToWindow(aEventType, aDetails, win);
     }
   },
 
   createWidget: function(aProperties) {
     let widget = this.normalizeWidget(aProperties, CustomizableUI.SOURCE_EXTERNAL);
     //XXXunf This should probably throw.
     if (!widget) {
-      return;
+      log.error("unable to normalize widget");
+      return undefined;
     }
 
     gPalette.set(widget.id, widget);
 
     // Clear our caches:
     gGroupWrapperCache.delete(widget.id);
     for (let [win, ] of gBuildWindows) {
       let cache = gSingleWrapperCache.get(win);
@@ -2236,21 +2253,21 @@ var CustomizableUIInternal = {
     // destroyed and removed from the area based on criteria that may not be
     // available when the widget is created -- for example, because some other
     // feature in the browser supersedes the widget.
     let conditionalDestroyPromise = aData.conditionalDestroyPromise || null;
     delete aData.conditionalDestroyPromise;
 
     let widget = this.normalizeWidget(aData, CustomizableUI.SOURCE_BUILTIN);
     if (!widget) {
-      ERROR("Error creating builtin widget: " + aData.id);
+      log.error("Error creating builtin widget: " + aData.id);
       return;
     }
 
-    LOG("Creating built-in widget with id: " + widget.id);
+    log.debug("Creating built-in widget with id: " + widget.id);
     gPalette.set(widget.id, widget);
 
     if (conditionalDestroyPromise) {
       conditionalDestroyPromise.then(shouldDestroy => {
         if (shouldDestroy) {
           this.destroyWidget(widget.id);
           this.removeWidgetFromArea(widget.id);
         }
@@ -2280,28 +2297,28 @@ var CustomizableUIInternal = {
       defaultArea: null,
       shortcutId: null,
       tooltiptext: null,
       showInPrivateBrowsing: true,
       _introducedInVersion: -1,
     };
 
     if (typeof aData.id != "string" || !/^[a-z0-9-_]{1,}$/i.test(aData.id)) {
-      ERROR("Given an illegal id in normalizeWidget: " + aData.id);
+      log.error("Given an illegal id in normalizeWidget: " + aData.id);
       return null;
     }
 
     delete widget.implementation.currentArea;
     widget.implementation.__defineGetter__("currentArea", () => widget.currentArea);
 
     const kReqStringProps = ["id"];
     for (let prop of kReqStringProps) {
       if (typeof aData[prop] != "string") {
-        ERROR("Missing required property '" + prop + "' in normalizeWidget: "
-              + aData.id);
+        log.error("Missing required property '" + prop + "' in normalizeWidget: "
+                  + aData.id);
         return null;
       }
       widget[prop] = aData[prop];
     }
 
     const kOptStringProps = ["label", "tooltiptext", "shortcutId"];
     for (let prop of kOptStringProps) {
       if (typeof aData[prop] == "string") {
@@ -2316,19 +2333,19 @@ var CustomizableUIInternal = {
       }
     }
 
     // When we normalize builtin widgets, areas have not yet been registered:
     if (aData.defaultArea &&
         (aSource == CustomizableUI.SOURCE_BUILTIN || gAreas.has(aData.defaultArea))) {
       widget.defaultArea = aData.defaultArea;
     } else if (!widget.removable) {
-      ERROR("Widget '" + widget.id + "' is not removable but does not specify " +
-            "a valid defaultArea. That's not possible; it must specify a " +
-            "valid defaultArea as well.");
+      log.error("Widget '" + widget.id + "' is not removable but does not specify " +
+                "a valid defaultArea. That's not possible; it must specify a " +
+                "valid defaultArea as well.");
       return null;
     }
 
     if ("type" in aData && gSupportedWidgetTypes.has(aData.type)) {
       widget.type = aData.type;
     } else {
       widget.type = "button";
     }
@@ -2345,18 +2362,18 @@ var CustomizableUIInternal = {
     this.wrapWidgetEventHandler("onDestroyed", widget);
 
     if (widget.type == "button") {
       widget.onCommand = typeof aData.onCommand == "function" ?
                            aData.onCommand :
                            null;
     } else if (widget.type == "view") {
       if (typeof aData.viewId != "string") {
-        ERROR("Expected a string for widget " + widget.id + " viewId, but got "
-              + aData.viewId);
+        log.error("Expected a string for widget " + widget.id + " viewId, but got "
+                  + aData.viewId);
         return null;
       }
       widget.viewId = aData.viewId;
 
       this.wrapWidgetEventHandler("onViewShowing", widget);
       this.wrapWidgetEventHandler("onViewHiding", widget);
     } else if (widget.type == "custom") {
       this.wrapWidgetEventHandler("onBuild", widget);
@@ -2497,17 +2514,17 @@ var CustomizableUIInternal = {
       gUIStateBeforeReset.drawInTitlebar = Services.prefs.getBoolPref(kPrefDrawInTitlebar);
       gUIStateBeforeReset.uiCustomizationState = Services.prefs.getCharPref(kPrefCustomizationState);
     } catch(e) { }
 
     this._resetExtraToolbars();
 
     Services.prefs.clearUserPref(kPrefCustomizationState);
     Services.prefs.clearUserPref(kPrefDrawInTitlebar);
-    LOG("State reset");
+    log.debug("State reset");
 
     // Reset placements to make restoring default placements possible.
     gPlacements = new Map();
     gDirtyAreaCache = new Set();
     gSeenWidgets = new Set();
     // Clear the saved state to ensure that defaults will be used.
     gSavedState = null;
     // Restore the state for each area to its defaults
@@ -2724,39 +2741,39 @@ var CustomizableUIInternal = {
           });
         }
 
         if (props.get("type") == CustomizableUI.TYPE_TOOLBAR) {
           let attribute = container.getAttribute("type") == "menubar" ? "autohide" : "collapsed";
           let collapsed = container.getAttribute(attribute) == "true";
           let defaultCollapsed = props.get("defaultCollapsed");
           if (defaultCollapsed !== null && collapsed != defaultCollapsed) {
-            LOG("Found " + areaId + " had non-default toolbar visibility (expected " + defaultCollapsed + ", was " + collapsed + ")");
+            log.debug("Found " + areaId + " had non-default toolbar visibility (expected " + defaultCollapsed + ", was " + collapsed + ")");
             return false;
           }
         }
       }
-      LOG("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
-          "\nvs.\n" + defaultPlacements.join(","));
+      log.debug("Checking default state for " + areaId + ":\n" + currentPlacements.join(",") +
+                "\nvs.\n" + defaultPlacements.join(","));
 
       if (currentPlacements.length != defaultPlacements.length) {
         return false;
       }
 
       for (let i = 0; i < currentPlacements.length; ++i) {
         if (currentPlacements[i] != defaultPlacements[i]) {
-          LOG("Found " + currentPlacements[i] + " in " + areaId + " where " +
-              defaultPlacements[i] + " was expected!");
+          log.debug("Found " + currentPlacements[i] + " in " + areaId + " where " +
+                    defaultPlacements[i] + " was expected!");
           return false;
         }
       }
     }
 
     if (Services.prefs.prefHasUserValue(kPrefDrawInTitlebar)) {
-      LOG(kPrefDrawInTitlebar + " pref is non-default");
+      log.debug(kPrefDrawInTitlebar + " pref is non-default");
       return false;
     }
 
     return true;
   },
 
   setToolbarVisibility: function(aToolbarId, aIsVisible) {
     // We only persist the attribute the first time.
--- a/browser/components/customizableui/CustomizableWidgets.jsm
+++ b/browser/components/customizableui/CustomizableWidgets.jsm
@@ -5,16 +5,17 @@
 "use strict";
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 this.EXPORTED_SYMBOLS = ["CustomizableWidgets"];
 
 Cu.import("resource:///modules/CustomizableUI.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/AppConstants.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
   "resource:///modules/BrowserUITelemetry.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
   "resource://gre/modules/PlacesUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "PlacesUIUtils",
   "resource:///modules/PlacesUIUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "RecentlyClosedTabsAndWindowsMenuUtils",
   "resource:///modules/sessionstore/RecentlyClosedTabsAndWindowsMenuUtils.jsm");
@@ -35,18 +36,31 @@ XPCOMUtils.defineLazyGetter(this, "Brand
   const kBrandBundle = "chrome://branding/locale/brand.properties";
   return Services.strings.createBundle(kBrandBundle);
 });
 
 const kNSXUL = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 const kPrefCustomizationDebug = "browser.uiCustomization.debug";
 const kWidePanelItemClass = "panel-wide-item";
 
-var gModuleName = "[CustomizableWidgets]";
-#include logging.js
+XPCOMUtils.defineLazyGetter(this, "log", () => {
+  let scope = {};
+  Cu.import("resource://gre/modules/Console.jsm", scope);
+  let debug;
+  try {
+    debug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
+  } catch (ex) {}
+  let consoleOptions = {
+    maxLogLevel: debug ? "all" : "log",
+    prefix: "CustomizableWidgets",
+  };
+  return new scope.ConsoleAPI(consoleOptions);
+});
+
+
 
 function setAttributes(aNode, aAttrs) {
   let doc = aNode.ownerDocument;
   for (let [name, value] of Iterator(aAttrs)) {
     if (!value) {
       if (aNode.hasAttribute(name))
         aNode.removeAttribute(name);
     } else {
@@ -210,26 +224,26 @@ const CustomizableWidgets = [
                 onHistoryVisit(uri, aEvent, item);
               });
               if (icon) {
                 let iconURL = "moz-anno:favicon:" + icon;
                 item.setAttribute("image", iconURL);
               }
               fragment.appendChild(item);
             } catch (e) {
-              ERROR("Error while showing history subview: " + e);
+              log.error("Error while showing history subview: " + e);
             }
           }
           items.appendChild(fragment);
         },
         handleError: function (aError) {
-          LOG("History view tried to show but had an error: " + aError);
+          log.debug("History view tried to show but had an error: " + aError);
         },
         handleCompletion: function (aReason) {
-          LOG("History view is being shown!");
+          log.debug("History view is being shown!");
         },
       });
 
       let recentlyClosedTabs = doc.getElementById("PanelUI-recentlyClosedTabs");
       while (recentlyClosedTabs.firstChild) {
         recentlyClosedTabs.removeChild(recentlyClosedTabs.firstChild);
       }
 
@@ -275,17 +289,17 @@ const CustomizableWidgets = [
       };
       let doc = aNode.ownerDocument;
       let recentlyClosedTabs = doc.getElementById("PanelUI-recentlyClosedTabs");
       let recentlyClosedWindows = doc.getElementById("PanelUI-recentlyClosedWindows");
       recentlyClosedTabs.addEventListener("click", onRecentlyClosedClick);
       recentlyClosedWindows.addEventListener("click", onRecentlyClosedClick);
     },
     onViewHiding: function(aEvent) {
-      LOG("History view is being hidden!");
+      log.debug("History view is being hidden!");
     }
   }, {
     id: "sync-button",
     label: "remotetabs-panelmenu.label",
     tooltiptext: "remotetabs-panelmenu.tooltiptext",
     type: "view",
     viewId: "PanelUI-remotetabs",
     defaultArea: CustomizableUI.AREA_PANEL,
@@ -535,21 +549,19 @@ const CustomizableWidgets = [
       }
     }
   }, {
     id: "developer-button",
     type: "view",
     viewId: "PanelUI-developer",
     shortcutId: "key_devToolboxMenuItem",
     tooltiptext: "developer-button.tooltiptext2",
-#ifdef MOZ_DEV_EDITION
-    defaultArea: CustomizableUI.AREA_NAVBAR,
-#else
-    defaultArea: CustomizableUI.AREA_PANEL,
-#endif
+    defaultArea: AppConstants.MOZ_DEV_EDITION ?
+                   CustomizableUI.AREA_NAVBAR :
+                   CustomizableUI.AREA_PANEL,
     onViewShowing: function(aEvent) {
       // Populate the subview with whatever menuitems are in the developer
       // menu. We skip menu elements, because the menu panel has no way
       // of dealing with those right now.
       let doc = aEvent.target.ownerDocument;
       let win = doc.defaultView;
 
       let menu = doc.getElementById("menuWebDeveloperPopup");
@@ -640,38 +652,16 @@ const CustomizableWidgets = [
       let win = aEvent.target &&
                 aEvent.target.ownerDocument &&
                 aEvent.target.ownerDocument.defaultView;
       if (win && typeof win.BrowserOpenAddonsMgr == "function") {
         win.BrowserOpenAddonsMgr();
       }
     }
   }, {
-    id: "preferences-button",
-    defaultArea: CustomizableUI.AREA_PANEL,
-#ifdef XP_WIN
-    label: "preferences-button.labelWin",
-    tooltiptext: "preferences-button.tooltipWin2",
-#else
-#ifdef XP_MACOSX
-    tooltiptext: "preferences-button.tooltiptext.withshortcut",
-    shortcutId: "key_preferencesCmdMac",
-#else
-    tooltiptext: "preferences-button.tooltiptext2",
-#endif
-#endif
-    onCommand: function(aEvent) {
-      let win = aEvent.target &&
-                aEvent.target.ownerDocument &&
-                aEvent.target.ownerDocument.defaultView;
-      if (win && typeof win.openPreferences == "function") {
-        win.openPreferences();
-      }
-    }
-  }, {
     id: "zoom-controls",
     type: "custom",
     tooltiptext: "zoom-controls.tooltiptext2",
     defaultArea: CustomizableUI.AREA_PANEL,
     onBuild: function(aDocument) {
       const kPanelId = "PanelUI-popup";
       let areaType = CustomizableUI.getAreaType(this.currentArea);
       let inPanel = areaType == CustomizableUI.TYPE_MENU_PANEL;
@@ -1138,16 +1128,39 @@ const CustomizableWidgets = [
     id: "email-link-button",
     tooltiptext: "email-link-button.tooltiptext3",
     onCommand: function(aEvent) {
       let win = aEvent.view;
       win.MailIntegration.sendLinkForBrowser(win.gBrowser.selectedBrowser)
     }
   }];
 
+let preferencesButton = {
+  id: "preferences-button",
+  defaultArea: CustomizableUI.AREA_PANEL,
+  onCommand: function(aEvent) {
+    let win = aEvent.target &&
+              aEvent.target.ownerDocument &&
+              aEvent.target.ownerDocument.defaultView;
+    if (win && typeof win.openPreferences == "function") {
+      win.openPreferences();
+    }
+  }
+};
+if (AppConstants.platform == "win") {
+  preferencesButton.label = "preferences-button.labelWin";
+  preferencesButton.tooltiptext = "preferences-button.tooltipWin2";
+} else if (AppConstants.platform == "macosx") {
+  preferencesButton.tooltiptext = "preferences-button.tooltiptext.withshortcut";
+  preferencesButton.shortcutId = "key_preferencesCmdMac";
+} else {
+  preferencesButton.tooltiptext = "preferences-button.tooltiptext2";
+}
+CustomizableWidgets.push(preferencesButton);
+
 if (Services.prefs.getBoolPref("privacy.panicButton.enabled")) {
   CustomizableWidgets.push({
     id: "panic-button",
     type: "view",
     viewId: "PanelUI-panicView",
     _sanitizer: null,
     _ensureSanitizer: function() {
       if (!this.sanitizer) {
@@ -1202,34 +1215,35 @@ if (Services.prefs.getBoolPref("privacy.
     },
     onViewHiding: function(aEvent) {
       let forgetButton = aEvent.target.querySelector("#PanelUI-panic-view-button");
       forgetButton.removeEventListener("command", this);
     },
   });
 }
 
-#ifdef E10S_TESTING_ONLY
-var e10sDisabled = false;
-#ifdef XP_MACOSX
-// On OS X, "Disable Hardware Acceleration" also disables OMTC and forces
-// a fallback to Basic Layers. This is incompatible with e10s.
-e10sDisabled |= Services.prefs.getBoolPref("layers.acceleration.disabled");
-#endif
+if (AppConstants.E10S_TESTING_ONLY) {
+  var e10sDisabled = false;
+
+  if (AppConstants.platform == "macosx") {
+    // On OS X, "Disable Hardware Acceleration" also disables OMTC and forces
+    // a fallback to Basic Layers. This is incompatible with e10s.
+    e10sDisabled |= Services.prefs.getBoolPref("layers.acceleration.disabled");
+  }
 
-if (Services.appinfo.browserTabsRemoteAutostart) {
-  CustomizableWidgets.push({
-    id: "e10s-button",
-    disabled: e10sDisabled,
-    defaultArea: CustomizableUI.AREA_PANEL,
-    onBuild: function(aDocument) {
-        node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
-        node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
-    },
-    onCommand: function(aEvent) {
-      let win = aEvent.view;
-      if (win && typeof win.OpenBrowserWindow == "function") {
-        win.OpenBrowserWindow({remote: false});
-      }
-    },
-  });
+  if (Services.appinfo.browserTabsRemoteAutostart) {
+    CustomizableWidgets.push({
+      id: "e10s-button",
+      disabled: e10sDisabled,
+      defaultArea: CustomizableUI.AREA_PANEL,
+      onBuild: function(aDocument) {
+          node.setAttribute("label", CustomizableUI.getLocalizedProperty(this, "label"));
+          node.setAttribute("tooltiptext", CustomizableUI.getLocalizedProperty(this, "tooltiptext"));
+      },
+      onCommand: function(aEvent) {
+        let win = aEvent.view;
+        if (win && typeof win.OpenBrowserWindow == "function") {
+          win.OpenBrowserWindow({remote: false});
+        }
+      },
+    });
+  }
 }
-#endif
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -23,27 +23,39 @@ const kPanelItemContextMenu = "customiza
 const kPaletteItemContextMenu = "customizationPaletteItemContextMenu";
 
 Cu.import("resource://gre/modules/Services.jsm");
 Cu.import("resource:///modules/CustomizableUI.jsm");
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/AddonManager.jsm");
+Cu.import("resource://gre/modules/AppConstants.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "DragPositionManager",
                                   "resource:///modules/DragPositionManager.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "BrowserUITelemetry",
                                   "resource:///modules/BrowserUITelemetry.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
                                   "resource://gre/modules/LightweightThemeManager.jsm");
 
-
-var gModuleName = "[CustomizeMode]";
-#include logging.js
+let gDebug;
+XPCOMUtils.defineLazyGetter(this, "log", () => {
+  let scope = {};
+  Cu.import("resource://gre/modules/Console.jsm", scope);
+  let ConsoleAPI = scope.ConsoleAPI;
+  try {
+    gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
+  } catch (ex) {}
+  let consoleOptions = {
+    maxLogLevel: gDebug ? "all" : "log",
+    prefix: "CustomizeMode",
+  };
+  return new scope.ConsoleAPI(consoleOptions);
+});
 
 var gDisableAnimation = null;
 
 var gDraggingInToolbars;
 
 function CustomizeMode(aWindow) {
   if (gDisableAnimation === null) {
     gDisableAnimation = Services.prefs.getPrefType(kPrefCustomizationAnimation) == Ci.nsIPrefBranch.PREF_BOOL &&
@@ -60,20 +72,20 @@ function CustomizeMode(aWindow) {
   // to the user when in customizing mode.
   this.visiblePalette = this.document.getElementById(kPaletteId);
   this.paletteEmptyNotice = this.document.getElementById("customization-empty");
   this.tipPanel = this.document.getElementById("customization-tipPanel");
   if (Services.prefs.getCharPref("general.skins.selectedSkin") != "classic/1.0") {
     let lwthemeButton = this.document.getElementById("customization-lwtheme-button");
     lwthemeButton.setAttribute("hidden", "true");
   }
-#ifdef CAN_DRAW_IN_TITLEBAR
-  this._updateTitlebarButton();
-  Services.prefs.addObserver(kDrawInTitlebarPref, this, false);
-#endif
+  if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+    this._updateTitlebarButton();
+    Services.prefs.addObserver(kDrawInTitlebarPref, this, false);
+  }
   this.window.addEventListener("unload", this);
 };
 
 CustomizeMode.prototype = {
   _changed: false,
   _transitioning: false,
   window: null,
   document: null,
@@ -96,19 +108,19 @@ CustomizeMode.prototype = {
     return this.document.getElementById("PanelUI-contents");
   },
 
   get _handler() {
     return this.window.CustomizationHandler;
   },
 
   uninit: function() {
-#ifdef CAN_DRAW_IN_TITLEBAR
-    Services.prefs.removeObserver(kDrawInTitlebarPref, this);
-#endif
+    if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+      Services.prefs.removeObserver(kDrawInTitlebarPref, this);
+    }
   },
 
   toggle: function() {
     if (this._handler.isEnteringCustomizeMode || this._handler.isExitingCustomizeMode) {
       this._wantToBeInCustomizeMode = !this._wantToBeInCustomizeMode;
       return;
     }
     if (this._customizing) {
@@ -132,18 +144,18 @@ CustomizeMode.prototype = {
     this._wantToBeInCustomizeMode = true;
 
     if (this._customizing || this._handler.isEnteringCustomizeMode) {
       return;
     }
 
     // Exiting; want to re-enter once we've done that.
     if (this._handler.isExitingCustomizeMode) {
-      LOG("Attempted to enter while we're in the middle of exiting. " +
-          "We'll exit after we've entered");
+      log.debug("Attempted to enter while we're in the middle of exiting. " +
+                "We'll exit after we've entered");
       return;
     }
 
 
     // We don't need to switch to kAboutURI, or open a new tab at
     // kAboutURI if we're already on it.
     if (this.browser.selectedBrowser.currentURI.spec != kAboutURI) {
       this.window.switchToTabHavingURI(kAboutURI, true, {
@@ -157,17 +169,17 @@ CustomizeMode.prototype = {
 
     this._handler.isEnteringCustomizeMode = true;
 
     // Always disable the reset button at the start of customize mode, it'll be re-enabled
     // if necessary when we finish entering:
     let resetButton = this.document.getElementById("customization-reset-button");
     resetButton.setAttribute("disabled", "true");
 
-    Task.spawn(function() {
+    Task.spawn(function*() {
       // We shouldn't start customize mode until after browser-delayed-startup has finished:
       if (!this.window.gBrowserInit.delayedStartupFinished) {
         let delayedStartupDeferred = Promise.defer();
         let delayedStartupObserver = function(aSubject) {
           if (aSubject == this.window) {
             Services.obs.removeObserver(delayedStartupObserver, "browser-delayed-startup-finished");
             delayedStartupDeferred.resolve();
           }
@@ -304,17 +316,17 @@ CustomizeMode.prototype = {
       // It's possible that we didn't enter customize mode via the menu panel,
       // meaning we didn't kick off about:customizing preloading. If that's
       // the case, let's kick it off for the next time we load this mode.
       window.gCustomizationTabPreloader.ensurePreloading();
       if (!this._wantToBeInCustomizeMode) {
         this.exit();
       }
     }.bind(this)).then(null, function(e) {
-      ERROR("Error entering customize mode", e);
+      log.error("Error entering customize mode", e);
       // We should ensure this has been called, and calling it again doesn't hurt:
       window.PanelUI.endBatchUpdate();
       this._handler.isEnteringCustomizeMode = false;
       // Exit customize mode to ensure proper clean-up when entering failed.
       this.exit();
     }.bind(this));
   },
 
@@ -322,24 +334,24 @@ CustomizeMode.prototype = {
     this._wantToBeInCustomizeMode = false;
 
     if (!this._customizing || this._handler.isExitingCustomizeMode) {
       return;
     }
 
     // Entering; want to exit once we've done that.
     if (this._handler.isEnteringCustomizeMode) {
-      LOG("Attempted to exit while we're in the middle of entering. " +
-          "We'll exit after we've entered");
+      log.debug("Attempted to exit while we're in the middle of entering. " +
+                "We'll exit after we've entered");
       return;
     }
 
     if (this.resetting) {
-      LOG("Attempted to exit while we're resetting. " +
-          "We'll exit after resetting has finished.");
+      log.debug("Attempted to exit while we're resetting. " +
+                "We'll exit after resetting has finished.");
       return;
     }
 
     this.hideTip();
 
     this._handler.isExitingCustomizeMode = true;
 
     if (this._enableOutlinesTimeout) {
@@ -377,17 +389,17 @@ CustomizeMode.prototype = {
 
     // Disable the reset and undo reset buttons while transitioning:
     let resetButton = this.document.getElementById("customization-reset-button");
     let undoResetButton = this.document.getElementById("customization-undo-reset-button");
     undoResetButton.hidden = resetButton.disabled = true;
 
     this._transitioning = true;
 
-    Task.spawn(function() {
+    Task.spawn(function*() {
       yield this.depopulatePalette();
 
       yield this._doTransition(false);
       this.removeLWTStyling();
 
       Services.obs.removeObserver(this, "lightweight-theme-window-updated", false);
 
       let browser = document.getElementById("browser");
@@ -395,17 +407,17 @@ CustomizeMode.prototype = {
         let custBrowser = this.browser.selectedBrowser;
         if (custBrowser.canGoBack) {
           // If there's history to this tab, just go back.
           // Note that this throws an exception if the previous document has a
           // problematic URL (e.g. about:idontexist)
           try {
             custBrowser.goBack();
           } catch (ex) {
-            ERROR(ex);
+            log.error(ex);
           }
         } else {
           // If we can't go back, we're removing the about:customization tab.
           // We only do this if we're the top window for this window (so not
           // a dialog window, for example).
           if (window.getTopWin(true) == window) {
             let customizationTab = this.browser.selectedTab;
             if (this.browser.browsers.length == 1) {
@@ -479,17 +491,17 @@ CustomizeMode.prototype = {
       this._handler.isExitingCustomizeMode = false;
       CustomizableUI.dispatchToolboxEvent("aftercustomization", {}, window);
       CustomizableUI.notifyEndCustomizing(window);
 
       if (this._wantToBeInCustomizeMode) {
         this.enter();
       }
     }.bind(this)).then(null, function(e) {
-      ERROR("Error exiting customize mode", e);
+      log.error("Error exiting customize mode", e);
       // We should ensure this has been called, and calling it again doesn't hurt:
       window.PanelUI.endBatchUpdate();
       this._handler.isExitingCustomizeMode = false;
     }.bind(this));
   },
 
   /**
    * The customize mode transition has 4 phases when entering:
@@ -573,25 +585,25 @@ CustomizeMode.prototype = {
 
     let deck = this.document.getElementById("tab-view-deck");
     let headerImageRef = this._getHeaderImageRef(aData);
     docElement.setAttribute("customization-lwtheme", "true");
 
     let toolboxRect = this.window.gNavToolbox.getBoundingClientRect();
     let height = toolboxRect.bottom;
 
-#ifdef XP_MACOSX
-    let drawingInTitlebar = !docElement.hasAttribute("drawtitle");
-    let titlebar = this.document.getElementById("titlebar");
-    if (drawingInTitlebar) {
-      titlebar.style.backgroundImage = headerImageRef;
-    } else {
-      titlebar.style.removeProperty("background-image");
+    if (AppConstants.platform == "macosx") {
+      let drawingInTitlebar = !docElement.hasAttribute("drawtitle");
+      let titlebar = this.document.getElementById("titlebar");
+      if (drawingInTitlebar) {
+        titlebar.style.backgroundImage = headerImageRef;
+      } else {
+        titlebar.style.removeProperty("background-image");
+      }
     }
-#endif
 
     let limitedBG = "-moz-image-rect(" + headerImageRef + ", 0, 100%, " +
                     height + ", 0)";
 
     let ridgeStart = height - 1;
     let ridgeCenter = (ridgeStart + 1) + "px";
     let ridgeEnd = (ridgeStart + 2) + "px";
     ridgeStart = ridgeStart + "px";
@@ -606,21 +618,19 @@ CustomizeMode.prototype = {
     deck.style.backgroundImage = ridge + ", " + limitedBG;
 
     /* Remove the background styles from the <window> so we can style it instead. */
     docElement.style.removeProperty("background-image");
     docElement.style.removeProperty("background-color");
   },
 
   removeLWTStyling: function() {
-#ifdef XP_MACOSX
-    let affectedNodes = ["tab-view-deck", "titlebar"];
-#else
-    let affectedNodes = ["tab-view-deck"];
-#endif
+    let affectedNodes = AppConstants.platform == "macosx" ?
+                          ["tab-view-deck", "titlebar"] :
+                          ["tab-view-deck"];
     for (let id of affectedNodes) {
       let node = this.document.getElementById(id);
       node.style.removeProperty("background-image");
     }
     let docElement = this.document.documentElement;
     docElement.removeAttribute("customization-lwtheme");
     let data = docElement._lightweightTheme.getData();
     if (data && data.headerURL) {
@@ -750,42 +760,42 @@ CustomizeMode.prototype = {
         }
         fragment.appendChild(paletteItem);
       }
 
       this.visiblePalette.appendChild(fragment);
       this._stowedPalette = this.window.gNavToolbox.palette;
       this.window.gNavToolbox.palette = this.visiblePalette;
     } catch (ex) {
-      ERROR(ex);
+      log.error(ex);
     }
   },
 
   //XXXunf Maybe this should use -moz-element instead of wrapping the node?
   //       Would ensure no weird interactions/event handling from original node,
   //       and makes it possible to put this in a lazy-loaded iframe/real tab
   //       while still getting rid of the need for overlays.
   makePaletteItem: function(aWidget, aPlace) {
     let widgetNode = aWidget.forWindow(this.window).node;
     if (!widgetNode) {
-      ERROR("Widget with id " + aWidget.id + " does not return a valid node");
+      log.error("Widget with id " + aWidget.id + " does not return a valid node");
       return null;
     }
     // Do not build a palette item for hidden widgets; there's not much to show.
     if (widgetNode.hidden) {
       return null;
     }
 
     let wrapper = this.createOrUpdateWrapper(widgetNode, aPlace);
     wrapper.appendChild(widgetNode);
     return wrapper;
   },
 
   depopulatePalette: function() {
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       this.visiblePalette.hidden = true;
       let paletteChild = this.visiblePalette.firstChild;
       let nextChild;
       while (paletteChild) {
         nextChild = paletteChild.nextElementSibling;
         let provider = CustomizableUI.getWidget(paletteChild.id).provider;
         if (provider == CustomizableUI.PROVIDER_XUL) {
           let unwrappedPaletteItem =
@@ -801,17 +811,17 @@ CustomizeMode.prototype = {
         } else if (provider == CustomizableUI.PROVIDER_SPECIAL) {
           this.visiblePalette.removeChild(paletteChild);
         }
 
         paletteChild = nextChild;
       }
       this.visiblePalette.hidden = false;
       this.window.gNavToolbox.palette = this._stowedPalette;
-    }.bind(this)).then(null, ERROR);
+    }.bind(this)).then(null, log.error);
   },
 
   isCustomizableItem: function(aNode) {
     return aNode.localName == "toolbarbutton" ||
            aNode.localName == "toolbaritem" ||
            aNode.localName == "toolbarseparator" ||
            aNode.localName == "toolbarspring" ||
            aNode.localName == "toolbarspacer";
@@ -954,17 +964,17 @@ CustomizeMode.prototype = {
     }
     aWrapper.removeEventListener("mousedown", this);
     aWrapper.removeEventListener("mouseup", this);
 
     let place = aWrapper.getAttribute("place");
 
     let toolbarItem = aWrapper.firstChild;
     if (!toolbarItem) {
-      ERROR("no toolbarItem child for " + aWrapper.tagName + "#" + aWrapper.id);
+      log.error("no toolbarItem child for " + aWrapper.tagName + "#" + aWrapper.id);
       aWrapper.remove();
       return null;
     }
 
     if (aWrapper.hasAttribute("itemobserves")) {
       toolbarItem.setAttribute("observes", aWrapper.getAttribute("itemobserves"));
     }
 
@@ -1003,17 +1013,17 @@ CustomizeMode.prototype = {
     let target = CustomizableUI.getCustomizeTargetForArea(aArea, this.window);
     if (!target || this.areas.has(target)) {
       return null;
     }
 
     this._addDragHandlers(target);
     for (let child of target.children) {
       if (this.isCustomizableItem(child) && !this.isWrappedToolbarItem(child)) {
-        yield this.deferredWrapToolbarItem(child, CustomizableUI.getPlaceForItem(child)).then(null, ERROR);
+        yield this.deferredWrapToolbarItem(child, CustomizableUI.getPlaceForItem(child)).then(null, log.error);
       }
     }
     this.areas.add(target);
     return target;
   },
 
   _wrapToolbarItemSync: function(aArea) {
     let target = CustomizableUI.getCustomizeTargetForArea(aArea, this.window);
@@ -1024,17 +1034,17 @@ CustomizeMode.prototype = {
     this._addDragHandlers(target);
     try {
       for (let child of target.children) {
         if (this.isCustomizableItem(child) && !this.isWrappedToolbarItem(child)) {
           this.wrapToolbarItem(child, CustomizableUI.getPlaceForItem(child));
         }
       }
     } catch (ex) {
-      ERROR(ex, ex.stack);
+      log.error(ex, ex.stack);
     }
 
     this.areas.add(target);
     return target;
   },
 
   _wrapToolbarItems: function*() {
     for (let area of CustomizableUI.areas) {
@@ -1070,27 +1080,27 @@ CustomizeMode.prototype = {
     for (let toolbarItem of target.children) {
       if (this.isWrappedToolbarItem(toolbarItem)) {
         this.unwrapToolbarItem(toolbarItem);
       }
     }
   },
 
   _unwrapToolbarItems: function() {
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       for (let target of this.areas) {
         for (let toolbarItem of target.children) {
           if (this.isWrappedToolbarItem(toolbarItem)) {
             yield this.deferredUnwrapToolbarItem(toolbarItem);
           }
         }
         this._removeDragHandlers(target);
       }
       this.areas.clear();
-    }.bind(this)).then(null, ERROR);
+    }.bind(this)).then(null, log.error);
   },
 
   _removeExtraToolbarsIfEmpty: function() {
     let toolbox = this.window.gNavToolbox;
     for (let child of toolbox.children) {
       if (child.hasAttribute("customindex")) {
         let placements = CustomizableUI.getWidgetIdsInArea(child.id);
         if (!placements.length) {
@@ -1114,17 +1124,17 @@ CustomizeMode.prototype = {
   },
 
   reset: function() {
     this.resetting = true;
     // Disable the reset button temporarily while resetting:
     let btn = this.document.getElementById("customization-reset-button");
     BrowserUITelemetry.countCustomizationEvent("reset");
     btn.disabled = true;
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       this._removePanelCustomizationPlaceholders();
       yield this.depopulatePalette();
       yield this._unwrapToolbarItems();
 
       CustomizableUI.reset();
 
       yield this._wrapToolbarItems();
       this.populatePalette();
@@ -1134,39 +1144,39 @@ CustomizeMode.prototype = {
       this._updateResetButton();
       this._updateUndoResetButton();
       this._updateEmptyPaletteNotice();
       this._showPanelCustomizationPlaceholders();
       this.resetting = false;
       if (!this._wantToBeInCustomizeMode) {
         this.exit();
       }
-    }.bind(this)).then(null, ERROR);
+    }.bind(this)).then(null, log.error);
   },
 
   undoReset: function() {
     this.resetting = true;
 
-    return Task.spawn(function() {
+    return Task.spawn(function*() {
       this._removePanelCustomizationPlaceholders();
       yield this.depopulatePalette();
       yield this._unwrapToolbarItems();
 
       CustomizableUI.undoReset();
 
       yield this._wrapToolbarItems();
       this.populatePalette();
 
       this.persistCurrentSets(true);
 
       this._updateResetButton();
       this._updateUndoResetButton();
       this._updateEmptyPaletteNotice();
       this.resetting = false;
-    }.bind(this)).then(null, ERROR);
+    }.bind(this)).then(null, log.error);
   },
 
   _onToolbarVisibilityChange: function(aEvent) {
     let toolbar = aEvent.target;
     if (aEvent.detail.visible && toolbar.getAttribute("customizable") == "true") {
       toolbar.setAttribute("customizing", "true");
     } else {
       toolbar.removeAttribute("customizing");
@@ -1479,53 +1489,57 @@ CustomizeMode.prototype = {
     }
   },
 
   observe: function(aSubject, aTopic, aData) {
     switch (aTopic) {
       case "nsPref:changed":
         this._updateResetButton();
         this._updateUndoResetButton();
-#ifdef CAN_DRAW_IN_TITLEBAR
-        this._updateTitlebarButton();
-#endif
+        if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
+          this._updateTitlebarButton();
+        }
         break;
       case "lightweight-theme-window-updated":
         if (aSubject == this.window) {
           aData = JSON.parse(aData);
           if (!aData) {
             this.removeLWTStyling();
           } else {
             this.updateLWTStyling(aData);
           }
         }
         break;
     }
   },
 
-#ifdef CAN_DRAW_IN_TITLEBAR
   _updateTitlebarButton: function() {
+    if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
+      return;
+    }
     let drawInTitlebar = true;
     try {
       drawInTitlebar = Services.prefs.getBoolPref(kDrawInTitlebarPref);
     } catch (ex) { }
     let button = this.document.getElementById("customization-titlebar-visibility-button");
     // Drawing in the titlebar means 'hiding' the titlebar:
     if (drawInTitlebar) {
       button.removeAttribute("checked");
     } else {
       button.setAttribute("checked", "true");
     }
   },
 
   toggleTitlebar: function(aShouldShowTitlebar) {
+    if (!AppConstants.CAN_DRAW_IN_TITLEBAR) {
+      return;
+    }
     // Drawing in the titlebar means not showing the titlebar, hence the negation:
     Services.prefs.setBoolPref(kDrawInTitlebarPref, !aShouldShowTitlebar);
   },
-#endif
 
   _onDragStart: function(aEvent) {
     __dumpDragData(aEvent);
     let item = aEvent.target;
     while (item && item.localName != "toolbarpaletteitem") {
       if (item.localName == "toolbar") {
         return;
       }
@@ -1718,17 +1732,17 @@ CustomizeMode.prototype = {
     }
 
     this._cancelDragActive(this._dragOverItem, null, true);
     this._removePanelCustomizationPlaceholders();
 
     try {
       this._applyDrop(aEvent, targetArea, originArea, draggedItemId, targetNode);
     } catch (ex) {
-      ERROR(ex, ex.stack);
+      log.error(ex, ex.stack);
     }
 
     this._showPanelCustomizationPlaceholders();
   },
 
   _applyDrop: function(aEvent, aTargetArea, aOriginArea, aDraggedItemId, aTargetNode) {
     let document = aEvent.target.ownerDocument;
     let draggedItem = document.getElementById(aDraggedItemId);
@@ -1825,17 +1839,17 @@ CustomizeMode.prototype = {
     }
     if (itemForPlacement && !itemForPlacement.classList.contains(kPlaceholderClass)) {
       let targetNodeId = (itemForPlacement.nodeName == "toolbarpaletteitem") ?
                             itemForPlacement.firstChild && itemForPlacement.firstChild.id :
                             itemForPlacement.id;
       placement = CustomizableUI.getPlacementOfWidget(targetNodeId);
     }
     if (!placement) {
-      LOG("Could not get a position for " + aTargetNode.nodeName + "#" + aTargetNode.id + "." + aTargetNode.className);
+      log.debug("Could not get a position for " + aTargetNode.nodeName + "#" + aTargetNode.id + "." + aTargetNode.className);
     }
     let position = placement ? placement.position : null;
 
     // Is the target area the same as the origin? Since we've already handled
     // the possibility that the target is the customization palette, we know
     // that the widget is moving within a customizable area.
     if (aTargetArea == aOriginArea) {
       CustomizableUI.moveWidgetWithinArea(aDraggedItemId, position);
@@ -2146,31 +2160,31 @@ CustomizeMode.prototype = {
       }
       // Find the closest node:
       targetNode = positionManager.find(aAreaElement, dragX, dragY, aDraggedItemId);
     }
     return targetNode || aEvent.target;
   },
 
   _onMouseDown: function(aEvent) {
-    LOG("_onMouseDown");
+    log.debug("_onMouseDown");
     if (aEvent.button != 0) {
       return;
     }
     let doc = aEvent.target.ownerDocument;
     doc.documentElement.setAttribute("customizing-movingItem", true);
     let item = this._getWrapper(aEvent.target);
     if (item && !item.classList.contains(kPlaceholderClass) &&
         item.getAttribute("removable") == "true") {
       item.setAttribute("mousedown", "true");
     }
   },
 
   _onMouseUp: function(aEvent) {
-    LOG("_onMouseUp");
+    log.debug("_onMouseUp");
     if (aEvent.button != 0) {
       return;
     }
     let doc = aEvent.target.ownerDocument;
     doc.documentElement.removeAttribute("customizing-movingItem");
     let item = this._getWrapper(aEvent.target);
     if (item) {
       item.removeAttribute("mousedown");
@@ -2279,14 +2293,14 @@ function __dumpDragData(aEvent, caller) 
     }
   }
   for (let prop in aEvent.dataTransfer) {
     if (typeof aEvent.dataTransfer[prop] != "function") {
       str += "  dataTransfer[" + prop + "]: " + aEvent.dataTransfer[prop] + "\n";
     }
   }
   str += "}";
-  LOG(str);
+  log.debug(str);
 }
 
 function dispatchFunction(aFunc) {
   Services.tm.currentThread.dispatch(aFunc, Ci.nsIThread.DISPATCH_NORMAL);
 }
--- a/browser/components/customizableui/PanelWideWidgetTracker.jsm
+++ b/browser/components/customizableui/PanelWideWidgetTracker.jsm
@@ -6,19 +6,16 @@
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
 
 this.EXPORTED_SYMBOLS = ["PanelWideWidgetTracker"];
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
   "resource:///modules/CustomizableUI.jsm");
 
-var gModuleName = "[PanelWideWidgetTracker]";
-#include logging.js
-
 var gPanel = CustomizableUI.AREA_PANEL;
 // We keep track of the widget placements for the panel locally:
 var gPanelPlacements = [];
 
 // All the wide widgets we know of:
 var gWideWidgets = new Set();
 // All the widgets we know of:
 var gSeenWidgets = new Set();
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -223,17 +223,17 @@ const PanelUI = {
    *        mode will handle calling beginBatchUpdate and endBatchUpdate.
    *
    * @return a Promise that resolves once the panel is ready to roll.
    */
   ensureReady: function(aCustomizing=false) {
     if (this._readyPromise) {
       return this._readyPromise;
     }
-    this._readyPromise = Task.spawn(function() {
+    this._readyPromise = Task.spawn(function*() {
       if (!this._initialized) {
         let delayedStartupDeferred = Promise.defer();
         let delayedStartupObserver = (aSubject, aTopic, aData) => {
           if (aSubject == window) {
             Services.obs.removeObserver(delayedStartupObserver, "browser-delayed-startup-finished");
             delayedStartupDeferred.resolve();
           }
         };
deleted file mode 100644
--- a/browser/components/customizableui/logging.js
+++ /dev/null
@@ -1,31 +0,0 @@
-#if 0
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-#endif
-
-XPCOMUtils.defineLazyModuleGetter(this, "console",
-  "resource://gre/modules/Console.jsm");
-
-var gDebug = false;
-try {
-  gDebug = Services.prefs.getBoolPref(kPrefCustomizationDebug);
-} catch (e) {}
-
-function LOG(...args) {
-  if (gDebug) {
-    args.unshift(gModuleName);
-    console.log.apply(console, args);
-  }
-}
-
-function ERROR(...args) {
-  args.unshift(gModuleName);
-  console.error.apply(console, args);
-}
-
-function INFO(...args) {
-  args.unshift(gModuleName);
-  console.info.apply(console, args);
-}
-
--- a/browser/components/customizableui/moz.build
+++ b/browser/components/customizableui/moz.build
@@ -6,27 +6,21 @@
 
 DIRS += [
     'content',
 ]
 
 BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
 
 EXTRA_JS_MODULES += [
+    'CustomizableUI.jsm',
+    'CustomizableWidgets.jsm',
+    'CustomizeMode.jsm',
     'DragPositionManager.jsm',
+    'PanelWideWidgetTracker.jsm',
     'ScrollbarSampler.jsm',
 ]
 
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
-    DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
-    DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
-
 EXTRA_PP_JS_MODULES += [
-    'CustomizableUI.jsm',
-    'CustomizableWidgets.jsm',
-    'CustomizeMode.jsm',
-    'PanelWideWidgetTracker.jsm',
 ]
 
 with Files('**'):
     BUG_COMPONENT = ('Firefox', 'Toolbars and Customization')
--- a/browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
+++ b/browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js
@@ -2,17 +2,17 @@
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const DEFAULT_THEME_ID = "{972ce4c6-7e08-4474-a285-3208198ce6fd}";
 const {LightweightThemeManager} = Components.utils.import("resource://gre/modules/LightweightThemeManager.jsm", {});
 
-add_task(function () {
+add_task(function* () {
   Services.prefs.clearUserPref("lightweightThemes.usedThemes");
   Services.prefs.clearUserPref("lightweightThemes.recommendedThemes");
   LightweightThemeManager.clearBuiltInThemes();
 
   yield startCustomizing();
 
   let themesButton = document.getElementById("customization-lwtheme-button");
   let popup = document.getElementById("customization-lwtheme-menu");
@@ -49,14 +49,14 @@ add_task(function () {
   is(header.nextSibling.nextSibling.nextSibling, recommendedHeader,
      "There should be two themes in the 'My Themes' section");
 
   let defaultTheme = header.nextSibling;
   defaultTheme.doCommand();
   is(Services.prefs.getCharPref("lightweightThemes.selectedThemeID"), "", "No lwtheme should be selected");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
 
   Services.prefs.clearUserPref("lightweightThemes.usedThemes");
   Services.prefs.clearUserPref("lightweightThemes.recommendedThemes");
-})
\ No newline at end of file
+});
--- a/browser/components/customizableui/test/browser_1058573_showToolbarsDropdown.js
+++ b/browser/components/customizableui/test/browser_1058573_showToolbarsDropdown.js
@@ -1,25 +1,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check that toggleable toolbars dropdown in always shown");
 
   info("Remove all possible custom toolbars");
   yield removeCustomToolbars();
 
   info("Enter customization mode");
   yield startCustomizing();
 
   let toolbarsToggle = document.getElementById("customization-toolbar-visibility-button");
   ok(toolbarsToggle, "The toolbars toggle dropdown exists");
   ok(!toolbarsToggle.hasAttribute("hidden"),
      "The toolbars toggle dropdown is displayed");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   info("Exit customization mode");
   yield endCustomizing();
 });
--- a/browser/components/customizableui/test/browser_1087303_button_fullscreen.js
+++ b/browser/components/customizableui/test/browser_1087303_button_fullscreen.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check fullscreen button existence and functionality");
 
   yield PanelUI.show();
 
   let fullscreenButton = document.getElementById("fullscreen-button");
   ok(fullscreenButton, "Fullscreen button appears in Panel Menu");
 
   let fullscreenPromise = promiseFullscreenChange();
--- a/browser/components/customizableui/test/browser_1087303_button_preferences.js
+++ b/browser/components/customizableui/test/browser_1087303_button_preferences.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var newTab = null;
 
-add_task(function() {
+add_task(function*() {
   info("Check preferences button existence and functionality");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let preferencesButton = document.getElementById("preferences-button");
   ok(preferencesButton, "Preferences button exists in Panel Menu");
   preferencesButton.click();
--- a/browser/components/customizableui/test/browser_873501_handle_specials.js
+++ b/browser/components/customizableui/test/browser_873501_handle_specials.js
@@ -4,17 +4,17 @@
 
 "use strict";
 
 const kToolbarName = "test-specials-toolbar";
 
 registerCleanupFunction(removeCustomToolbars);
 
 // Add a toolbar with two springs and the downloads button.
-add_task(function addToolbarWith2SpringsAndDownloadsButton() {
+add_task(function* addToolbarWith2SpringsAndDownloadsButton() {
   // Create the toolbar with a single spring:
   createToolbarWithPlacements(kToolbarName, ["spring"]);
   ok(document.getElementById(kToolbarName), "Toolbar should be created.");
 
   // Check it's there with a generated ID:
   assertAreaPlacements(kToolbarName, [/customizableui-special-spring\d+/]);
   let [springId] = getAreaWidgetIds(kToolbarName);
 
@@ -28,17 +28,17 @@ add_task(function addToolbarWith2Springs
 
   // Try moving the downloads button to this new toolbar, between the two springs:
   CustomizableUI.addWidgetToArea("downloads-button", kToolbarName, 1);
   assertAreaPlacements(kToolbarName, [springId, "downloads-button", spring2Id]);
   yield removeCustomToolbars();
 });
 
 // Add separators around the downloads button.
-add_task(function addSeparatorsAroundDownloadsButton() {
+add_task(function* addSeparatorsAroundDownloadsButton() {
   createToolbarWithPlacements(kToolbarName, ["separator"]);
   ok(document.getElementById(kToolbarName), "Toolbar should be created.");
 
   // Check it's there with a generated ID:
   assertAreaPlacements(kToolbarName, [/customizableui-special-separator\d+/]);
   let [separatorId] = getAreaWidgetIds(kToolbarName);
 
   CustomizableUI.addWidgetToArea("separator", kToolbarName);
@@ -49,17 +49,17 @@ add_task(function addSeparatorsAroundDow
   isnot(separatorId, separator2Id, "Separator ids shouldn't be equal.");
 
   CustomizableUI.addWidgetToArea("downloads-button", kToolbarName, 1);
   assertAreaPlacements(kToolbarName, [separatorId, "downloads-button", separator2Id]);
   yield removeCustomToolbars();
 });
 
 // Add spacers around the downloads button.
-add_task(function addSpacersAroundDownloadsButton() {
+add_task(function* addSpacersAroundDownloadsButton() {
   createToolbarWithPlacements(kToolbarName, ["spacer"]);
   ok(document.getElementById(kToolbarName), "Toolbar should be created.");
 
   // Check it's there with a generated ID:
   assertAreaPlacements(kToolbarName, [/customizableui-special-spacer\d+/]);
   let [spacerId] = getAreaWidgetIds(kToolbarName);
 
   CustomizableUI.addWidgetToArea("spacer", kToolbarName);
@@ -69,11 +69,11 @@ add_task(function addSpacersAroundDownlo
 
   isnot(spacerId, spacer2Id, "Spacer ids shouldn't be equal.");
 
   CustomizableUI.addWidgetToArea("downloads-button", kToolbarName, 1);
   assertAreaPlacements(kToolbarName, [spacerId, "downloads-button", spacer2Id]);
   yield removeCustomToolbars();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
+++ b/browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
@@ -149,17 +149,17 @@ function createXULButtonForWindow(win) {
 
 function removeXULButtonForWindow(win) {
   win.gNavToolbox.palette.querySelector(`#${kXULWidgetId}`).remove();
 }
 
 var otherWin;
 
 // Moving widgets in two windows, one with customize mode and one without, should work.
-add_task(function MoveWidgetsInTwoWindows() {
+add_task(function* MoveWidgetsInTwoWindows() {
   yield startCustomizing();
   otherWin = yield openAndLoadWindow(null, true);
   yield otherWin.PanelUI.ensureReady();
   // Create the XUL button to use in the test in both windows.
   createXULButtonForWindow(window);
   createXULButtonForWindow(otherWin);
   ok(CustomizableUI.inDefaultState, "Should start in default state");
 
@@ -175,11 +175,11 @@ add_task(function MoveWidgetsInTwoWindow
     }
   }
   yield promiseWindowClosed(otherWin);
   otherWin = null;
   yield endCustomizing();
   removeXULButtonForWindow(window);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
+++ b/browser/components/customizableui/test/browser_876944_customize_mode_create_destroy.js
@@ -3,34 +3,34 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kTestWidget1 = "test-customize-mode-create-destroy1";
 const kTestWidget2 = "test-customize-mode-create-destroy2";
 
 // Creating and destroying a widget should correctly wrap/unwrap stuff
-add_task(function testWrapUnwrap() {
+add_task(function* testWrapUnwrap() {
   yield startCustomizing();
   CustomizableUI.createWidget({id: kTestWidget1, label: 'Pretty label', tooltiptext: 'Pretty tooltip'});
   let elem = document.getElementById(kTestWidget1);
   let wrapper = document.getElementById("wrapper-" + kTestWidget1);
   ok(elem, "There should be an item");
   ok(wrapper, "There should be a wrapper");
   is(wrapper.firstChild.id, kTestWidget1, "Wrapper should have test widget");
   is(wrapper.parentNode.id, "customization-palette", "Wrapper should be in palette");
   CustomizableUI.destroyWidget(kTestWidget1);
   wrapper = document.getElementById("wrapper-" + kTestWidget1);
   ok(!wrapper, "There should be a wrapper");
   let item = document.getElementById(kTestWidget1);
   ok(!item, "There should no longer be an item");
 });
 
 // Creating and destroying a widget should correctly deal with panel placeholders
-add_task(function testPanelPlaceholders() {
+add_task(function* testPanelPlaceholders() {
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   // The value of expectedPlaceholders depends on the default palette layout.
   // Bug 1229236 is for these tests to be smarter so the test doesn't need to
   // change when the default placements change.
   let expectedPlaceholders = 1 + (isInDevEdition() ? 1 : 0);
   is(panel.querySelectorAll(".panel-customization-placeholder").length, expectedPlaceholders, "The number of placeholders should be correct.");
   CustomizableUI.createWidget({id: kTestWidget2, label: 'Pretty label', tooltiptext: 'Pretty tooltip', defaultArea: CustomizableUI.AREA_PANEL});
   let elem = document.getElementById(kTestWidget2);
@@ -44,17 +44,17 @@ add_task(function testPanelPlaceholders(
   CustomizableUI.destroyWidget(kTestWidget2);
   wrapper = document.getElementById("wrapper-" + kTestWidget2);
   ok(!wrapper, "There should be a wrapper");
   let item = document.getElementById(kTestWidget2);
   ok(!item, "There should no longer be an item");
   yield endCustomizing();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   try {
     CustomizableUI.destroyWidget(kTestWidget1);
   } catch (ex) {}
   try {
     CustomizableUI.destroyWidget(kTestWidget2);
   } catch (ex) {}
   yield resetCustomization();
--- a/browser/components/customizableui/test/browser_877006_missing_view.js
+++ b/browser/components/customizableui/test/browser_877006_missing_view.js
@@ -31,11 +31,11 @@ add_task(function testAddbrokenViewWidge
     CustomizableUI.destroyWidget(kWidgetId);
   } catch (ex) {
     Cu.reportError(ex);
     noError = false;
   }
   ok(noError, "Should not throw an exception trying to remove the broken view widget.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_877178_unregisterArea.js
+++ b/browser/components/customizableui/test/browser_877178_unregisterArea.js
@@ -40,11 +40,11 @@ add_task(function checkRegisteringAndUnr
                         kButtonId,
                         /customizableui-special-spring\d+/]);
   ok(!CustomizableUI.inDefaultState, "With a new toolbar it is no longer in a default state.");
   removeCustomToolbars(); // Will call unregisterArea for us
   ok(CustomizableUI.inDefaultState, "When the toolbar is unregistered, " +
      "everything will return to the default state.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_877447_skip_missing_ids.js
+++ b/browser/components/customizableui/test/browser_877447_skip_missing_ids.js
@@ -15,11 +15,11 @@ add_task(function skipMissingIDS() {
   ok(!CustomizableUI.inDefaultState, "Should no longer be in the default state.");
   is(btn.parentNode.parentNode.id, CustomizableUI.AREA_NAVBAR, "Button should be in navbar");
   btn.remove();
   is(btn.parentNode, null, "Button is no longer in the navbar");
   ok(CustomizableUI.inDefaultState, "Should be back in the default state, " +
                                     "despite unknown button ID in placements.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_878452_drag_to_panel.js
+++ b/browser/components/customizableui/test/browser_878452_drag_to_panel.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Dragging an item from the palette to another button in the panel should work.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let btn = document.getElementById("feed-button");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
 
   let lastButtonIndex = placements.length - 1;
   let lastButton = placements[lastButtonIndex];
   let placementsAfterInsert = placements.slice(0, lastButtonIndex).concat(["feed-button", lastButton]);
@@ -19,33 +19,33 @@ add_task(function() {
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterInsert);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let palette = document.getElementById("customization-palette");
   simulateItemDrag(btn, palette);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging an item from the palette to the panel itself should also work.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let btn = document.getElementById("feed-button");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let placements = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
 
   let placementsAfterAppend = placements.concat(["feed-button"]);
   simulateItemDrag(btn, panel);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let palette = document.getElementById("customization-palette");
   simulateItemDrag(btn, palette);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging an item from the palette to an empty panel should also work.
-add_task(function() {
+add_task(function*() {
   let widgetIds = getAreaWidgetIds(CustomizableUI.AREA_PANEL);
   while (widgetIds.length) {
     CustomizableUI.removeWidgetFromArea(widgetIds.shift());
   }
   yield startCustomizing();
   let btn = document.getElementById("feed-button");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
 
@@ -55,12 +55,12 @@ add_task(function() {
   simulateItemDrag(btn, panel);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterAppend);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let palette = document.getElementById("customization-palette");
   simulateItemDrag(btn, palette);
   assertAreaPlacements(panel.id, []);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_880164_customization_context_menus.js
+++ b/browser/components/customizableui/test/browser_880164_customization_context_menus.js
@@ -5,17 +5,17 @@
 "use strict";
 
 requestLongerTimeout(2);
 
 const isOSX = (Services.appinfo.OS === "Darwin");
 
 // Right-click on the home button should
 // show a context menu with options to move it.
-add_task(function() {
+add_task(function*() {
   let contextMenu = document.getElementById("toolbar-context-menu");
   let shownPromise = popupShown(contextMenu);
   let homeButton = document.getElementById("home-button");
   EventUtils.synthesizeMouse(homeButton, 2, 2, {type: "contextmenu", button: 2 });
   yield shownPromise;
 
   let expectedEntries = [
     [".customize-context-moveToPanel", true],
@@ -35,17 +35,17 @@ add_task(function() {
   let hiddenPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenPromise;
 });
 
 // Right-click on an empty bit of tabstrip should
 // show a context menu without options to move it,
 // but with tab-specific options instead.
-add_task(function() {
+add_task(function*() {
   // ensure there are tabs to reload/bookmark:
   let extraTab = gBrowser.selectedTab = gBrowser.addTab();
   yield promiseTabLoadEvent(extraTab, "http://example.com/");
   let contextMenu = document.getElementById("toolbar-context-menu");
   let shownPromise = popupShown(contextMenu);
   let tabstrip = document.getElementById("tabbrowser-tabs");
   let rect = tabstrip.getBoundingClientRect();
   EventUtils.synthesizeMouse(tabstrip, rect.width - 2, 2, {type: "contextmenu", button: 2 });
@@ -73,17 +73,17 @@ add_task(function() {
   contextMenu.hidePopup();
   yield hiddenPromise;
   gBrowser.removeTab(extraTab);
 });
 
 // Right-click on an empty bit of extra toolbar should
 // show a context menu with moving options disabled,
 // and a toggle option for the extra toolbar
-add_task(function() {
+add_task(function*() {
   let contextMenu = document.getElementById("toolbar-context-menu");
   let shownPromise = popupShown(contextMenu);
   let toolbar = createToolbarWithPlacements("880164_empty_toolbar", []);
   toolbar.setAttribute("context", "toolbar-context-menu");
   toolbar.setAttribute("toolbarname", "Fancy Toolbar for Context Menu");
   EventUtils.synthesizeMouseAtCenter(toolbar, {type: "contextmenu", button: 2 });
   yield shownPromise;
 
@@ -107,17 +107,17 @@ add_task(function() {
   contextMenu.hidePopup();
   yield hiddenPromise;
   removeCustomToolbars();
 });
 
 
 // Right-click on the urlbar-container should
 // show a context menu with disabled options to move it.
-add_task(function() {
+add_task(function*() {
   let contextMenu = document.getElementById("toolbar-context-menu");
   let shownPromise = popupShown(contextMenu);
   let urlBarContainer = document.getElementById("urlbar-container");
   // Need to make sure not to click within an edit field.
   let urlbarRect = urlBarContainer.getBoundingClientRect();
   EventUtils.synthesizeMouse(urlBarContainer, 100, 1, {type: "contextmenu", button: 2 });
   yield shownPromise;
 
@@ -138,17 +138,17 @@ add_task(function() {
 
   let hiddenPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenPromise;
 });
 
 // Right-click on the searchbar and moving it to the menu
 // and back should move the search-container instead.
-add_task(function() {
+add_task(function*() {
   let searchbar = document.getElementById("searchbar");
   gCustomizeMode.addToPanel(searchbar);
   let placement = CustomizableUI.getPlacementOfWidget("search-container");
   is(placement.area, CustomizableUI.AREA_PANEL, "Should be in panel");
 
   let shownPanelPromise = promisePanelShown(window);
   PanelUI.toggle({type: "command"});
   yield shownPanelPromise;
@@ -164,17 +164,17 @@ add_task(function() {
   is(placement, null, "Should be in palette");
   CustomizableUI.reset();
   placement = CustomizableUI.getPlacementOfWidget("search-container");
   is(placement.area, CustomizableUI.AREA_NAVBAR, "Should be in navbar");
 });
 
 // Right-click on an item within the menu panel should
 // show a context menu with options to move it.
-add_task(function() {
+add_task(function*() {
   let shownPanelPromise = promisePanelShown(window);
   PanelUI.toggle({type: "command"});
   yield shownPanelPromise;
 
   let contextMenu = document.getElementById("customizationPanelItemContextMenu");
   let shownContextPromise = popupShown(contextMenu);
   let newWindowButton = document.getElementById("new-window-button");
   ok(newWindowButton, "new-window-button was found");
@@ -197,17 +197,17 @@ add_task(function() {
 
   let hiddenPromise = promisePanelHidden(window);
   PanelUI.toggle({type: "command"});
   yield hiddenPromise;
 });
 
 // Right-click on the home button while in customization mode
 // should show a context menu with options to move it.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let contextMenu = document.getElementById("toolbar-context-menu");
   let shownPromise = popupShown(contextMenu);
   let homeButton = document.getElementById("wrapper-home-button");
   EventUtils.synthesizeMouse(homeButton, 2, 2, {type: "contextmenu", button: 2});
   yield shownPromise;
 
   let expectedEntries = [
@@ -227,17 +227,17 @@ add_task(function() {
 
   let hiddenContextPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenContextPromise;
 });
 
 // Right-click on an item in the palette should
 // show a context menu with options to move it.
-add_task(function() {
+add_task(function*() {
   let contextMenu = document.getElementById("customizationPaletteItemContextMenu");
   let shownPromise = popupShown(contextMenu);
   let openFileButton = document.getElementById("wrapper-open-file-button");
   EventUtils.synthesizeMouse(openFileButton, 2, 2, {type: "contextmenu", button: 2});
   yield shownPromise;
 
   let expectedEntries = [
     [".customize-context-addToToolbar", true],
@@ -247,17 +247,17 @@ add_task(function() {
 
   let hiddenContextPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenContextPromise;
 });
 
 // Right-click on an item in the panel while in customization mode
 // should show a context menu with options to move it.
-add_task(function() {
+add_task(function*() {
   let contextMenu = document.getElementById("customizationPanelItemContextMenu");
   let shownPromise = popupShown(contextMenu);
   let newWindowButton = document.getElementById("wrapper-new-window-button");
   EventUtils.synthesizeMouse(newWindowButton, 2, 2, {type: "contextmenu", button: 2});
   yield shownPromise;
 
   let expectedEntries = [
     [".customize-context-moveToToolbar", true],
@@ -270,17 +270,17 @@ add_task(function() {
   let hiddenContextPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenContextPromise;
   yield endCustomizing();
 });
 
 // Test the toolbarbutton panel context menu in customization mode
 // without opening the panel before customization mode
-add_task(function() {
+add_task(function*() {
   this.otherWin = yield openAndLoadWindow(null, true);
 
   yield new Promise(resolve => waitForFocus(resolve, this.otherWin));
 
   yield startCustomizing(this.otherWin);
 
   let contextMenu = this.otherWin.document.getElementById("customizationPanelItemContextMenu");
   let shownPromise = popupShown(contextMenu);
@@ -303,17 +303,17 @@ add_task(function() {
   yield promiseWindowClosed(this.otherWin);
   this.otherWin = null;
 
   yield new Promise(resolve => waitForFocus(resolve, window));
 });
 
 // Bug 945191 - Combined buttons show wrong context menu options
 // when they are in the toolbar.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let contextMenu = document.getElementById("customizationPanelItemContextMenu");
   let shownPromise = popupShown(contextMenu);
   let zoomControls = document.getElementById("wrapper-zoom-controls");
   EventUtils.synthesizeMouse(zoomControls, 2, 2, {type: "contextmenu", button: 2});
   yield shownPromise;
   // Execute the command to move the item from the panel to the toolbar.
   contextMenu.childNodes[0].doCommand();
@@ -347,17 +347,17 @@ add_task(function() {
 
   hiddenPromise = popupHidden(contextMenu);
   contextMenu.hidePopup();
   yield hiddenPromise;
   yield resetCustomization();
 });
 
 // Bug 947586 - After customization, panel items show wrong context menu options
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   yield endCustomizing();
 
   yield PanelUI.show();
 
   let contextMenu = document.getElementById("customizationPanelItemContextMenu");
   let shownContextPromise = popupShown(contextMenu);
   let newWindowButton = document.getElementById("new-window-button");
@@ -381,17 +381,17 @@ add_task(function() {
 
   let hiddenPromise = promisePanelHidden(window);
   PanelUI.hide();
   yield hiddenPromise;
 });
 
 
 // Bug 982027 - moving icon around removes custom context menu.
-add_task(function() {
+add_task(function*() {
   let widgetId = "custom-context-menu-toolbarbutton";
   let expectedContext = "myfancycontext";
   let widget = createDummyXULButton(widgetId, "Test ctxt menu");
   widget.setAttribute("context", expectedContext);
   CustomizableUI.addWidgetToArea(widgetId, CustomizableUI.AREA_NAVBAR);
   is(widget.getAttribute("context"), expectedContext, "Should have context menu when added to the toolbar.");
 
   yield startCustomizing();
--- a/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
+++ b/browser/components/customizableui/test/browser_880382_drag_wide_widgets_in_panel.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 requestLongerTimeout(5);
 
 // Dragging the zoom controls to be before the print button should not move any controls.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let zoomControls = document.getElementById("zoom-controls");
   let printButton = document.getElementById("print-button");
   let placementsAfterMove = ["edit-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
                              "zoom-controls",
@@ -30,17 +30,17 @@ add_task(function() {
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging the zoom controls to be before the save button should not move any controls.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let zoomControls = document.getElementById("zoom-controls");
   let savePageButton = document.getElementById("save-page-button");
   let placementsAfterMove = ["edit-controls",
                              "zoom-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
@@ -56,17 +56,17 @@ add_task(function() {
   removeDeveloperButtonIfDevEdition(placementsAfterMove);
   simulateItemDrag(zoomControls, savePageButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(CustomizableUI.inDefaultState, "Should be in default state.");
 });
 
 
 // Dragging the zoom controls to be before the new-window button should not move any widgets.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let zoomControls = document.getElementById("zoom-controls");
   let newWindowButton = document.getElementById("new-window-button");
   let placementsAfterMove = ["edit-controls",
                              "zoom-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
@@ -81,17 +81,17 @@ add_task(function() {
                             ];
   removeDeveloperButtonIfDevEdition(placementsAfterMove);
   simulateItemDrag(zoomControls, newWindowButton);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the zoom controls to be before the history-panelmenu should move the zoom-controls in to the row higher than the history-panelmenu.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let zoomControls = document.getElementById("zoom-controls");
   let historyPanelMenu = document.getElementById("history-panelmenu");
   let placementsAfterMove = ["edit-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
                              "zoom-controls",
@@ -110,17 +110,17 @@ add_task(function() {
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging the zoom controls to be before the preferences-button should move the zoom-controls
 // in to the row higher than the preferences-button.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let zoomControls = document.getElementById("zoom-controls");
   let preferencesButton = document.getElementById("preferences-button");
   let placementsAfterMove = ["edit-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
                              "print-button",
@@ -138,17 +138,17 @@ add_task(function() {
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging an item from the palette to before the zoom-controls should move it and two other buttons before the zoom controls.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let openFileButton = document.getElementById("open-file-button");
   let zoomControls = document.getElementById("zoom-controls");
   let placementsAfterInsert = ["edit-controls",
                                "open-file-button",
                                "new-window-button",
                                "privatebrowsing-button",
                                "zoom-controls",
@@ -179,17 +179,17 @@ add_task(function() {
      "The open-file-button should be wrapped by a toolbarpaletteitem");
   let newWindowButton = document.getElementById("new-window-button");
   simulateItemDrag(zoomControls, newWindowButton);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging an item from the palette to before the edit-controls
 // should move it and two other buttons before the edit and zoom controls.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let openFileButton = document.getElementById("open-file-button");
   let editControls = document.getElementById("edit-controls");
   let placementsAfterInsert = ["open-file-button",
                                "new-window-button",
                                "privatebrowsing-button",
                                "edit-controls",
                                "zoom-controls",
@@ -218,17 +218,17 @@ add_task(function() {
   simulateItemDrag(openFileButton, palette);
   is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
      "The open-file-button should be wrapped by a toolbarpaletteitem");
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Dragging the edit-controls to be before the zoom-controls button
 // should not move any widgets.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let zoomControls = document.getElementById("zoom-controls");
   let placementsAfterMove = ["edit-controls",
                              "zoom-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
@@ -244,17 +244,17 @@ add_task(function() {
   removeDeveloperButtonIfDevEdition(placementsAfterMove);
   simulateItemDrag(editControls, zoomControls);
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to be before the new-window-button should
 // move the zoom-controls before the edit-controls.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let newWindowButton = document.getElementById("new-window-button");
   let placementsAfterMove = ["zoom-controls",
                              "edit-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
@@ -273,17 +273,17 @@ add_task(function() {
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to be before the privatebrowsing-button
 // should move the edit-controls in to the row higher than the
 // privatebrowsing-button.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let privateBrowsingButton = document.getElementById("privatebrowsing-button");
   let placementsAfterMove = ["zoom-controls",
                              "edit-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
@@ -302,17 +302,17 @@ add_task(function() {
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to be before the save-page-button
 // should move the edit-controls in to the row higher than the
 // save-page-button.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let savePageButton = document.getElementById("save-page-button");
   let placementsAfterMove = ["zoom-controls",
                              "edit-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
@@ -330,17 +330,17 @@ add_task(function() {
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to the panel itself should append
 // the edit controls to the bottom of the panel.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let placementsAfterMove = ["zoom-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
                              "print-button",
@@ -358,17 +358,17 @@ add_task(function() {
   assertAreaPlacements(CustomizableUI.AREA_PANEL, placementsAfterMove);
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(editControls, zoomControls);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to the customization-palette and
 // back should work.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let palette = document.getElementById("customization-palette");
   let placementsAfterMove = ["zoom-controls",
                              "new-window-button",
                              "privatebrowsing-button",
                              "save-page-button",
                              "print-button",
@@ -394,17 +394,17 @@ add_task(function() {
   simulateItemDrag(editControls, zoomControls);
   is(paletteChildElementCount, palette.childElementCount,
      "The palette child count should have returned to its prior value.");
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging the edit-controls to each of the panel placeholders
 // should append the edit-controls to the bottom of the panel.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let numPlaceholders = 2;
   for (let i = 0; i < numPlaceholders; i++) {
     // This test relies on there being a specific number of widgets in the
     // panel. The addition of sync-button screwed this up, so we remove it
     // here. We should either fix the tests to not rely on the specific layout,
@@ -432,32 +432,32 @@ add_task(function() {
     let zoomControls = document.getElementById("zoom-controls");
     simulateItemDrag(editControls, zoomControls);
     CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
     ok(CustomizableUI.inDefaultState, "Should still be in default state.");
   }
 });
 
 // Dragging the open-file-button back on to itself should work.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let openFileButton = document.getElementById("open-file-button");
   is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
      "open-file-button should be wrapped by a toolbarpaletteitem");
   simulateItemDrag(openFileButton, openFileButton);
   is(openFileButton.parentNode.tagName, "toolbarpaletteitem",
      "open-file-button should be wrapped by a toolbarpaletteitem");
   let editControls = document.getElementById("edit-controls");
   is(editControls.parentNode.tagName, "toolbarpaletteitem",
      "edit-controls should be wrapped by a toolbarpaletteitem");
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
 // Dragging a small button onto the last big button should work.
-add_task(function() {
+add_task(function*() {
   // Bug 1007910 requires there be a placeholder on the final row for this
   // test to work as written. The addition of sync-button meant that's not true
   // so we remove it from here. Bug 1229236 is for these tests to be smarter.
   CustomizableUI.removeWidgetFromArea("sync-button");
   yield startCustomizing();
   let editControls = document.getElementById("edit-controls");
   let panel = document.getElementById(CustomizableUI.AREA_PANEL);
   let target = panel.getElementsByClassName("panel-customization-placeholder")[0];
@@ -486,12 +486,12 @@ add_task(function() {
   let palette = document.getElementById("customization-palette");
   let zoomControls = document.getElementById("zoom-controls");
   simulateItemDrag(button, palette);
   simulateItemDrag(editControls, zoomControls);
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
+++ b/browser/components/customizableui/test/browser_884402_customize_from_overflow.js
@@ -7,17 +7,17 @@ const isOSX = (Services.appinfo.OS === "
 var originalWindowWidth;
 registerCleanupFunction(function() {
   overflowPanel.removeAttribute("animate");
   window.resizeTo(originalWindowWidth, window.outerHeight);
 });
 
 // Right-click on an item within the overflow panel should
 // show a context menu with options to move it.
-add_task(function() {
+add_task(function*() {
 
   overflowPanel.setAttribute("animate", "false");
 
   originalWindowWidth = window.outerWidth;
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   let oldChildCount = navbar.customizationTarget.childElementCount;
   window.resizeTo(400, window.outerHeight);
--- a/browser/components/customizableui/test/browser_885052_customize_mode_observers_disabed.js
+++ b/browser/components/customizableui/test/browser_885052_customize_mode_observers_disabed.js
@@ -5,17 +5,17 @@
 "use strict";
 
 function isFullscreenSizeMode() {
   let sizemode = document.documentElement.getAttribute("sizemode");
   return sizemode == "fullscreen";
 }
 
 // Observers should be disabled when in customization mode.
-add_task(function() {
+add_task(function*() {
   // Open and close the panel to make sure that the
   // area is generated before getting a child of the area.
   let shownPanelPromise = promisePanelShown(window);
   PanelUI.toggle({type: "command"});
   yield shownPanelPromise;
   let hiddenPanelPromise = promisePanelHidden(window);
   PanelUI.toggle({type: "command"});
   yield hiddenPanelPromise;
--- a/browser/components/customizableui/test/browser_885530_showInPrivateBrowsing.js
+++ b/browser/components/customizableui/test/browser_885530_showInPrivateBrowsing.js
@@ -25,17 +25,17 @@ add_task(function() {
   ok(wrapper.showInPrivateBrowsing,
      "showInPrivateBrowsing should have defaulted to true.");
   CustomizableUI.destroyWidget(kWidgetId);
 });
 
 // Add a widget via the API with showInPrivateBrowsing set to false
 // and ensure it does not appear in pre-existing or newly created
 // private windows.
-add_task(function() {
+add_task(function*() {
   let plain1 = yield openAndLoadWindow();
   let private1 = yield openAndLoadWindow({private: true});
   CustomizableUI.createWidget({
     id: kWidgetId,
     removable: true,
     showInPrivateBrowsing: false
   });
   CustomizableUI.addWidgetToArea(kWidgetId,
@@ -75,17 +75,17 @@ add_task(function() {
   yield Promise.all([plain1, plain2, private1, private2].map(promiseWindowClosed));
 
   CustomizableUI.destroyWidget("some-widget");
 });
 
 // Add a widget via the API with showInPrivateBrowsing set to true,
 // and ensure that it appears in pre-existing or newly created
 // private browsing windows.
-add_task(function() {
+add_task(function*() {
   let plain1 = yield openAndLoadWindow();
   let private1 = yield openAndLoadWindow({private: true});
 
   CustomizableUI.createWidget({
     id: kWidgetId,
     removable: true,
     showInPrivateBrowsing: true
   });
@@ -124,11 +124,11 @@ add_task(function() {
   assertWidgetExists(private1, false);
   assertWidgetExists(private2, false);
 
   yield Promise.all([plain1, plain2, private1, private2].map(promiseWindowClosed));
 
   CustomizableUI.destroyWidget("some-widget");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_886323_buildArea_removable_nodes.js
+++ b/browser/components/customizableui/test/browser_886323_buildArea_removable_nodes.js
@@ -6,17 +6,17 @@
 
 const kButtonId = "test-886323-removable-moved-node";
 const kLazyAreaId = "test-886323-lazy-area-for-removability-testing";
 
 var gNavBar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 var gLazyArea;
 
 // Removable nodes shouldn't be moved by buildArea
-add_task(function() {
+add_task(function*() {
   let dummyBtn = createDummyXULButton(kButtonId, "Dummy");
   dummyBtn.setAttribute("removable", "true");
   gNavBar.customizationTarget.appendChild(dummyBtn);
   let popupSet = document.getElementById("mainPopupSet");
   gLazyArea = document.createElementNS(kNSXUL, "panel");
   gLazyArea.id = kLazyAreaId;
   gLazyArea.setAttribute("hidden", "true");
   popupSet.appendChild(gLazyArea);
@@ -36,11 +36,11 @@ add_task(function() {
      "Button shouldn't actually have moved as it's not removable");
   btn = document.getElementById(kButtonId);
   if (btn) btn.remove();
   CustomizableUI.removeWidgetFromArea(kButtonId);
   CustomizableUI.unregisterArea(kLazyAreaId);
   gLazyArea.remove();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_887438_currentset_shim.js
+++ b/browser/components/customizableui/test/browser_887438_currentset_shim.js
@@ -65,11 +65,11 @@ add_task(function() {
     let feedParent = feedBtn.parentNode;
     ok(feedParent == navbarCT || feedParent == overflowPanelList,
        "Feed button should be in navbar or overflow");
   }
   navbar.currentSet = currentSet;
   is(currentSet, navbar.currentSet, "Should be able to return to original state.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_888817_currentset_updating.js
+++ b/browser/components/customizableui/test/browser_888817_currentset_updating.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Adding, moving and removing items should update the relevant currentset attributes
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Should be in the default state when we start");
   let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
   setToolbarVisibility(personalbar, true);
   ok(!CustomizableUI.inDefaultState, "Making the bookmarks toolbar visible takes it out of the default state");
 
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
   let navbarCurrentset = navbar.getAttribute("currentset") || navbar.currentSet;
@@ -45,13 +45,13 @@ add_task(function() {
      "Should have updated currentSet after remove.");
   is(otherPersonalbar.getAttribute("currentset"), personalbarCurrentset,
      "Should have updated other window's currentSet after remove.");
 
   yield promiseWindowClosed(otherWin);
   // Reset in asyncCleanup will put our button back for us.
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   let personalbar = document.getElementById(CustomizableUI.AREA_BOOKMARKS);
   setToolbarVisibility(personalbar, false);
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_889120_customize_tab_merging.js
+++ b/browser/components/customizableui/test/browser_889120_customize_tab_merging.js
@@ -3,23 +3,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kTestToolbarId = "test-empty-drag";
 
 // Attempting to switch quickly from one tab to another to see whether the state changes
 // correctly.
-add_task(function CheckBasicCustomizeMode() {
+add_task(function* CheckBasicCustomizeMode() {
   yield startCustomizing();
   ok(CustomizationHandler.isCustomizing(), "We should be in customize mode");
   yield endCustomizing();
   ok(!CustomizationHandler.isCustomizing(), "We should not be in customize mode");
 });
-add_task(function CheckQuickCustomizeModeSwitch() {
+add_task(function* CheckQuickCustomizeModeSwitch() {
   let tab1 = gBrowser.addTab("about:newtab");
   gBrowser.selectedTab = tab1;
   let tab2 = gBrowser.addTab("about:customizing");
   let tab3 = gBrowser.addTab("about:newtab");
   gBrowser.selectedTab = tab2;
   try {
     yield waitForCondition(() => CustomizationHandler.isEnteringCustomizeMode);
   } catch (ex) {
@@ -33,12 +33,12 @@ add_task(function CheckQuickCustomizeMod
     Cu.reportError(ex);
   }
   ok(!CustomizationHandler.isCustomizing(), "Should not be entering customize mode");
   gBrowser.removeTab(tab1);
   gBrowser.removeTab(tab2);
   gBrowser.removeTab(tab3);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
 });
 
--- a/browser/components/customizableui/test/browser_890140_orphaned_placeholders.js
+++ b/browser/components/customizableui/test/browser_890140_orphaned_placeholders.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 requestLongerTimeout(2);
 
 // One orphaned item should have two placeholders next to it.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
 
   if (isInDevEdition()) {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_PANEL);
     ok(!CustomizableUI.inDefaultState, "Should no longer be in default state.");
   }
   if (!isInDevEdition()) {
     ok(CustomizableUI.inDefaultState, "Should be in default state.");
@@ -37,17 +37,17 @@ add_task(function() {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
   }
 
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Two orphaned items should have one placeholder next to them (case 1).
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
 
   if (isInDevEdition()) {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_PANEL);
   }
 
   // This test relies on an exact number of widgets being in the panel.
   // Remove the sync-button to satisfy that. (bug 1229236)
@@ -81,17 +81,17 @@ add_task(function() {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
   }
 
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // Two orphaned items should have one placeholder next to them (case 2).
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
 
   if (isInDevEdition()) {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_PANEL);
   }
   // This test relies on an exact number of widgets being in the panel.
   // Remove the sync-button to satisfy that. (bug 1229236)
   CustomizableUI.removeWidgetFromArea("sync-button");
@@ -123,17 +123,17 @@ add_task(function() {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
   }
 
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // A wide widget at the bottom of the panel should have three placeholders after it.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
 
   if (isInDevEdition()) {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_PANEL);
   }
 
   // This test relies on an exact number of widgets being in the panel.
   // Remove the sync-button to satisfy that. (bug 1229236)
@@ -167,17 +167,17 @@ add_task(function() {
     CustomizableUI.addWidgetToArea("developer-button", CustomizableUI.AREA_NAVBAR, 2);
   }
 
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
   ok(CustomizableUI.inDefaultState, "Should be in default state again.");
 });
 
 // The default placements should have two placeholders at the bottom (or 1 in win8).
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let numPlaceholders = -1;
 
   if (isInDevEdition()) {
     numPlaceholders = 3;
   } else {
     numPlaceholders = 2;
   }
@@ -194,17 +194,17 @@ add_task(function() {
   yield endCustomizing();
   yield startCustomizing();
   is(getVisiblePlaceholderCount(panel), numPlaceholders, "Should have " + numPlaceholders + " visible placeholders after re-entering");
 
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
   ok(CustomizableUI.inDefaultState, "Should still be in default state.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
 
 function getVisiblePlaceholderCount(aPanel) {
   let visiblePlaceholders = aPanel.querySelectorAll(".panel-customization-placeholder:not([hidden=true])");
   return visiblePlaceholders.length;
 }
--- a/browser/components/customizableui/test/browser_890262_destroyWidget_after_add_to_panel.js
+++ b/browser/components/customizableui/test/browser_890262_destroyWidget_after_add_to_panel.js
@@ -41,17 +41,17 @@ add_task(function() {
     CustomizableUI.destroyWidget(kWidget2Id);
   } catch (ex) {
     Cu.reportError(ex);
     noError = false;
   }
   ok(noError, "Shouldn't throw an exception for a widget that was added to a not-yet-constructed area");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   let lazyArea = document.getElementById(kLazyAreaId);
   if (lazyArea) {
     lazyArea.remove();
   }
   try {
     CustomizableUI.unregisterArea(kLazyAreaId);
   } catch (ex) {} // If we didn't register successfully for some reason
   yield resetCustomization();
--- a/browser/components/customizableui/test/browser_892955_isWidgetRemovable_for_removed_widgets.js
+++ b/browser/components/customizableui/test/browser_892955_isWidgetRemovable_for_removed_widgets.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kWidgetId = "test-892955-remove-widget";
 
 // Removing a destroyed widget should work.
-add_task(function() {
+add_task(function*() {
   let widgetSpec = {
     id: kWidgetId,
     defaultArea: CustomizableUI.AREA_NAVBAR
   };
 
   CustomizableUI.createWidget(widgetSpec);
   CustomizableUI.destroyWidget(kWidgetId);
   let noError = true;
@@ -20,11 +20,11 @@ add_task(function() {
     CustomizableUI.removeWidgetFromArea(kWidgetId);
   } catch (ex) {
     noError = false;
     Cu.reportError(ex);
   }
   ok(noError, "Shouldn't throw an error removing a destroyed widget.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_892956_destroyWidget_defaultPlacements.js
+++ b/browser/components/customizableui/test/browser_892956_destroyWidget_defaultPlacements.js
@@ -2,23 +2,23 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kWidgetId = "test-892956-destroyWidget-defaultPlacement";
 
 // destroyWidget should clean up defaultPlacements if the widget had a defaultArea
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Should be in the default state when we start");
 
   let widgetSpec = {
     id: kWidgetId,
     defaultArea: CustomizableUI.AREA_NAVBAR
   };
   CustomizableUI.createWidget(widgetSpec);
   CustomizableUI.destroyWidget(kWidgetId);
   ok(CustomizableUI.inDefaultState, "Should be in the default state when we finish");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_901207_searchbar_in_panel.js
+++ b/browser/components/customizableui/test/browser_901207_searchbar_in_panel.js
@@ -22,17 +22,17 @@ function* waitForSearchBarFocus()
   let searchbar = document.getElementById("searchbar");
   yield waitForCondition(function () {
     logActiveElement();
     return document.activeElement === searchbar.textbox.inputField;
   });
 }
 
 // Ctrl+K should open the menu panel and focus the search bar if the search bar is in the panel.
-add_task(function() {
+add_task(function*() {
   let searchbar = document.getElementById("searchbar");
   gCustomizeMode.addToPanel(searchbar);
   let placement = CustomizableUI.getPlacementOfWidget("search-container");
   is(placement.area, CustomizableUI.AREA_PANEL, "Should be in panel");
 
   let shownPanelPromise = promisePanelShown(window);
   sendWebSearchKeyCommand();
   yield shownPanelPromise;
@@ -41,17 +41,17 @@ add_task(function() {
 
   let hiddenPanelPromise = promisePanelHidden(window);
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield hiddenPanelPromise;
   CustomizableUI.reset();
 });
 
 // Ctrl+K should give focus to the searchbar when the searchbar is in the menupanel and the panel is already opened.
-add_task(function() {
+add_task(function*() {
   let searchbar = document.getElementById("searchbar");
   gCustomizeMode.addToPanel(searchbar);
   let placement = CustomizableUI.getPlacementOfWidget("search-container");
   is(placement.area, CustomizableUI.AREA_PANEL, "Should be in panel");
 
   let shownPanelPromise = promisePanelShown(window);
   PanelUI.toggle({type: "command"});
   yield shownPanelPromise;
@@ -62,17 +62,17 @@ add_task(function() {
 
   let hiddenPanelPromise = promisePanelHidden(window);
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield hiddenPanelPromise;
   CustomizableUI.reset();
 });
 
 // Ctrl+K should open the overflow panel and focus the search bar if the search bar is overflowed.
-add_task(function() {
+add_task(function*() {
   this.originalWindowWidth = window.outerWidth;
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
 
   window.resizeTo(360, window.outerHeight);
   yield waitForCondition(() => navbar.getAttribute("overflowing") == "true");
   ok(!navbar.querySelector("#search-container"), "Search container should be overflowing");
@@ -91,27 +91,27 @@ add_task(function() {
   yield hiddenPanelPromise;
   navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   window.resizeTo(this.originalWindowWidth, window.outerHeight);
   yield waitForCondition(() => !navbar.hasAttribute("overflowing"));
   ok(!navbar.hasAttribute("overflowing"), "Should not have an overflowing toolbar.");
 });
 
 // Ctrl+K should focus the search bar if it is in the navbar and not overflowing.
-add_task(function() {
+add_task(function*() {
   let placement = CustomizableUI.getPlacementOfWidget("search-container");
   is(placement.area, CustomizableUI.AREA_NAVBAR, "Should be in nav-bar");
 
   sendWebSearchKeyCommand();
 
   yield waitForSearchBarFocus();
 });
 
 // Ctrl+K should open the search page if the search bar has been customized out.
-add_task(function() {
+add_task(function*() {
   try {
     expectOpenUILinkInCall = true;
     CustomizableUI.removeWidgetFromArea("search-container");
     let placement = CustomizableUI.getPlacementOfWidget("search-container");
     is(placement, null, "Search container should be in palette");
 
     openUILinkInCalled = false;
 
--- a/browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js
+++ b/browser/components/customizableui/test/browser_909779_overflow_toolbars_new_window.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Resize to a small window, open a new window, check that new window handles overflow properly
-add_task(function() {
+add_task(function*() {
   let originalWindowWidth = window.outerWidth;
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   let oldChildCount = navbar.customizationTarget.childElementCount;
   window.resizeTo(400, window.outerHeight);
   yield waitForCondition(() => navbar.hasAttribute("overflowing"));
   ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
 
@@ -21,11 +21,11 @@ add_task(function() {
   ok(otherNavBar.hasAttribute("overflowing"), "Other window should have an overflowing toolbar.");
   yield promiseWindowClosed(newWindow);
 
   window.resizeTo(originalWindowWidth, window.outerHeight);
   yield waitForCondition(() => !navbar.hasAttribute("overflowing"));
   ok(!navbar.hasAttribute("overflowing"), "Should no longer have an overflowing toolbar.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_913972_currentset_overflow.js
+++ b/browser/components/customizableui/test/browser_913972_currentset_overflow.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
 // Resize to a small window, resize back, shouldn't affect currentSet
-add_task(function() {
+add_task(function*() {
   let originalWindowWidth = window.outerWidth;
   let oldCurrentSet = navbar.currentSet;
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
   let oldChildCount = navbar.customizationTarget.childElementCount;
   window.resizeTo(400, window.outerHeight);
   yield waitForCondition(() => navbar.hasAttribute("overflowing"));
   ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
@@ -34,22 +34,22 @@ add_task(function() {
     }
     is(placements[placementCounter++], node.id, "Nodes should match after overflow");
   }
   is(placements.length, placementCounter, "Should have as many nodes as expected");
   is(navbar.customizationTarget.childElementCount, oldChildCount, "Number of nodes should match");
 });
 
 // Enter and exit customization mode, check that currentSet works
-add_task(function() {
+add_task(function*() {
   let oldCurrentSet = navbar.currentSet;
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
   yield startCustomizing();
   ok(CustomizableUI.inDefaultState, "Should be in default state in customization mode.");
   is(navbar.currentSet, oldCurrentSet, "Currentset should be the same in customization mode.");
   yield endCustomizing();
   ok(CustomizableUI.inDefaultState, "Should be in default state after customization mode.");
   is(navbar.currentSet, oldCurrentSet, "Currentset should be the same after customization mode.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_914138_widget_API_overflowable_toolbar.js
+++ b/browser/components/customizableui/test/browser_914138_widget_API_overflowable_toolbar.js
@@ -13,17 +13,17 @@ const kTestBtn3 = "test-createWidget-ove
 const kHomeBtn = "home-button";
 const kDownloadsBtn = "downloads-button";
 const kSearchBox = "search-container";
 const kStarBtn = "bookmarks-menu-button";
 
 var originalWindowWidth;
 
 // Adding a widget should add it next to the widget it's being inserted next to.
-add_task(function() {
+add_task(function*() {
   originalWindowWidth = window.outerWidth;
   createDummyXULButton(kTestBtn1, "Test");
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
 
   window.resizeTo(400, window.outerHeight);
   yield waitForCondition(() => navbar.hasAttribute("overflowing"));
   ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
@@ -54,17 +54,17 @@ add_task(function() {
   if (el) {
     CustomizableUI.removeWidgetFromArea(kTestBtn1);
     el.remove();
   }
   window.resizeTo(originalWindowWidth, window.outerHeight);
 });
 
 // Removing a widget should remove it from the overflow list if that is where it is, and update it accordingly.
-add_task(function() {
+add_task(function*() {
   createDummyXULButton(kTestBtn2, "Test");
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
   CustomizableUI.addWidgetToArea(kTestBtn2, navbar.id);
   ok(!navbar.hasAttribute("overflowing"), "Should still have a non-overflowing toolbar.");
 
   window.resizeTo(400, window.outerHeight);
   yield waitForCondition(() => navbar.hasAttribute("overflowing"));
@@ -85,17 +85,17 @@ add_task(function() {
   if (el) {
     CustomizableUI.removeWidgetFromArea(kTestBtn2);
     el.remove();
   }
   window.resizeTo(originalWindowWidth, window.outerHeight);
 });
 
 // Constructing a widget while overflown should set the right class on it.
-add_task(function() {
+add_task(function*() {
   originalWindowWidth = window.outerWidth;
   ok(!navbar.hasAttribute("overflowing"), "Should start with a non-overflowing toolbar.");
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
 
   window.resizeTo(400, window.outerHeight);
   yield waitForCondition(() => navbar.hasAttribute("overflowing"));
   ok(navbar.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
   ok(!navbar.querySelector("#" + kHomeBtn), "Home button should no longer be in the navbar");
@@ -120,12 +120,12 @@ add_task(function() {
 
   CustomizableUI.removeWidgetFromArea(kTestBtn3);
   testNode = document.getElementById(kTestBtn3);
   ok(!testNode, "Test button should be gone");
   CustomizableUI.destroyWidget(kTestBtn3);
   window.resizeTo(originalWindowWidth, window.outerHeight);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   window.resizeTo(originalWindowWidth, window.outerHeight);
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_914863_disabled_help_quit_buttons.js
+++ b/browser/components/customizableui/test/browser_914863_disabled_help_quit_buttons.js
@@ -1,14 +1,14 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Entering then exiting customization mode should reenable the Help and Exit buttons.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let helpButton = document.getElementById("PanelUI-help");
   let quitButton = document.getElementById("PanelUI-quit");
   ok(helpButton.getAttribute("disabled") == "true", "Help button should be disabled while in customization mode.");
   ok(quitButton.getAttribute("disabled") == "true", "Quit button should be disabled while in customization mode.");
   yield endCustomizing();
 
   ok(!helpButton.hasAttribute("disabled"), "Help button should not be disabled.");
--- a/browser/components/customizableui/test/browser_918049_skipintoolbarset_dnd.js
+++ b/browser/components/customizableui/test/browser_918049_skipintoolbarset_dnd.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var navbar;
 var skippedItem;
 
 // Attempting to drag a skipintoolbarset item should work.
-add_task(function() {
+add_task(function*() {
   navbar = document.getElementById("nav-bar");
   skippedItem = document.createElement("toolbarbutton");
   skippedItem.id = "test-skipintoolbarset-item";
   skippedItem.setAttribute("label", "Test");
   skippedItem.setAttribute("skipintoolbarset", "true");
   skippedItem.setAttribute("removable", "true");
   navbar.customizationTarget.appendChild(skippedItem);
   let downloadsButton = document.getElementById("downloads-button");
@@ -26,13 +26,13 @@ add_task(function() {
      downloadsButton.parentNode.id, "Should be next to downloads button");
   simulateItemDrag(downloadsButton, skippedItem);
   let downloadWrapper = downloadsButton.parentNode;
   is(downloadWrapper.nextSibling && downloadWrapper.nextSibling.id,
      skippedItem.parentNode.id, "Should be next to skipintoolbarset item");
   ok(CustomizableUI.inDefaultState, "Should still be in default state");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   skippedItem.remove();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
+++ b/browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
@@ -1,25 +1,25 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Customize mode reset button should revert correctly
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let devButton = document.getElementById("developer-button");
   let downloadsButton = document.getElementById("downloads-button");
   let searchBox = document.getElementById("search-container");
   let palette = document.getElementById("customization-palette");
   ok(devButton && downloadsButton && searchBox && palette, "Stuff should exist");
   simulateItemDrag(devButton, downloadsButton);
   simulateItemDrag(searchBox, palette);
   gCustomizeMode.reset();
   yield waitForCondition(() => !gCustomizeMode.resetting);
   ok(CustomizableUI.inDefaultState, "Should be back in default state");
   yield endCustomizing();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_927717_customize_drag_empty_toolbar.js
+++ b/browser/components/customizableui/test/browser_927717_customize_drag_empty_toolbar.js
@@ -2,25 +2,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kTestToolbarId = "test-empty-drag";
 
 // Attempting to drag an item to an empty container should work.
-add_task(function() {
+add_task(function*() {
   yield createToolbarWithPlacements(kTestToolbarId, []);
   yield startCustomizing();
   let downloadButton = document.getElementById("downloads-button");
   let customToolbar = document.getElementById(kTestToolbarId);
   simulateItemDrag(downloadButton, customToolbar);
   assertAreaPlacements(kTestToolbarId, ["downloads-button"]);
   ok(downloadButton.parentNode && downloadButton.parentNode.parentNode == customToolbar,
      "Button should really be in toolbar");
   yield endCustomizing();
   removeCustomToolbars();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_932928_show_notice_when_palette_empty.js
+++ b/browser/components/customizableui/test/browser_932928_show_notice_when_palette_empty.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // There should be an advert to get more addons when the palette is empty.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let visiblePalette = document.getElementById("customization-palette");
   let emptyPaletteNotice = document.getElementById("customization-empty");
   is(emptyPaletteNotice.hidden, true, "The empty palette notice should not be shown when there are items in the palette.");
 
   while (visiblePalette.childElementCount) {
     gCustomizeMode.addToToolbar(visiblePalette.children[0]);
   }
@@ -24,12 +24,12 @@ add_task(function() {
   is(emptyPaletteNotice.hidden, false,
      "The empty palette notice should be shown when there are no items in the palette and cust. mode is re-entered.");
 
   gCustomizeMode.removeFromArea(document.getElementById("wrapper-home-button"));
   is(emptyPaletteNotice.hidden, true,
      "The empty palette notice should not be shown when there is at least one item in the palette.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_934113_menubar_removable.js
+++ b/browser/components/customizableui/test/browser_934113_menubar_removable.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Attempting to drag the menubar to the navbar shouldn't work.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   let menuItems = document.getElementById("menubar-items");
   let navbar = document.getElementById("nav-bar");
   let menubar = document.getElementById("toolbar-menubar");
   // Force the menu to be shown.
   const kAutohide = menubar.getAttribute("autohide");
   menubar.setAttribute("autohide", "false");
   simulateItemDrag(menuItems, navbar.customizationTarget);
@@ -19,12 +19,12 @@ add_task(function() {
   ok(!navbar.querySelector("#menubar-items"), "Shouldn't find menubar items in the navbar.");
   ok(menubar.querySelector("#menubar-items"), "Should find menubar items in the menubar.");
   isnot(getAreaWidgetIds("toolbar-menubar").indexOf("menubar-items"), -1,
         "Menubar items shouldn't be missing from the navbar.");
   menubar.setAttribute("autohide", kAutohide);
   yield endCustomizing();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_934951_zoom_in_toolbar.js
+++ b/browser/components/customizableui/test/browser_934951_zoom_in_toolbar.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kTimeoutInMS = 20000;
 
 // Bug 934951 - Zoom controls percentage label doesn't update when it's in the toolbar and you navigate.
-add_task(function() {
+add_task(function*() {
   CustomizableUI.addWidgetToArea("zoom-controls", CustomizableUI.AREA_NAVBAR);
   let tab1 = gBrowser.addTab("about:mozilla");
   yield BrowserTestUtils.browserLoaded(tab1.linkedBrowser);
   let tab2 = gBrowser.addTab("about:robots");
   yield BrowserTestUtils.browserLoaded(tab2.linkedBrowser);
   gBrowser.selectedTab = tab1;
   let zoomResetButton = document.getElementById("zoom-reset-button");
 
--- a/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
+++ b/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
@@ -6,28 +6,28 @@
 
 requestLongerTimeout(2);
 
 var bookmarksToolbar = document.getElementById("PersonalToolbar");
 var navbar = document.getElementById("nav-bar");
 var tabsToolbar = document.getElementById("TabsToolbar");
 
 // Customization reset should restore visibility to default-visible toolbars.
-add_task(function() {
+add_task(function*() {
   is(navbar.collapsed, false, "Test should start with navbar visible");
   setToolbarVisibility(navbar, false);
   is(navbar.collapsed, true, "navbar should be hidden now");
 
   yield resetCustomization();
 
   is(navbar.collapsed, false, "Customization reset should restore visibility to the navbar");
 });
 
 // Customization reset should restore collapsed-state to default-collapsed toolbars.
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
 
   is(bookmarksToolbar.collapsed, true, "Test should start with bookmarks toolbar collapsed");
   ok(bookmarksToolbar.collapsed, "bookmarksToolbar should be collapsed");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
   is(navbar.collapsed, false, "The nav-bar should be shown by default");
 
   setToolbarVisibility(bookmarksToolbar, true);
@@ -43,17 +43,17 @@ add_task(function() {
 
   is(bookmarksToolbar.collapsed, true, "Customization reset should restore collapsed-state to the bookmarks toolbar");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
   ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
   ok(CustomizableUI.inDefaultState, "Everything should be back to default state");
 });
 
 // Check that the menubar will be collapsed by resetting, if the platform supports it.
-add_task(function() {
+add_task(function*() {
   let menubar = document.getElementById("toolbar-menubar");
   const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
   if (!canMenubarCollapse) {
     return;
   }
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
 
   is(menubar.getBoundingClientRect().height, 0, "menubar should be hidden by default");
@@ -69,17 +69,17 @@ add_task(function() {
 
   yield endCustomizing();
 
   is(menubar.getAttribute("autohide"), "true", "The menubar should have autohide=true after reset");
   is(menubar.getBoundingClientRect().height, 0, "The menubar should have height=0 after reset");
 });
 
 // Customization reset should restore collapsed-state to default-collapsed toolbars.
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
   ok(bookmarksToolbar.collapsed, "bookmarksToolbar should be collapsed");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
 
   setToolbarVisibility(bookmarksToolbar, true);
   ok(!bookmarksToolbar.collapsed, "bookmarksToolbar should be visible now");
   is(CustomizableUI.inDefaultState, false, "Should no longer be in default state");
 
@@ -95,17 +95,17 @@ add_task(function() {
   ok(bookmarksToolbar.collapsed, "The bookmarksToolbar should be collapsed after reset");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
   ok(!navbar.collapsed, "The navbar should still be visible after reset");
   ok(CustomizableUI.inDefaultState, "Everything should be back to default state");
   yield endCustomizing();
 });
 
 // Check that the menubar will be collapsed by resetting, if the platform supports it.
-add_task(function() {
+add_task(function*() {
   let menubar = document.getElementById("toolbar-menubar");
   const canMenubarCollapse = CustomizableUI.isToolbarDefaultCollapsed(menubar.id);
   if (!canMenubarCollapse) {
     return;
   }
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
   yield startCustomizing();
   let resetButton = document.getElementById("customization-reset-button");
--- a/browser/components/customizableui/test/browser_940013_registerToolbarNode_calls_registerArea.js
+++ b/browser/components/customizableui/test/browser_940013_registerToolbarNode_calls_registerArea.js
@@ -4,17 +4,17 @@
 
 "use strict";
 
 const kToolbarId = "test-registerToolbarNode-toolbar";
 const kButtonId = "test-registerToolbarNode-button";
 registerCleanupFunction(cleanup);
 
 // Registering a toolbar with defaultset attribute should work
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
   let btn = createDummyXULButton(kButtonId);
   let toolbar = document.createElement("toolbar");
   toolbar.id = kToolbarId;
   toolbar.setAttribute("customizable", true);
   toolbar.setAttribute("defaultset", kButtonId);
   gNavToolbox.appendChild(toolbar);
   ok(CustomizableUI.areas.indexOf(kToolbarId) != -1,
@@ -26,17 +26,17 @@ add_task(function() {
   CustomizableUI.unregisterArea(kToolbarId, true);
   toolbar.remove();
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
   btn.remove();
 });
 
 // Registering a toolbar without a defaultset attribute should
 // wait for the registerArea call
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
   let btn = createDummyXULButton(kButtonId);
   let toolbar = document.createElement("toolbar");
   toolbar.id = kToolbarId;
   toolbar.setAttribute("customizable", true);
   gNavToolbox.appendChild(toolbar);
   ok(CustomizableUI.areas.indexOf(kToolbarId) == -1,
      "Toolbar should not yet have been registered automatically.");
@@ -48,17 +48,17 @@ add_task(function() {
   assertAreaPlacements(kToolbarId, [kButtonId]);
   ok(!CustomizableUI.inDefaultState, "No longer in default state after toolbar is registered and visible.");
   CustomizableUI.unregisterArea(kToolbarId, true);
   toolbar.remove();
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
   btn.remove();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
 
 function cleanup() {
   let toolbar = document.getElementById(kToolbarId);
   if (toolbar) {
     toolbar.remove();
   }
--- a/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
+++ b/browser/components/customizableui/test/browser_940307_panel_click_closure_handling.js
@@ -1,30 +1,30 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var button, menuButton;
 /* Clicking a button should close the panel */
-add_task(function() {
+add_task(function*() {
   button = document.createElement("toolbarbutton");
   button.id = "browser_940307_button";
   button.setAttribute("label", "Button");
   PanelUI.contents.appendChild(button);
   yield PanelUI.show();
   let hiddenAgain = promisePanelHidden(window);
   EventUtils.synthesizeMouseAtCenter(button, {});
   yield hiddenAgain;
   button.remove();
 });
 
 /* Clicking a menu button should close the panel, opening the popup shouldn't.  */
-add_task(function() {
+add_task(function*() {
   menuButton = document.createElement("toolbarbutton");
   menuButton.setAttribute("type", "menu-button");
   menuButton.id = "browser_940307_menubutton";
   menuButton.setAttribute("label", "Menu button");
 
   let menuPopup = document.createElement("menupopup");
   menuPopup.id = "browser_940307_menupopup";
 
--- a/browser/components/customizableui/test/browser_940946_removable_from_navbar_customizemode.js
+++ b/browser/components/customizableui/test/browser_940946_removable_from_navbar_customizemode.js
@@ -2,21 +2,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kTestBtnId = "test-removable-navbar-customize-mode";
 
 // Items without the removable attribute in the navbar should be considered non-removable
-add_task(function() {
+add_task(function*() {
   let btn = createDummyXULButton(kTestBtnId, "Test removable in navbar in customize mode");
   document.getElementById("nav-bar").customizationTarget.appendChild(btn);
   yield startCustomizing();
   ok(!CustomizableUI.isWidgetRemovable(kTestBtnId), "Widget should not be considered removable");
   yield endCustomizing();
   document.getElementById(kTestBtnId).remove();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_942581_unregisterArea_keeps_placements.js
+++ b/browser/components/customizableui/test/browser_942581_unregisterArea_keeps_placements.js
@@ -5,17 +5,17 @@
 "use strict";
 
 const kToolbarName = "test-unregisterArea-placements-toolbar";
 const kTestWidgetPfx = "test-widget-for-unregisterArea-placements-";
 const kTestWidgetCount = 3;
 registerCleanupFunction(removeCustomToolbars);
 
 // unregisterArea should keep placements by default and restore them when re-adding the area
-add_task(function() {
+add_task(function*() {
   let widgetIds = [];
   for (let i = 0; i < kTestWidgetCount; i++) {
     let id = kTestWidgetPfx + i;
     widgetIds.push(id);
     let spec = {id: id, type: 'button', removable: true, label: "unregisterArea test", tooltiptext: "" + i};
     CustomizableUI.createWidget(spec);
   }
   for (let i = kTestWidgetCount; i < kTestWidgetCount * 2; i++) {
@@ -96,11 +96,11 @@ function checkWidgetFates(aWidgetIds) {
     ok(!document.getElementById(widget), "Widget should not be in the DOM");
     let widgetInPalette = !!gNavToolbox.palette.querySelector("#" + widget);
     let widgetProvider = CustomizableUI.getWidget(widget).provider;
     let widgetIsXULWidget = widgetProvider == CustomizableUI.PROVIDER_XUL;
     is(widgetInPalette, widgetIsXULWidget, "Just XUL Widgets should be in the palette");
   }
 }
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_943683_migration_test.js
+++ b/browser/components/customizableui/test/browser_943683_migration_test.js
@@ -9,17 +9,17 @@ const kWidgetId2 = "test-addonbar-migrat
 
 var addonbar = document.getElementById(CustomizableUI.AREA_ADDONBAR);
 var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
 var btn;
 var btn2;
 
 // Check we migrate normal stuff to the navbar
-add_task(function() {
+add_task(function*() {
   btn = createDummyXULButton(kWidgetId, "Test");
   btn2 = createDummyXULButton(kWidgetId2, "Test2");
   addonbar.insertItem(btn.id);
   ok(btn.parentNode == navbar.customizationTarget, "Button should end up in navbar");
   let migrationArray = addonbar.getMigratedItems();
   is(migrationArray.length, 1, "Should have migrated 1 item");
   is(migrationArray[0], kWidgetId, "Should have migrated our 1 item");
 
--- a/browser/components/customizableui/test/browser_944887_destroyWidget_should_destroy_in_palette.js
+++ b/browser/components/customizableui/test/browser_944887_destroyWidget_should_destroy_in_palette.js
@@ -2,16 +2,16 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kWidgetId = "test-destroy-in-palette";
 
 // Check destroyWidget destroys the node if it's in the palette
-add_task(function() {
+add_task(function*() {
   CustomizableUI.createWidget({id: kWidgetId, label: "Test destroying widgets in palette."});
   yield startCustomizing();
   yield endCustomizing();
   ok(gNavToolbox.palette.querySelector("#" + kWidgetId), "Widget still exists in palette.");
   CustomizableUI.destroyWidget(kWidgetId);
   ok(!gNavToolbox.palette.querySelector("#" + kWidgetId), "Widget no longer exists in palette.");
 });
--- a/browser/components/customizableui/test/browser_945739_showInPrivateBrowsing_customize_mode.js
+++ b/browser/components/customizableui/test/browser_945739_showInPrivateBrowsing_customize_mode.js
@@ -4,17 +4,17 @@
 
 "use strict";
 
 const kWidgetId = "test-private-browsing-customize-mode-widget";
 
 // Add a widget via the API with showInPrivateBrowsing set to false
 // and ensure it does not appear in the list of unused widgets in private
 // windows.
-add_task(function testPrivateBrowsingCustomizeModeWidget() {
+add_task(function* testPrivateBrowsingCustomizeModeWidget() {
   CustomizableUI.createWidget({
     id: kWidgetId,
     showInPrivateBrowsing: false
   });
 
   let normalWidgetArray = CustomizableUI.getUnusedWidgets(gNavToolbox.palette);
   normalWidgetArray = normalWidgetArray.map((w) => w.id);
   ok(normalWidgetArray.indexOf(kWidgetId) > -1,
@@ -25,11 +25,11 @@ add_task(function testPrivateBrowsingCus
   privateWidgetArray = privateWidgetArray.map((w) => w.id);
   is(privateWidgetArray.indexOf(kWidgetId), -1,
      "Widget should not appear as unused in private window");
   yield promiseWindowClosed(privateWindow);
 
   CustomizableUI.destroyWidget(kWidgetId); 
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_946320_tabs_from_other_computers.js
+++ b/browser/components/customizableui/test/browser_946320_tabs_from_other_computers.js
@@ -6,17 +6,17 @@
 
 var Preferences = Cu.import("resource://gre/modules/Preferences.jsm", {}).Preferences;
 
 const {FxAccounts, AccountState} = Cu.import("resource://gre/modules/FxAccounts.jsm", {});
 
 // FxA logs can be gotten at via this pref which helps debugging.
 Preferences.set("services.sync.log.appender.dump", "Debug");
 
-add_task(function() {
+add_task(function*() {
   yield PanelUI.show({type: "command"});
 
   let historyButton = document.getElementById("history-panelmenu");
   let historySubview = document.getElementById("PanelUI-history");
   let subviewShownPromise = subviewShown(historySubview);
   historyButton.click();
   yield subviewShownPromise;
 
--- a/browser/components/customizableui/test/browser_947914_button_addons.js
+++ b/browser/components/customizableui/test/browser_947914_button_addons.js
@@ -2,17 +2,17 @@
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialLocation = gBrowser.currentURI.spec;
 var newTab = null;
 
-add_task(function() {
+add_task(function*() {
   info("Check addons button existence and functionality");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let addonsButton = document.getElementById("add-ons-button");
   ok(addonsButton, "Add-ons button exists in Panel Menu");
   addonsButton.click();
@@ -21,13 +21,13 @@ add_task(function() {
   yield waitForCondition(() => gBrowser.currentURI &&
                                gBrowser.currentURI.spec == "about:addons");
 
   let addonsPage = gBrowser.selectedBrowser.contentWindow.document.
                             getElementById("addons-page");
   ok(addonsPage, "Add-ons page was opened");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(gBrowser.selectedTab);
   info("Tabs were restored");
 });
--- a/browser/components/customizableui/test/browser_947914_button_copy.js
+++ b/browser/components/customizableui/test/browser_947914_button_copy.js
@@ -2,17 +2,17 @@
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialLocation = gBrowser.currentURI.spec;
 var globalClipboard;
 
-add_task(function() {
+add_task(function*() {
   info("Check copy button existence and functionality");
 
   let testText = "copy text test";
 
   gURLBar.focus();
   info("The URL bar was focused");
   yield PanelUI.show();
   info("Menu panel was opened");
@@ -47,17 +47,17 @@ add_task(function() {
 
   if (str.value) {
     str.value.QueryInterface(Ci.nsISupportsString);
     clipboardValue = str.value.data;
   }
   is(clipboardValue, testText, "Data was copied to the clipboard.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // clear the clipboard
   Services.clipboard.emptyClipboard(globalClipboard);
   info("Clipboard was cleared");
 
   // restore the tab as it was at the begining of the test
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(gBrowser.selectedTab);
   info("Tabs were restored");
--- a/browser/components/customizableui/test/browser_947914_button_cut.js
+++ b/browser/components/customizableui/test/browser_947914_button_cut.js
@@ -2,17 +2,17 @@
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialLocation = gBrowser.currentURI.spec;
 var globalClipboard;
 
-add_task(function() {
+add_task(function*() {
   info("Check cut button existence and functionality");
 
   let testText = "cut text test";
 
   gURLBar.focus();
   yield PanelUI.show();
   info("Menu panel was opened");
 
@@ -45,17 +45,17 @@ add_task(function() {
 
   if (str.value) {
     str.value.QueryInterface(Ci.nsISupportsString);
     clipboardValue = str.value.data;
   }
   is(clipboardValue, testText, "Data was copied to the clipboard.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // clear the clipboard
   Services.clipboard.emptyClipboard(globalClipboard);
   info("Clipboard was cleared");
 
   // restore the tab as it was at the begining of the test
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(gBrowser.selectedTab);
   info("Tabs were restored");
--- a/browser/components/customizableui/test/browser_947914_button_find.js
+++ b/browser/components/customizableui/test/browser_947914_button_find.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check find button existence and functionality");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let findButton = document.getElementById("find-button");
   ok(findButton, "Find button exists in Panel Menu");
 
--- a/browser/components/customizableui/test/browser_947914_button_history.js
+++ b/browser/components/customizableui/test/browser_947914_button_history.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check history button existence and functionality");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let historyButton = document.getElementById("history-panelmenu");
   ok(historyButton, "History button appears in Panel Menu");
 
--- a/browser/components/customizableui/test/browser_947914_button_newPrivateWindow.js
+++ b/browser/components/customizableui/test/browser_947914_button_newPrivateWindow.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check private browsing button existence and functionality");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let windowWasHandled = false;
   let privateWindow = null;
 
--- a/browser/components/customizableui/test/browser_947914_button_newWindow.js
+++ b/browser/components/customizableui/test/browser_947914_button_newWindow.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check new window button existence and functionality");
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let windowWasHandled = false;
   let newWindow = null;
 
   let observerWindowOpened = {
--- a/browser/components/customizableui/test/browser_947914_button_paste.js
+++ b/browser/components/customizableui/test/browser_947914_button_paste.js
@@ -2,17 +2,17 @@
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialLocation = gBrowser.currentURI.spec;
 var globalClipboard;
 
-add_task(function() {
+add_task(function*() {
   info("Check paste button existence and functionality");
 
   let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(Ci.nsIClipboardHelper);
   globalClipboard = Services.clipboard.kGlobalClipboard;
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
@@ -29,17 +29,17 @@ add_task(function() {
   info("Menu panel was opened");
 
   ok(!pasteButton.hasAttribute("disabled"), "Paste button is enabled");
   pasteButton.click();
 
   is(gURLBar.value, text, "Text pasted successfully");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // clear the clipboard
   Services.clipboard.emptyClipboard(globalClipboard);
   info("Clipboard was cleared");
 
   // restore the tab as it was at the begining of the test
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(gBrowser.selectedTab);
   info("Tabs were restored");
--- a/browser/components/customizableui/test/browser_947914_button_print.js
+++ b/browser/components/customizableui/test/browser_947914_button_print.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const isOSX = (Services.appinfo.OS === "Darwin");
 
-add_task(function() {
+add_task(function*() {
   info("Check print button existence and functionality");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   yield waitForCondition(() => document.getElementById("print-button") != null);
 
   let printButton = document.getElementById("print-button");
@@ -26,16 +26,16 @@ add_task(function() {
   else {
     printButton.click();
     yield waitForCondition(() => gInPrintPreviewMode);
 
     ok(gInPrintPreviewMode, "Entered print preview mode");
   }
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
     // close print preview
     if (gInPrintPreviewMode) {
       PrintUtils.exitPrintPreview();
       yield waitForCondition(() => !window.gInPrintPreviewMode);
       info("Exited print preview")
     }
 });
--- a/browser/components/customizableui/test/browser_947914_button_savePage.js
+++ b/browser/components/customizableui/test/browser_947914_button_savePage.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   info("Check save page button existence");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let savePageButton = document.getElementById("save-page-button");
   ok(savePageButton, "Save Page button exists in Panel Menu");
 
--- a/browser/components/customizableui/test/browser_947914_button_zoomIn.js
+++ b/browser/components/customizableui/test/browser_947914_button_zoomIn.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialPageZoom = ZoomManager.zoom;
 
-add_task(function() {
+add_task(function*() {
   info("Check zoom in button existence and functionality");
 
   is(initialPageZoom, 1, "Initial zoom factor should be 1");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let zoomInButton = document.getElementById("zoom-in-button");
@@ -25,13 +25,13 @@ add_task(function() {
 
   // close the Panel
   let panelHiddenPromise = promisePanelHidden(window);
   PanelUI.hide();
   yield panelHiddenPromise;
   info("Menu panel was closed");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // reset zoom level
   ZoomManager.zoom = initialPageZoom;
   info("Zoom level was restored");
 });
--- a/browser/components/customizableui/test/browser_947914_button_zoomOut.js
+++ b/browser/components/customizableui/test/browser_947914_button_zoomOut.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialPageZoom = ZoomManager.zoom;
 
-add_task(function() {
+add_task(function*() {
   info("Check zoom out button existence and functionality");
 
   is(initialPageZoom, 1, "Initial zoom factor should be 1");
 
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let zoomOutButton = document.getElementById("zoom-out-button");
@@ -26,13 +26,13 @@ add_task(function() {
 
   // close the panel
   let panelHiddenPromise = promisePanelHidden(window);
   PanelUI.hide();
   yield panelHiddenPromise;
   info("Menu panel was closed");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // reset zoom level
   ZoomManager.zoom = initialPageZoom;
   info("Zoom level was restored");
 });
--- a/browser/components/customizableui/test/browser_947914_button_zoomReset.js
+++ b/browser/components/customizableui/test/browser_947914_button_zoomReset.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var initialPageZoom = ZoomManager.zoom;
 
-add_task(function() {
+add_task(function*() {
   info("Check zoom reset button existence and functionality");
 
   is(initialPageZoom, 1, "Page zoom reset correctly");
   ZoomManager.zoom = 0.5;
   yield PanelUI.show();
   info("Menu panel was opened");
 
   let zoomResetButton = document.getElementById("zoom-reset-button");
@@ -26,13 +26,13 @@ add_task(function() {
 
   // close the panel
   let panelHiddenPromise = promisePanelHidden(window);
   PanelUI.hide();
   yield panelHiddenPromise;
   info("Menu panel was closed");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // reset zoom level
   ZoomManager.zoom = initialPageZoom;
   info("Zoom level was restored");
 });
--- a/browser/components/customizableui/test/browser_947987_removable_default.js
+++ b/browser/components/customizableui/test/browser_947987_removable_default.js
@@ -18,17 +18,17 @@ add_task(function() {
 
   // Widget without removable set should be removable:
   let wrapper = CustomizableUI.createWidget({id: kWidgetId + (widgetCounter++)});
   ok(CustomizableUI.isWidgetRemovable(wrapper.id), "Should be removable by default.");
   CustomizableUI.destroyWidget(wrapper.id);
 });
 
 // Test non-removable widget with defaultArea
-add_task(function() {
+add_task(function*() {
   // Non-removable widget with defaultArea should work:
   let spec = {id: kWidgetId + (widgetCounter++), removable: false,
               defaultArea: kNavBar};
   let widgetWrapper;
   try {
     widgetWrapper = CustomizableUI.createWidget(spec);
   } catch (ex) {
     ok(false, "Creating a non-removable widget with a default area should not throw.");
@@ -58,11 +58,11 @@ add_task(function() {
       is(singleWrapper.node.parentNode, expectedParent,
          "Widget should be in navbar in other window.");
     }
   }
   CustomizableUI.destroyWidget(spec.id);
   yield promiseWindowClosed(otherWin);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_952963_areaType_getter_no_area.js
+++ b/browser/components/customizableui/test/browser_952963_areaType_getter_no_area.js
@@ -14,17 +14,17 @@ function checkAreaType(widget) {
     is(widget.areaType, null, "areaType should be null");
   } catch (ex) {
     info("Fetching areaType threw: " + ex);
     ok(false, "areaType getter shouldn't throw.");
   }
 }
 
 // widget wrappers in unregisterArea'd areas and nowhere shouldn't throw when checking areaTypes.
-add_task(function() {
+add_task(function*() {
   // Using the ID before it's been created will imply a XUL wrapper; we'll test
   // an API-based wrapper below
   let toolbarNode = createToolbarWithPlacements(kToolbarName, [kUnregisterAreaTestWidget]);
   CustomizableUI.unregisterArea(kToolbarName);
   toolbarNode.remove();
 
   let w = CustomizableUI.getWidget(kUnregisterAreaTestWidget);
   checkAreaType(w);
@@ -41,12 +41,12 @@ add_task(function() {
   w = CustomizableUI.getWidget(spec.id);
   checkAreaType(w);
   CustomizableUI.removeWidgetFromArea(kUnregisterAreaTestWidget);
   checkAreaType(w);
   //XXXgijs: ensure cleanup function doesn't barf:
   gAddedToolbars.delete(kToolbarName);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
 
--- a/browser/components/customizableui/test/browser_956602_remove_special_widget.js
+++ b/browser/components/customizableui/test/browser_956602_remove_special_widget.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 
 // Adding a separator and then dragging it out of the navbar shouldn't throw
-add_task(function() {
+add_task(function*() {
   try {
     let navbar = document.getElementById("nav-bar");
     let separatorSelector = "toolbarseparator[id^=customizableui-special-separator]";
     ok(!navbar.querySelector(separatorSelector), "Shouldn't be a separator in the navbar");
     CustomizableUI.addWidgetToArea('separator', 'nav-bar');
     yield startCustomizing();
     let separator = navbar.querySelector(separatorSelector);
     ok(separator, "There should be a separator in the navbar now.");
@@ -21,11 +21,11 @@ add_task(function() {
   } catch (ex) {
     Cu.reportError(ex);
     ok(false, "Shouldn't throw an exception moving an item to the navbar.");
   } finally {
     yield endCustomizing();
   }
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_962884_opt_in_disable_hyphens.js
+++ b/browser/components/customizableui/test/browser_962884_opt_in_disable_hyphens.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   const kNormalLabel = "Character Encoding";
   CustomizableUI.addWidgetToArea("characterencoding-button", CustomizableUI.AREA_NAVBAR);
   let characterEncoding = document.getElementById("characterencoding-button");
   const kOriginalLabel = characterEncoding.getAttribute("label");
   characterEncoding.setAttribute("label", "\u00ad" + kNormalLabel);
   CustomizableUI.addWidgetToArea("characterencoding-button", CustomizableUI.AREA_PANEL);
 
   yield PanelUI.show();
@@ -56,12 +56,12 @@ add_task(function() {
 
   CustomizableUI.addWidgetToArea("characterencoding-button", CustomizableUI.AREA_NAVBAR);
   ok(!characterEncoding.hasAttribute("auto-hyphens"),
      "Removing the widget from the panel should remove the auto-hyphens attribute");
 
   characterEncoding.setAttribute("label", kOriginalLabel);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_963639_customizing_attribute_non_customizable_toolbar.js
+++ b/browser/components/customizableui/test/browser_963639_customizing_attribute_non_customizable_toolbar.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
   * License, v. 2.0. If a copy of the MPL was not distributed with this
   * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kToolbar = "test-toolbar-963639-non-customizable-customizing-attribute";
 
-add_task(function() {
+add_task(function*() {
   info("Test for Bug 963639 - CustomizeMode _onToolbarVisibilityChange sets @customizing on non-customizable toolbars");
 
   let toolbar = document.createElement("toolbar");
   toolbar.id = kToolbar;
   gNavToolbox.appendChild(toolbar);
 
   let testToolbar = document.getElementById(kToolbar)
   ok(testToolbar, "Toolbar was created.");
--- a/browser/components/customizableui/test/browser_967000_button_charEncoding.js
+++ b/browser/components/customizableui/test/browser_967000_button_charEncoding.js
@@ -4,17 +4,17 @@
 
 "use strict";
 
 const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test_967000_charEncoding_page.html";
 
 var newTab;
 var initialLocation = gBrowser.currentURI.spec;
 
-add_task(function() {
+add_task(function*() {
   info("Check Character Encoding button functionality");
 
   // add the Character Encoding button to the panel
   CustomizableUI.addWidgetToArea("characterencoding-button",
                                   CustomizableUI.AREA_PANEL);
 
   // check the button's functionality
   yield PanelUI.show();
@@ -50,17 +50,17 @@ add_task(function() {
      1,
      "There should be 1 checked detector.");
 
   panelHidePromise = promisePanelHidden(window);
   PanelUI.hide();
   yield panelHidePromise;
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // reset the panel to the default state
   yield resetCustomization();
   ok(CustomizableUI.inDefaultState, "The UI is in default state again.");
 
   // restore the initial location
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(newTab);
 });
--- a/browser/components/customizableui/test/browser_967000_button_feeds.js
+++ b/browser/components/customizableui/test/browser_967000_button_feeds.js
@@ -5,17 +5,17 @@
 "use strict";
 
 const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/feeds_test_page.html";
 const TEST_FEED = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test-feed.xml"
 
 var newTab = null;
 var initialLocation = gBrowser.currentURI.spec;
 
-add_task(function() {
+add_task(function*() {
   info("Check Subscribe button functionality");
 
   // add the Subscribe button to the panel
   CustomizableUI.addWidgetToArea("feed-button",
                                   CustomizableUI.AREA_PANEL);
 
   // check the button's functionality
   yield PanelUI.show();
@@ -44,17 +44,17 @@ add_task(function() {
 
   if(isPanelUIOpen()) {
     panelHidePromise = promisePanelHidden(window);
     PanelUI.hide();
     yield panelHidePromise;
   }
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // reset the panel UI to the default state
   yield resetCustomization();
   ok(CustomizableUI.inDefaultState, "The UI is in default state again.");
 
   // restore the initial location
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(newTab);
 });
--- a/browser/components/customizableui/test/browser_967000_button_sync.js
+++ b/browser/components/customizableui/test/browser_967000_button_sync.js
@@ -41,17 +41,17 @@ add_task(function* setup() {
   SyncedTabs._internal = mockedInternal;
 
   registerCleanupFunction(() => {
     SyncedTabs._internal = oldInternal;
   });
 });
 
 // The test expects the about:preferences#sync page to open in the current tab
-function openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
+function* openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
   info("Check Sync button functionality");
   Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");
 
   // add the Sync button to the panel
   CustomizableUI.addWidgetToArea("sync-button", CustomizableUI.AREA_PANEL);
 
   // check the button's functionality
   yield PanelUI.show();
@@ -97,17 +97,17 @@ function openPrefsFromMenuPanel(expected
 
   if(isPanelUIOpen()) {
     let panelHidePromise = promisePanelHidden(window);
     PanelUI.hide();
     yield panelHidePromise;
   }
 }
 
-function asyncCleanup() {
+function* asyncCleanup() {
   Services.prefs.clearUserPref("identity.fxaccounts.remote.signup.uri");
   // reset the panel UI to the default state
   yield resetCustomization();
   ok(CustomizableUI.inDefaultState, "The panel UI is in default state again.");
 
   // restore the tabs
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(newTab);
--- a/browser/components/customizableui/test/browser_968447_bookmarks_toolbar_items_in_panel.js
+++ b/browser/components/customizableui/test/browser_968447_bookmarks_toolbar_items_in_panel.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Bug 968447 - The Bookmarks Toolbar Items doesn't appear as a
 // normal menu panel button in new windows.
-add_task(function() {
+add_task(function*() {
   const buttonId = "bookmarks-toolbar-placeholder";
   yield startCustomizing();
   CustomizableUI.addWidgetToArea("personal-bookmarks", CustomizableUI.AREA_PANEL);
   yield endCustomizing();
 
   yield PanelUI.show();
 
   let bookmarksToolbarPlaceholder = document.getElementById(buttonId);
@@ -53,13 +53,13 @@ add_task(function() {
   } else {
     info("panel was already closed");
   }
 
   info("Waiting for new window to close");
   yield promiseWindowClosed(newWin);
 });
 
-add_task(function asyncCleanUp() {
+add_task(function* asyncCleanUp() {
   yield endCustomizing();
   CustomizableUI.reset();
 });
 
--- a/browser/components/customizableui/test/browser_968565_insert_before_hidden_items.js
+++ b/browser/components/customizableui/test/browser_968565_insert_before_hidden_items.js
@@ -7,17 +7,17 @@
 const kHidden1Id = "test-hidden-button-1";
 const kHidden2Id = "test-hidden-button-2";
 
 var navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
 // When we drag an item onto a customizable area, and not over a specific target, we
 // should assume that we're appending them to the area. If doing so, we should scan
 // backwards over any hidden items and insert the item before those hidden items.
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Should be in the default state");
 
   // Iterate backwards over the items in the nav-bar until we find the first
   // one that is not hidden.
   let placements = CustomizableUI.getWidgetsInArea(CustomizableUI.AREA_NAVBAR);
   let lastVisible = null;
   for (let widgetGroup of placements.reverse()) {
     let widget = widgetGroup.forWindow(window);
--- a/browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js
+++ b/browser/components/customizableui/test/browser_969661_character_encoding_navbar_disabled.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 
 // Adding the character encoding menu to the panel, exiting customize mode,
 // and moving it to the nav-bar should have it enabled, not disabled.
-add_task(function() {
+add_task(function*() {
   yield startCustomizing();
   CustomizableUI.addWidgetToArea("characterencoding-button", "PanelUI-contents");
   yield endCustomizing();
   yield PanelUI.show();
   let panelHiddenPromise = promisePanelHidden(window);
   PanelUI.hide();
   yield panelHiddenPromise;
   CustomizableUI.addWidgetToArea("characterencoding-button", 'nav-bar');
--- a/browser/components/customizableui/test/browser_970511_undo_restore_default.js
+++ b/browser/components/customizableui/test/browser_970511_undo_restore_default.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 requestLongerTimeout(2);
 
 // Restoring default should show an "undo" option which undoes the restoring operation.
-add_task(function() {
+add_task(function*() {
   let homeButtonId = "home-button";
   CustomizableUI.removeWidgetFromArea(homeButtonId);
   yield startCustomizing();
   ok(!CustomizableUI.inDefaultState, "Not in default state to begin with");
   is(CustomizableUI.getPlacementOfWidget(homeButtonId), null, "Home button is in palette");
   let undoResetButton = document.getElementById("customization-undo-reset-button");
   is(undoResetButton.hidden, true, "The undo button is hidden before reset");
 
@@ -26,17 +26,17 @@ add_task(function() {
   ok(!CustomizableUI.inDefaultState, "Not in default state after reset-undo");
   is(undoResetButton.hidden, true, "The undo button is hidden after clicking on the undo button");
   is(CustomizableUI.getPlacementOfWidget(homeButtonId), null, "Home button is in palette");
 
   yield gCustomizeMode.reset();
 });
 
 // Performing an action after a reset will hide the reset button.
-add_task(function() {
+add_task(function*() {
   let homeButtonId = "home-button";
   CustomizableUI.removeWidgetFromArea(homeButtonId);
   ok(!CustomizableUI.inDefaultState, "Not in default state to begin with");
   is(CustomizableUI.getPlacementOfWidget(homeButtonId), null, "Home button is in palette");
   let undoResetButton = document.getElementById("customization-undo-reset-button");
   is(undoResetButton.hidden, true, "The undo button is hidden before reset");
 
   yield gCustomizeMode.reset();
@@ -44,30 +44,30 @@ add_task(function() {
   ok(CustomizableUI.inDefaultState, "In default state after reset");
   is(undoResetButton.hidden, false, "The undo button is visible after reset");
 
   CustomizableUI.addWidgetToArea(homeButtonId, CustomizableUI.AREA_PANEL);
   is(undoResetButton.hidden, true, "The undo button is hidden after another change");
 });
 
 // "Restore defaults", exiting customize, and re-entering shouldn't show the Undo button
-add_task(function() {
+add_task(function*() {
   let undoResetButton = document.getElementById("customization-undo-reset-button");
   is(undoResetButton.hidden, true, "The undo button is hidden before a reset");
   ok(!CustomizableUI.inDefaultState, "The browser should not be in default state");
   yield gCustomizeMode.reset();
 
   is(undoResetButton.hidden, false, "The undo button is visible after a reset");
   yield endCustomizing();
   yield startCustomizing();
   is(undoResetButton.hidden, true, "The undo reset button should be hidden after entering customization mode");
 });
 
 // Bug 971626 - Restore Defaults should collapse the Title Bar
-add_task(function() {
+add_task(function*() {
   if (Services.appinfo.OS != "WINNT" &&
       Services.appinfo.OS != "Darwin") {
     return;
   }
   let prefName = "browser.tabs.drawInTitlebar";
   let defaultValue = Services.prefs.getBoolPref(prefName);
   let restoreDefaultsButton = document.getElementById("customization-reset-button");
   let titleBarButton = document.getElementById("customization-titlebar-visibility-button");
@@ -98,12 +98,12 @@ add_task(function() {
   is(Services.prefs.getBoolPref(prefName), !defaultValue, "Undo-reset goes back to previous pref value");
   is(undoResetButton.hidden, true, "Undo reset button should be hidden after undo-reset clicked");
 
   Services.prefs.clearUserPref(prefName);
   ok(CustomizableUI.inDefaultState, "In default state after pref cleared");
   is(undoResetButton.hidden, true, "Undo reset button should be hidden at end of test");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield gCustomizeMode.reset();
   yield endCustomizing();
 });
--- a/browser/components/customizableui/test/browser_972267_customizationchange_events.js
+++ b/browser/components/customizableui/test/browser_972267_customizationchange_events.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Create a new window, then move the home button to the menu and check both windows have
 // customizationchange events fire on the toolbox:
-add_task(function() {
+add_task(function*() {
   let newWindow = yield openAndLoadWindow();
   let otherToolbox = newWindow.gNavToolbox;
 
   let handlerCalledCount = 0;
   let handler = (ev) => {
     handlerCalledCount++;
   };
 
@@ -36,12 +36,11 @@ add_task(function() {
   is(handlerCalledCount, 2, "Should be called for both windows.");
 
   gNavToolbox.removeEventListener("customizationchange", handler);
   otherToolbox.removeEventListener("customizationchange", handler);
 
   yield promiseWindowClosed(newWindow);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
-
--- a/browser/components/customizableui/test/browser_973641_button_addon.js
+++ b/browser/components/customizableui/test/browser_973641_button_addon.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kButton = "test_button_for_addon";
 var initialLocation = gBrowser.currentURI.spec;
 
-add_task(function() {
+add_task(function*() {
   info("Check addon button functionality");
 
   // create mocked addon button on the navigation bar
   let widgetSpec = {
     id: kButton,
     type: 'button',
     onClick: function() {
       gBrowser.selectedTab = gBrowser.addTab("about:addons");
@@ -38,17 +38,17 @@ add_task(function() {
   // check the addon button's functionality in the Panel Menu
   yield PanelUI.show();
   var panelMenu = document.getElementById("PanelUI-mainView");
   let addonButtonInPanel = panelMenu.getElementsByAttribute("id", kButton);
   ok(panelMenu.contains(addonButton), "Addon button was added to the Panel Menu");
   yield checkButtonFunctionality(addonButtonInPanel[0]);
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   resetTabs();
 
   // reset the UI to the default state
   yield resetCustomization();
   ok(CustomizableUI.inDefaultState, "The UI is in default state again.");
 
   // destroy the widget
   CustomizableUI.destroyWidget(kButton);
@@ -60,13 +60,13 @@ function resetTabs() {
     gBrowser.removeTab(gBrowser.selectedTab);
   }
 
   //restore the initial tab
   gBrowser.addTab(initialLocation);
   gBrowser.removeTab(gBrowser.selectedTab);
 }
 
-function checkButtonFunctionality(aButton) {
+function* checkButtonFunctionality(aButton) {
   aButton.click();
   yield waitForCondition(() => gBrowser.currentURI &&
                                gBrowser.currentURI.spec == "about:addons");
 }
--- a/browser/components/customizableui/test/browser_973932_addonbar_currentset.js
+++ b/browser/components/customizableui/test/browser_973932_addonbar_currentset.js
@@ -3,17 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 var addonbarID = CustomizableUI.AREA_ADDONBAR;
 var addonbar = document.getElementById(addonbarID);
 
 // Check that currentset is correctly updated after a reset:
-add_task(function() {
+add_task(function*() {
   let placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
   is(placements.join(','), addonbar.getAttribute("currentset"), "Addon-bar currentset should match default placements");
   ok(CustomizableUI.inDefaultState, "Should be in default state");
   info("Adding a spring to add-on bar shim");
   CustomizableUI.addWidgetToArea("spring", addonbarID, 1);
   ok(addonbar.getElementsByTagName("toolbarspring").length, "There should be a spring in the toolbar");
   ok(!CustomizableUI.inDefaultState, "Should no longer be in default state");
   placements = CustomizableUI.getWidgetIdsInArea(addonbarID);
--- a/browser/components/customizableui/test/browser_975719_customtoolbars_behaviour.js
+++ b/browser/components/customizableui/test/browser_975719_customtoolbars_behaviour.js
@@ -8,17 +8,17 @@ requestLongerTimeout(2);
 
 const kXULWidgetId = "a-test-button"; // we'll create a button with this ID.
 
 add_task(function setup() {
   // create a XUL button and add it to the palette.
   createDummyXULButton(kXULWidgetId, "test-button");
 });
 
-add_task(function customizeToolbarAndKeepIt() {
+add_task(function* customizeToolbarAndKeepIt() {
   ok(gNavToolbox.toolbarset, "There should be a toolbarset");
   let toolbarID = "testAustralisCustomToolbar";
   gNavToolbox.appendCustomToolbar(toolbarID, "");
   let toolbarDOMID = getToolboxCustomToolbarId(toolbarID);
   let toolbarElement = document.getElementById(toolbarDOMID);
   ok(toolbarElement, "There should be a toolbar");
   if (!toolbarElement) {
     ok(false, "No toolbar created, bailing out of the test.");
@@ -79,17 +79,17 @@ add_task(function customizeToolbarAndKee
      "Attribute should be gone in new window");
   yield promiseWindowClosed(newWindow);
 
   ok(!toolbarElement.parentNode, "Toolbar should no longer be in the DOM.");
   cuiAreaType = CustomizableUI.getAreaType(toolbarDOMID);
   is(cuiAreaType, null, "CustomizableUI should have forgotten all about the area");
 });
 
-add_task(function resetShouldDealWithCustomToolbars() {
+add_task(function* resetShouldDealWithCustomToolbars() {
   ok(gNavToolbox.toolbarset, "There should be a toolbarset");
   let toolbarID = "testAustralisCustomToolbar";
   gNavToolbox.appendCustomToolbar(toolbarID, "");
   let toolbarDOMID = getToolboxCustomToolbarId(toolbarID);
   let toolbarElement = document.getElementById(toolbarDOMID);
   ok(toolbarElement, "There should be a toolbar");
   if (!toolbarElement) {
     ok(false, "No toolbar created, bailing out of the test.");
@@ -132,14 +132,14 @@ add_task(function resetShouldDealWithCus
   ok(gNavToolbox.palette.querySelector(`#${kXULWidgetId}`), "XUL button should be in the palette");
   ok(!toolbarElement.hasChildNodes(), "Toolbar should have no more child nodes.");
   ok(!toolbarElement.parentNode, "Toolbar should no longer be in the DOM.");
   cuiAreaType = CustomizableUI.getAreaType(toolbarDOMID);
   is(cuiAreaType, null, "CustomizableUI should have forgotten all about the area");
 });
 
 
-add_task(function() {
+add_task(function*() {
   let newWin = yield openAndLoadWindow({}, true);
   ok(!newWin.gNavToolbox.toolbarset.hasAttribute("toolbar1"), "New window shouldn't have attribute toolbar1");
   ok(!newWin.gNavToolbox.toolbarset.hasAttribute("toolbar2"), "New window shouldn't have attribute toolbar2");
   yield promiseWindowClosed(newWin);
 });
--- a/browser/components/customizableui/test/browser_976792_insertNodeInWindow.js
+++ b/browser/components/customizableui/test/browser_976792_insertNodeInWindow.js
@@ -8,17 +8,17 @@ const kToolbarName = "test-insertNodeInW
 const kTestWidgetPrefix = "test-widget-for-insertNodeInWindow-placements-";
 
 
 /*
 Tries to replicate the situation of having a placement list like this:
 
 exists-1,trying-to-insert-this,doesn't-exist,exists-2
 */
-add_task(function() {
+add_task(function*() {
   let testWidgetExists = [true, false, false, true];
   let widgetIds = [];
   for (let i = 0; i < testWidgetExists.length; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     if (testWidgetExists[i]) {
       let spec = {id: id, type: "button", removable: true, label: "test", tooltiptext: "" + i};
       CustomizableUI.createWidget(spec);
@@ -45,17 +45,17 @@ add_task(function() {
 
 
 /*
 Tests nodes get placed inside the toolbar's overflow as expected. Replicates a
 situation similar to:
 
 exists-1,exists-2,overflow-1,trying-to-insert-this,overflow-2
 */
-add_task(function() {
+add_task(function*() {
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
   let widgetIds = [];
   for (let i = 0; i < 5; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     let spec = {id: id, type: "button", removable: true, label: "insertNodeInWindow test", tooltiptext: "" + i};
     CustomizableUI.createWidget(spec);
@@ -94,17 +94,17 @@ add_task(function() {
 
 
 /*
 Tests nodes get placed inside the toolbar's overflow as expected. Replicates a
 placements situation similar to:
 
 exists-1,exists-2,overflow-1,doesn't-exist,trying-to-insert-this,overflow-2
 */
-add_task(function() {
+add_task(function*() {
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
   let widgetIds = [];
   for (let i = 0; i < 5; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     let spec = {id: id, type: "button", removable: true, label: "insertNodeInWindow test", tooltiptext: "" + i};
     CustomizableUI.createWidget(spec);
@@ -144,17 +144,17 @@ add_task(function() {
 
 
 /*
 Tests nodes get placed inside the toolbar's overflow as expected. Replicates a
 placements situation similar to:
 
 exists-1,exists-2,overflow-1,doesn't-exist,trying-to-insert-this,doesn't-exist
 */
-add_task(function() {
+add_task(function*() {
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
   let widgetIds = [];
   for (let i = 0; i < 5; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     let spec = {id: id, type: "button", removable: true, label: "insertNodeInWindow test", tooltiptext: "" + i};
     CustomizableUI.createWidget(spec);
@@ -195,17 +195,17 @@ add_task(function() {
 
 
 /*
 Tests nodes get placed inside the toolbar's overflow as expected. Replicates a
 placements situation similar to:
 
 exists-1,exists-2,overflow-1,can't-overflow,trying-to-insert-this,overflow-2
 */
-add_task(function() {
+add_task(function*() {
   let navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
 
   let widgetIds = [];
   for (let i = 5; i >= 0; i--) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     let spec = {id: id, type: "button", removable: true, label: "insertNodeInWindow test", tooltiptext: "" + i};
     CustomizableUI.createWidget(spec);
@@ -254,17 +254,17 @@ add_task(function() {
 
 
 /*
 Tests nodes get placed inside the toolbar's overflow as expected. Replicates a
 placements situation similar to:
 
 exists-1,exists-2,overflow-1,trying-to-insert-this,can't-overflow,overflow-2
 */
-add_task(function() {
+add_task(function*() {
   let widgetIds = [];
   let missingId = 2;
   let nonOverflowableId = 3;
   for (let i = 0; i < 5; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     if (i != missingId) {
       // Setting min-width to make the overflow state not depend on styling of the button and/or
@@ -311,17 +311,17 @@ add_task(function() {
 
 
 /*
 Tests nodes do *not* get placed in the toolbar's overflow. Replicates a
 plcements situation similar to:
 
 exists-1,trying-to-insert-this,exists-2,overflowed-1
 */
-add_task(function() {
+add_task(function*() {
   let widgetIds = [];
   let missingId = 1;
   for (let i = 0; i < 5; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     if (i != missingId) {
       // Setting min-width to make the overflow state not depend on styling of the button and/or
       // screen width
@@ -360,17 +360,17 @@ add_task(function() {
 /*
 Tests inserting a node onto the end of an overflowing toolbar *doesn't* put it in
 the overflow list when the widget disallows overflowing. ie:
 
 exists-1,exists-2,overflows-1,trying-to-insert-this
 
 Where trying-to-insert-this has overflows=false
 */
-add_task(function() {
+add_task(function*() {
   let widgetIds = [];
   let missingId = 3;
   for (let i = 0; i < 5; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     if (i != missingId) {
       // Setting min-width to make the overflow state not depend on styling of the button and/or
       // screen width
@@ -404,11 +404,11 @@ add_task(function() {
 
   btn.remove();
   widgetIds.forEach(id => CustomizableUI.destroyWidget(id));
   removeCustomToolbars();
   yield resetCustomization();
 });
 
 
-add_task(function asyncCleanUp() {
+add_task(function* asyncCleanUp() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_978084_dragEnd_after_move.js
+++ b/browser/components/customizableui/test/browser_978084_dragEnd_after_move.js
@@ -5,42 +5,42 @@
 
 var draggedItem;
 
 /**
  * Check that customizing-movingItem gets removed on a drop when the item is moved.
  */
 
 // Drop on the palette
-add_task(function() {
+add_task(function*() {
   draggedItem = document.createElement("toolbarbutton");
   draggedItem.id = "test-dragEnd-after-move1";
   draggedItem.setAttribute("label", "Test");
   draggedItem.setAttribute("removable", "true");
   let navbar = document.getElementById("nav-bar");
   navbar.customizationTarget.appendChild(draggedItem);
   yield startCustomizing();
   simulateItemDrag(draggedItem, gCustomizeMode.visiblePalette);
   is(document.documentElement.hasAttribute("customizing-movingItem"), false,
      "Make sure customizing-movingItem is removed after dragging to the palette");
   yield endCustomizing();
 });
 
 // Drop on a customization target itself
-add_task(function() {
+add_task(function*() {
   draggedItem = document.createElement("toolbarbutton");
   draggedItem.id = "test-dragEnd-after-move2";
   draggedItem.setAttribute("label", "Test");
   draggedItem.setAttribute("removable", "true");
   let dest = createToolbarWithPlacements("test-dragEnd");
   let navbar = document.getElementById("nav-bar");
   navbar.customizationTarget.appendChild(draggedItem);
   yield startCustomizing();
   simulateItemDrag(draggedItem, dest.customizationTarget);
   is(document.documentElement.hasAttribute("customizing-movingItem"), false,
      "Make sure customizing-movingItem is removed");
   yield endCustomizing();
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield endCustomizing();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_980155_add_overflow_toolbar.js
+++ b/browser/components/customizableui/test/browser_980155_add_overflow_toolbar.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const kToolbarName = "test-new-overflowable-toolbar";
 const kTestWidgetPrefix = "test-widget-for-overflowable-toolbar-";
 
-add_task(function addOverflowingToolbar() {
+add_task(function* addOverflowingToolbar() {
   let originalWindowWidth = window.outerWidth;
 
   let widgetIds = [];
   for (let i = 0; i < 10; i++) {
     let id = kTestWidgetPrefix + i;
     widgetIds.push(id);
     let spec = {id: id, type: "button", removable: true, label: "test", tooltiptext: "" + i};
     CustomizableUI.createWidget(spec);
@@ -40,12 +40,12 @@ add_task(function addOverflowingToolbar(
   ok(toolbarNode.hasAttribute("overflowing"), "Should have an overflowing toolbar.");
   ok(toolbarNode.customizationTarget.childElementCount < oldChildCount, "Should have fewer children.");
   ok(overflowableList.childElementCount > oldOverflowCount, "Should have more overflowed widgets.");
 
   window.resizeTo(originalWindowWidth, window.outerHeight);
 });
 
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   removeCustomToolbars();
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_981305_separator_insertion.js
+++ b/browser/components/customizableui/test/browser_981305_separator_insertion.js
@@ -19,17 +19,17 @@ function insertTempItemsIntoMenu(parentM
     // And another separator for good measure:
     sep = document.createElement("menuseparator");
     tempElements.push(sep);
     parentMenu.insertBefore(sep, beforeEls[i]);
   }
 }
 
 function checkSeparatorInsertion(menuId, buttonId, subviewId) {
-  return function() {
+  return function*() {
     info("Checking for duplicate separators in " + buttonId + " widget");
     let menu = document.getElementById(menuId);
     insertTempItemsIntoMenu(menu);
 
     let placement = CustomizableUI.getPlacementOfWidget(buttonId);
     let changedPlacement = false;
     if (!placement || placement.area != CustomizableUI.AREA_PANEL) {
       CustomizableUI.addWidgetToArea(buttonId, CustomizableUI.AREA_PANEL);
--- a/browser/components/customizableui/test/browser_981418-widget-onbeforecreated-handler.js
+++ b/browser/components/customizableui/test/browser_981418-widget-onbeforecreated-handler.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 const kWidgetId = 'test-981418-widget-onbeforecreated';
 
 // Should be able to add broken view widget
-add_task(function testAddOnBeforeCreatedWidget() {
+add_task(function* testAddOnBeforeCreatedWidget() {
   let viewShownDeferred = Promise.defer();
   let onBeforeCreatedCalled = false;
   let widgetSpec = {
     id: kWidgetId,
     type: 'view',
     viewId: kWidgetId + 'idontexistyet',
     onBeforeCreated: function(doc) {
       let view = doc.createElement("panelview");
@@ -80,11 +80,11 @@ add_task(function testAddOnBeforeCreated
     CustomizableUI.destroyWidget(kWidgetId);
   } catch (ex) {
     Cu.reportError(ex);
     noError = false;
   }
   ok(noError, "Should not throw an exception trying to remove the broken view widget.");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_982656_restore_defaults_builtin_widgets.js
+++ b/browser/components/customizableui/test/browser_982656_restore_defaults_builtin_widgets.js
@@ -1,16 +1,16 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 // Restoring default should not place addon widgets back in the toolbar
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Default state to begin");
 
   const kWidgetId = "bug982656-add-on-widget-should-not-restore-to-default-area";
   let widgetSpec = {
     id: kWidgetId,
     defaultArea: CustomizableUI.AREA_NAVBAR
   };
   CustomizableUI.createWidget(widgetSpec);
@@ -22,17 +22,17 @@ add_task(function() {
 
   ok(CustomizableUI.inDefaultState, "Back in default state after reset");
   is(CustomizableUI.getPlacementOfWidget(kWidgetId), null, "Widget now in palette");
   CustomizableUI.destroyWidget(kWidgetId);
 });
 
 
 // resetCustomization shouldn't move 3rd party widgets out of custom toolbars
-add_task(function() {
+add_task(function*() {
   const kToolbarId = "bug982656-toolbar-with-defaultset";
   const kWidgetId = "bug982656-add-on-widget-should-restore-to-default-area-when-area-is-not-builtin";
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
   let toolbar = createToolbarWithPlacements(kToolbarId);
   ok(CustomizableUI.areas.indexOf(kToolbarId) != -1,
      "Toolbar has been registered.");
   is(CustomizableUI.getAreaType(kToolbarId), CustomizableUI.TYPE_TOOLBAR,
      "Area should be registered as toolbar");
--- a/browser/components/customizableui/test/browser_985815_propagate_setToolbarVisibility.js
+++ b/browser/components/customizableui/test/browser_985815_propagate_setToolbarVisibility.js
@@ -1,15 +1,15 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
-add_task(function() {
+add_task(function*() {
   ok(CustomizableUI.inDefaultState, "Should start in default state.");
   this.otherWin = yield openAndLoadWindow({private: true}, true);
   yield startCustomizing(this.otherWin);
   let resetButton = this.otherWin.document.getElementById("customization-reset-button");
   ok(resetButton.disabled, "Reset button should be disabled");
 
   if (typeof CustomizableUI.setToolbarVisibility == "function") {
     CustomizableUI.setToolbarVisibility("PersonalToolbar", true);
@@ -30,16 +30,16 @@ add_task(function() {
   ok(resetButton.disabled, "Reset button should be disabled");
 
   yield endCustomizing(this.otherWin);
 
   yield promiseWindowClosed(this.otherWin);
 });
 
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   if (this.otherWin && !this.otherWin.closed) {
     yield promiseWindowClosed(this.otherWin);
   }
   if (!CustomizableUI.inDefaultState) {
     CustomizableUI.reset();
   }
 });
--- a/browser/components/customizableui/test/browser_987640_charEncoding.js
+++ b/browser/components/customizableui/test/browser_987640_charEncoding.js
@@ -2,17 +2,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const TEST_PAGE = "http://mochi.test:8888/browser/browser/components/customizableui/test/support/test_967000_charEncoding_page.html";
 var newTab = null;
 
-add_task(function() {
+add_task(function*() {
   info("Check Character Encoding panel functionality");
 
   // add the Character Encoding button to the panel
   CustomizableUI.addWidgetToArea("characterencoding-button",
                                   CustomizableUI.AREA_PANEL);
 
   newTab = gBrowser.addTab(TEST_PAGE);
   yield promiseTabLoadEvent(gBrowser.selectedTab, TEST_PAGE);
@@ -47,16 +47,16 @@ add_task(function() {
   initialEncoding.click();
   yield tabLoadPromise;
   yield PanelUI.show();
   charEncodingButton.click();
   checkedButtons = characterEncodingView.querySelectorAll("toolbarbutton[checked='true']");
   is(checkedButtons[0].getAttribute("label"), "Unicode", "The encoding was reset to Unicode");
 });
 
-add_task(function asyncCleanup() {
+add_task(function* asyncCleanup() {
   // reset the panel to the default state
   yield resetCustomization();
   ok(CustomizableUI.inDefaultState, "The UI is in default state again.");
 
   // remove the added tab
   gBrowser.removeTab(newTab);
 });
--- a/browser/components/customizableui/test/browser_989751_subviewbutton_class.js
+++ b/browser/components/customizableui/test/browser_989751_subviewbutton_class.js
@@ -9,17 +9,17 @@ var tempElement = null;
 
 function insertClassNameToMenuChildren(parentMenu) {
   let el = parentMenu.querySelector("menuitem:first-of-type");
   el.classList.add(kCustomClass);
   tempElement = el;
 }
 
 function checkSubviewButtonClass(menuId, buttonId, subviewId) {
-  return function() {
+  return function*() {
     info("Checking for items without the subviewbutton class in " + buttonId + " widget");
     let menu = document.getElementById(menuId);
     insertClassNameToMenuChildren(menu);
 
     let placement = CustomizableUI.getPlacementOfWidget(buttonId);
     let changedPlacement = false;
     if (!placement || placement.area != CustomizableUI.AREA_PANEL) {
       CustomizableUI.addWidgetToArea(buttonId, CustomizableUI.AREA_PANEL);
--- a/browser/components/customizableui/test/browser_panel_toggle.js
+++ b/browser/components/customizableui/test/browser_panel_toggle.js
@@ -4,34 +4,34 @@
 
 "use strict";
 
 /**
  * Test opening and closing the menu panel UI.
  */
 
 // Show and hide the menu panel programmatically without an event (like UITour.jsm would)
-add_task(function() {
+add_task(function*() {
   let shownPromise = promisePanelShown(window);
   PanelUI.show();
   yield shownPromise;
 
   is(PanelUI.panel.getAttribute("panelopen"), "true", "Check that panel has panelopen attribute");
   is(PanelUI.panel.state, "open", "Check that panel state is 'open'");
 
   let hiddenPromise = promisePanelHidden(window);
   PanelUI.hide();
   yield hiddenPromise;
 
   ok(!PanelUI.panel.hasAttribute("panelopen"), "Check that panel doesn't have the panelopen attribute");
   is(PanelUI.panel.state, "closed", "Check that panel state is 'closed'");
 });
 
 // Toggle the menu panel open and closed
-add_task(function() {
+add_task(function*() {
   let shownPromise = promisePanelShown(window);
   PanelUI.toggle({type: "command"});
   yield shownPromise;
 
   is(PanelUI.panel.getAttribute("panelopen"), "true", "Check that panel has panelopen attribute");
   is(PanelUI.panel.state, "open", "Check that panel state is 'open'");
 
   let hiddenPromise = promisePanelHidden(window);
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -195,33 +195,33 @@ function endCustomizing(aWindow=window) 
     let deferredLoadNewTab = Promise.defer();
 
     //XXXgijs so some tests depend on this tab being about:blank. Make it so.
     let newTabBrowser = aWindow.gBrowser.selectedBrowser;
     newTabBrowser.stop();
 
     // If we stop early enough, this might actually be about:blank.
     if (newTabBrowser.contentDocument.location.href == "about:blank") {
-      return;
+      return null;
     }
 
     // Otherwise, make it be about:blank, and wait for that to be done.
     function onNewTabLoaded(e) {
       newTabBrowser.removeEventListener("load", onNewTabLoaded, true);
       deferredLoadNewTab.resolve();
     }
     newTabBrowser.addEventListener("load", onNewTabLoaded, true);
     newTabBrowser.contentDocument.location.replace("about:blank");
     return deferredLoadNewTab.promise;
   });
 }
 
 function startCustomizing(aWindow=window) {
   if (aWindow.document.documentElement.getAttribute("customizing") == "true") {
-    return;
+    return null;
   }
   Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", true);
   let deferred = Promise.defer();
   function onCustomizing() {
     aWindow.gNavToolbox.removeEventListener("customizationready", onCustomizing);
     Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", false);
     deferred.resolve();
   }
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -242,16 +242,30 @@ this.AppConstants = Object.freeze({
 
   MOZ_PLACES:
 #ifdef MOZ_PLACES
   true,
 #else
   false,
 #endif
 
+  MENUBAR_CAN_AUTOHIDE:
+#ifdef MENUBAR_CAN_AUTOHIDE
+  true,
+#else
+  false,
+#endif
+
+  CAN_DRAW_IN_TITLEBAR:
+#ifdef CAN_DRAW_IN_TITLEBAR
+  true,
+#else
+  false,
+#endif
+
   MOZ_ANDROID_HISTORY:
 #ifdef MOZ_ANDROID_HISTORY
   true,
 #else
   false,
 #endif
 
   DLL_PREFIX: "@DLL_PREFIX@",
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -76,16 +76,22 @@ EXTRA_JS_MODULES += [
     'Timer.jsm',
     'Troubleshoot.jsm',
     'UpdateUtils.jsm',
     'WebChannel.jsm',
     'WindowDraggingUtils.jsm',
     'ZipUtils.jsm',
 ]
 
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'cocoa'):
+    DEFINES['CAN_DRAW_IN_TITLEBAR'] = 1
+
+if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('windows', 'gtk2', 'gtk3'):
+    DEFINES['MENUBAR_CAN_AUTOHIDE'] = 1
+
 EXTRA_PP_JS_MODULES += [
     'AppConstants.jsm',
 ]
 
 if 'Android' != CONFIG['OS_TARGET']:
     EXTRA_JS_MODULES += [
         'LightweightThemeConsumer.jsm',
     ]