Bug 1455176: Follow-up: Fix devtools bustage in straggler tests that still use Task global. r=bustage
authorKris Maglione <maglione.k@gmail.com>
Thu, 19 Apr 2018 16:15:00 -0700
changeset 468243 a0a18dfd7cd23762e72877421153491159032fac
parent 468242 38b392d4b4c11f2960b29c78de3abd19a27852c4
child 468244 8f6281311d0ba6328cf6db0c1d6d300e7cd44ac5
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbustage
bugs1455176
milestone61.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 1455176: Follow-up: Fix devtools bustage in straggler tests that still use Task global. r=bustage MozReview-Commit-ID: J0ieBBJGZWM
devtools/client/commandline/test/helpers.js
devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js
devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js
devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js
devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js
--- a/devtools/client/commandline/test/helpers.js
+++ b/devtools/client/commandline/test/helpers.js
@@ -218,30 +218,30 @@ var { helpers, assert } = (function () {
       options.requisition = toolbar.requisition;
       return options;
     });
   };
 
 /**
  * Navigate the current tab to a URL
  */
-  helpers.navigate = Task.async(function* (url, options) {
+  helpers.navigate = async function(url, options) {
     options = options || {};
     options.chromeWindow = options.chromeWindow || window;
     options.tab = options.tab || options.chromeWindow.gBrowser.selectedTab;
 
     var tabbrowser = options.chromeWindow.gBrowser;
     options.browser = tabbrowser.getBrowserForTab(options.tab);
 
     let onLoaded = BrowserTestUtils.browserLoaded(options.browser);
     options.browser.loadURI(url);
-    yield onLoaded;
+    await onLoaded;
 
     return options;
-  });
+  };
 
 /**
  * Undo the effects of |helpers.openToolbar|
  * @param options The options object passed to |helpers.openToolbar|
  * @return A promise resolved (with undefined) when the toolbar is closed
  */
   helpers.closeToolbar = function (options) {
     var toolbar = gDevToolsBrowser.getDeveloperToolbar(options.chromeWindow).hide();
@@ -414,25 +414,25 @@ var { helpers, assert } = (function () {
  * 2. Open the developer toolbar
  * 3. Register the mock commands with the server process
  * 4. Wait for the proxy commands to be auto-regitstered with the client
  * 5. Register the mock converters with the client process
  * 6. Run all the tests
  * 7. Tear down all the setup
  */
   helpers.runTestModule = function (exports, name) {
-    return Task.spawn(function* () {
+    return (async function() {
       const uri = "data:text/html;charset=utf-8," +
                 "<style>div{color:red;}</style>" +
                 "<div id='gcli-root'>" + name + "</div>";
 
-      const options = yield helpers.openTab(uri);
+      const options = await helpers.openTab(uri);
       options.isRemote = true;
 
-      yield helpers.openToolbar(options);
+      await helpers.openToolbar(options);
 
       const system = options.requisition.system;
 
     // Register a one time listener with the local set of commands
       const addedDeferred = defer();
       const removedDeferred = defer();
       let state = "preAdd"; // Then 'postAdd' then 'postRemove'
 
@@ -447,40 +447,40 @@ var { helpers, assert } = (function () {
           if (state === "postAdd") {
             removedDeferred.resolve();
             state = "postRemove";
           }
         }
       });
 
     // Send a message to add the commands to the content process
-      const front = yield GcliFront.create(options.target);
-      yield front._testOnlyAddItemsByModule(MOCK_COMMANDS_URI);
+      const front = await GcliFront.create(options.target);
+      await front._testOnlyAddItemsByModule(MOCK_COMMANDS_URI);
 
     // This will cause the local set of commands to be updated with the
     // command proxies, wait for that to complete.
-      yield addedDeferred.promise;
+      await addedDeferred.promise;
 
     // Now we need to add the converters to the local GCLI
       const converters = mockCommands.items.filter(item => item.item === "converter");
       system.addItems(converters);
 
     // Next run the tests
-      yield helpers.runTests(options, exports);
+      await helpers.runTests(options, exports);
 
     // Finally undo the mock commands and converters
       system.removeItems(converters);
       const removePromise = system.commands.onCommandsChange.once();
-      yield front._testOnlyRemoveItemsByModule(MOCK_COMMANDS_URI);
-      yield removedDeferred.promise;
+      await front._testOnlyRemoveItemsByModule(MOCK_COMMANDS_URI);
+      await removedDeferred.promise;
 
     // And close everything down
-      yield helpers.closeToolbar(options);
-      yield helpers.closeTab(options);
-    }).then(finish, helpers.handleError);
+      await helpers.closeToolbar(options);
+      await helpers.closeTab(options);
+    })().then(finish, helpers.handleError);
   };
 
 /**
  * Ensure that the options object is setup correctly
  * options should contain an automator object that looks like this:
  * {
  *   getInputState: function() { ... },
  *   setCursor: function(cursor) { ... },
--- a/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_autocomplete.js
@@ -5,17 +5,17 @@
 
 // Test the completions using numbers.
 const source = "0x1.";
 const completions = ["toExponential", "toFixed", "toString"];
 
 function test() {
   const options = { tabContent: "test scratchpad autocomplete" };
   openTabAndScratchpad(options)
-    .then(Task.async(runTests))
+    .then(runTests)
     .then(finish, console.error);
 }
 
 async function runTests([win, sp]) {
   const {editor} = sp;
   const editorWin = editor.container.contentWindow;
 
   // Show the completions popup.
--- a/devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_close_toolbox.js
@@ -6,17 +6,17 @@
 
 var {TargetFactory} = require("devtools/client/framework/target");
 
 function test() {
   const options = {
     tabContent: "test closing toolbox and then reusing scratchpad"
   };
   openTabAndScratchpad(options)
-    .then(Task.async(runTests))
+    .then(runTests)
     .then(finish, console.error);
 }
 
 async function runTests([win, sp]) {
   // Use the scratchpad before opening the toolbox.
   const source = "window.foobar = 7;";
   sp.setText(source);
   let [,, result] = await sp.display();
--- a/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_disable_view_menu_items.js
@@ -4,17 +4,17 @@
 // Test if the view menu items "Larger Font" and "Smaller Font" are disabled
 // when the font size reaches the maximum/minimum values.
 
 function test() {
   const options = {
     tabContent: 'test if view menu items "Larger Font" and "Smaller Font" are enabled/disabled.'
   };
   openTabAndScratchpad(options)
-    .then(Task.async(runTests))
+    .then(runTests)
     .then(finish, console.error);
 }
 
 async function runTests([win, sp]) {
   await testMaximumFontSize(win, sp);
 
   await testMinimumFontSize(win, sp);
 }
--- a/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js
+++ b/devtools/client/scratchpad/test/browser_scratchpad_inspect_primitives.js
@@ -4,17 +4,17 @@
 // Test that inspecting primitive values uses the object inspector, not an
 // inline comment.
 
 function test() {
   const options = {
     tabContent: "test inspecting primitive values"
   };
   openTabAndScratchpad(options)
-    .then(Task.async(runTests))
+    .then(runTests)
     .then(finish, console.error);
 }
 
 async function runTests([win, sp]) {
   // Inspect a number.
   await checkResults(sp, 7);
 
   // Inspect a string.