Bug 1207491 - Part 4: Remove use of expression closure from browser/components/customizableui/test/. r=Gijs
authorTooru Fujisawa <arai_a@mac.com>
Wed, 23 Sep 2015 18:36:20 +0900
changeset 264489 73d3b4ffc5e63d36cbb2b6a30d7375f1c74eec5e
parent 264488 b87fee73b0a0ae85fe76d206c5086c3650291222
child 264490 42a3d0a47ad042d0c451b6f51d152a3e87709907
push id29444
push usercbook@mozilla.com
push dateMon, 28 Sep 2015 12:17:21 +0000
treeherdermozilla-central@031db40e2b55 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1207491
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1207491 - Part 4: Remove use of expression closure from browser/components/customizableui/test/. r=Gijs
browser/components/customizableui/test/browser_877178_unregisterArea.js
browser/components/customizableui/test/browser_901207_searchbar_in_panel.js
browser/components/customizableui/test/browser_923857_customize_mode_event_wrapping_during_reset.js
browser/components/customizableui/test/browser_938980_navbar_collapsed.js
browser/components/customizableui/test/browser_947914_button_addons.js
browser/components/customizableui/test/browser_947987_removable_default.js
browser/components/customizableui/test/browser_967000_button_feeds.js
browser/components/customizableui/test/browser_970511_undo_restore_default.js
browser/components/customizableui/test/browser_987185_syncButton.js
browser/components/customizableui/test/head.js
--- a/browser/components/customizableui/test/browser_877178_unregisterArea.js
+++ b/browser/components/customizableui/test/browser_877178_unregisterArea.js
@@ -3,29 +3,29 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 registerCleanupFunction(removeCustomToolbars);
 
 // Sanity checks
 add_task(function sanityChecks() {
-  SimpleTest.doesThrow(function() CustomizableUI.registerArea("@foo"),
+  SimpleTest.doesThrow(() => CustomizableUI.registerArea("@foo"),
                        "Registering areas with an invalid ID should throw.");
 
-  SimpleTest.doesThrow(function() CustomizableUI.registerArea([]),
+  SimpleTest.doesThrow(() => CustomizableUI.registerArea([]),
                        "Registering areas with an invalid ID should throw.");
 
-  SimpleTest.doesThrow(function() CustomizableUI.unregisterArea("@foo"),
+  SimpleTest.doesThrow(() => CustomizableUI.unregisterArea("@foo"),
                        "Unregistering areas with an invalid ID should throw.");
 
-  SimpleTest.doesThrow(function() CustomizableUI.unregisterArea([]),
+  SimpleTest.doesThrow(() => CustomizableUI.unregisterArea([]),
                        "Unregistering areas with an invalid ID should throw.");
 
-  SimpleTest.doesThrow(function() CustomizableUI.unregisterArea("unknown"),
+  SimpleTest.doesThrow(() => CustomizableUI.unregisterArea("unknown"),
                        "Unregistering an area that's not registered should throw.");
 });
 
 // Check areas are loaded with their default placements.
 add_task(function checkLoadedAres() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state.");
 });
 
--- a/browser/components/customizableui/test/browser_901207_searchbar_in_panel.js
+++ b/browser/components/customizableui/test/browser_901207_searchbar_in_panel.js
@@ -77,17 +77,17 @@ add_task(function() {
   yield waitForCondition(() => navbar.getAttribute("overflowing") == "true");
   ok(!navbar.querySelector("#search-container"), "Search container should be overflowing");
 
   let shownPanelPromise = promiseOverflowShown(window);
   sendWebSearchKeyCommand();
   yield shownPanelPromise;
 
   let chevron = document.getElementById("nav-bar-overflow-button");
-  yield waitForCondition(function() chevron.open);
+  yield waitForCondition(() => chevron.open);
 
   yield waitForSearchBarFocus();
 
   let hiddenPanelPromise = promiseOverflowHidden(window);
   EventUtils.synthesizeKey("VK_ESCAPE", {});
   yield hiddenPanelPromise;
   navbar = document.getElementById(CustomizableUI.AREA_NAVBAR);
   window.resizeTo(this.originalWindowWidth, window.outerHeight);
@@ -111,17 +111,17 @@ add_task(function() {
     expectOpenUILinkInCall = true;
     CustomizableUI.removeWidgetFromArea("search-container");
     let placement = CustomizableUI.getPlacementOfWidget("search-container");
     is(placement, null, "Search container should be in palette");
 
     openUILinkInCalled = false;
 
     sendWebSearchKeyCommand();
-    yield waitForCondition(function() openUILinkInCalled);
+    yield waitForCondition(() => openUILinkInCalled);
     ok(openUILinkInCalled, "The search page should have been opened.")
     expectOpenUILinkInCall = false;
   } catch (e) {
     ok(false, e);
   }
   CustomizableUI.reset();
 });
 
--- 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
@@ -10,16 +10,16 @@ add_task(function() {
   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(function() !gCustomizeMode.resetting);
+  yield waitForCondition(() => !gCustomizeMode.resetting);
   ok(CustomizableUI.inDefaultState, "Should be back in default state");
   yield endCustomizing();
 });
 
 add_task(function asyncCleanup() {
   yield resetCustomization();
 });
--- a/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
+++ b/browser/components/customizableui/test/browser_938980_navbar_collapsed.js
@@ -31,17 +31,17 @@ add_task(function() {
   setToolbarVisibility(bookmarksToolbar, true);
   setToolbarVisibility(navbar, false);
   ok(!bookmarksToolbar.collapsed, "bookmarksToolbar should be visible now");
   ok(navbar.collapsed, "navbar should be collapsed");
   is(CustomizableUI.inDefaultState, false, "Should no longer be in default state");
 
   yield startCustomizing();
   gCustomizeMode.reset();
-  yield waitForCondition(function() !gCustomizeMode.resetting);
+  yield waitForCondition(() => !gCustomizeMode.resetting);
   yield endCustomizing();
 
   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");
 });
 
@@ -55,17 +55,17 @@ add_task(function() {
   ok(CustomizableUI.inDefaultState, "Everything should be in its default state");
 
   is(menubar.getBoundingClientRect().height, 0, "menubar should be hidden by default");
   setToolbarVisibility(menubar, true);
   isnot(menubar.getBoundingClientRect().height, 0, "menubar should be visible now");
 
   yield startCustomizing();
   gCustomizeMode.reset();
-  yield waitForCondition(function() !gCustomizeMode.resetting);
+  yield waitForCondition(() => !gCustomizeMode.resetting);
 
   is(menubar.getAttribute("autohide"), "true", "The menubar should have autohide=true after reset in customization mode");
   is(menubar.getBoundingClientRect().height, 0, "The menubar should have height=0 after reset in customization mode");
 
   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");
@@ -83,17 +83,17 @@ add_task(function() {
 
   yield startCustomizing();
 
   ok(!bookmarksToolbar.collapsed, "The bookmarksToolbar should be visible before reset");
   ok(!navbar.collapsed, "The navbar should be visible before reset");
   ok(!tabsToolbar.collapsed, "TabsToolbar should not be collapsed");
 
   gCustomizeMode.reset();
-  yield waitForCondition(function() !gCustomizeMode.resetting);
+  yield waitForCondition(() => !gCustomizeMode.resetting);
 
   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();
 });
 
--- a/browser/components/customizableui/test/browser_947914_button_addons.js
+++ b/browser/components/customizableui/test/browser_947914_button_addons.js
@@ -13,18 +13,18 @@ add_task(function() {
   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();
 
   newTab = gBrowser.selectedTab;
-  yield waitForCondition(function() gBrowser.currentURI &&
-                                    gBrowser.currentURI.spec == "about:addons");
+  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() {
   gBrowser.addTab(initialLocation);
--- a/browser/components/customizableui/test/browser_947987_removable_default.js
+++ b/browser/components/customizableui/test/browser_947987_removable_default.js
@@ -8,17 +8,17 @@ var kWidgetId = "test-removable-widget-d
 const kNavBar = CustomizableUI.AREA_NAVBAR;
 var widgetCounter = 0;
 
 registerCleanupFunction(removeCustomToolbars);
 
 // Sanity checks
 add_task(function() {
   let brokenSpec = {id: kWidgetId + (widgetCounter++), removable: false};
-  SimpleTest.doesThrow(function() CustomizableUI.createWidget(brokenSpec),
+  SimpleTest.doesThrow(() => CustomizableUI.createWidget(brokenSpec),
                        "Creating non-removable widget without defaultArea should throw.");
 
   // 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);
 });
 
--- a/browser/components/customizableui/test/browser_967000_button_feeds.js
+++ b/browser/components/customizableui/test/browser_967000_button_feeds.js
@@ -28,17 +28,17 @@ add_task(function() {
   PanelUI.hide();
   yield panelHidePromise;
 
   newTab = gBrowser.selectedTab;
   yield promiseTabLoadEvent(newTab, TEST_PAGE);
 
   yield PanelUI.show();
 
-  yield waitForCondition(function() !feedButton.hasAttribute("disabled"));
+  yield waitForCondition(() => !feedButton.hasAttribute("disabled"));
   ok(!feedButton.hasAttribute("disabled"), "The Subscribe button gets enabled");
 
   feedButton.click();
   yield promiseTabLoadEvent(newTab, TEST_FEED);
 
   is(gBrowser.currentURI.spec, TEST_FEED, "Subscribe page opened");
   ok(!isPanelUIOpen(), "Panel is closed");
 
--- a/browser/components/customizableui/test/browser_970511_undo_restore_default.js
+++ b/browser/components/customizableui/test/browser_970511_undo_restore_default.js
@@ -15,17 +15,17 @@ add_task(function() {
   is(undoResetButton.hidden, true, "The undo button is hidden before reset");
 
   yield gCustomizeMode.reset();
 
   ok(CustomizableUI.inDefaultState, "In default state after reset");
   is(undoResetButton.hidden, false, "The undo button is visible after reset");
 
   undoResetButton.click();
-  yield waitForCondition(function() !gCustomizeMode.resetting);
+  yield waitForCondition(() => !gCustomizeMode.resetting);
   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.
--- a/browser/components/customizableui/test/browser_987185_syncButton.js
+++ b/browser/components/customizableui/test/browser_987185_syncButton.js
@@ -43,17 +43,17 @@ add_task(function* asyncCleanup() {
     yield panelHidePromise;
   }
 
   restoreValues();
 });
 
 function mockFunctions() {
   // mock needsSetup
-  gSyncUI._needsSetup = function() Promise.resolve(false);
+  gSyncUI._needsSetup = () => Promise.resolve(false);
 
   // mock service.errorHandler.syncAndReportErrors()
   service.errorHandler.syncAndReportErrors = mocked_syncAndReportErrors;
 }
 
 function mocked_syncAndReportErrors() {
   syncWasCalled = true;
 }
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -369,17 +369,17 @@ function waitForCondition(aConditionFn, 
   let deferred = Promise.defer();
   let tries = 0;
   tryAgain();
   return deferred.promise;
 }
 
 function waitFor(aTimeout=100) {
   let deferred = Promise.defer();
-  setTimeout(function() deferred.resolve(), aTimeout);
+  setTimeout(() => deferred.resolve(), aTimeout);
   return deferred.promise;
 }
 
 /**
  * Starts a load in an existing tab and waits for it to finish (via some event).
  *
  * @param aTab       The tab to load into.
  * @param aUrl       The url to load.