Bug 1517456 - Make Task.jsm a test-only module. r=florian
authorMark Banner <standard8@mozilla.com>
Fri, 04 Jan 2019 08:41:58 +0000
changeset 509624 777128d1fd48dff16999326fb8a475784a5de03a
parent 509623 f26ec01f436a9ac376be18b3be41c03de7812c7b
child 509625 46fd6f5124ff0e8cc890208ac92d8663606b7711
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersflorian
bugs1517456
milestone66.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 1517456 - Make Task.jsm a test-only module. r=florian Differential Revision: https://phabricator.services.mozilla.com/D15647
browser/base/content/test/performance/browser_startup.js
mobile/android/tests/browser/chrome/head_search.js
mobile/android/tests/browser/chrome/test_session_form_data.html
mobile/android/tests/browser/chrome/test_session_scroll_position.html
mobile/android/tests/browser/robocop/robocop_head.js
testing/mochitest/BrowserTestUtils/content/content-task.js
testing/xpcshell/head.js
toolkit/modules/Task.jsm
toolkit/modules/moz.build
toolkit/modules/tests/modules/Task.jsm
toolkit/modules/tests/xpcshell/test_Promise.js
toolkit/modules/tests/xpcshell/test_task.js
toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
--- a/browser/base/content/test/performance/browser_startup.js
+++ b/browser/base/content/test/performance/browser_startup.js
@@ -109,17 +109,16 @@ const startupPhases = {
   // be blacklisted here.
   "before becoming idle": {blacklist: {
     components: new Set([
       "UnifiedComplete.js",
     ]),
     modules: new Set([
       "resource://gre/modules/AsyncPrefs.jsm",
       "resource://gre/modules/LoginManagerContextMenu.jsm",
-      "resource://gre/modules/Task.jsm",
       "resource://pdf.js/PdfStreamConverter.jsm",
     ]),
   }},
 };
 
 if (Services.prefs.getBoolPref("browser.startup.blankWindow") &&
     Services.prefs.getCharPref("lightweightThemes.selectedThemeID") ==
       "default-theme@mozilla.org") {
--- a/mobile/android/tests/browser/chrome/head_search.js
+++ b/mobile/android/tests/browser/chrome/head_search.js
@@ -1,12 +1,12 @@
 // Bits and pieces copied from toolkit/components/search/tests/xpcshell/head_search.js
 
 ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/Task.jsm");
+ChromeUtils.import("resource://testing-common/Task.jsm");
 
 /**
  * Adds test engines and returns a promise resolved when they are installed.
  *
  * The engines are added in the given order.
  *
  * @param aItems
  *        Array of objects with the following properties:
--- a/mobile/android/tests/browser/chrome/test_session_form_data.html
+++ b/mobile/android/tests/browser/chrome/test_session_form_data.html
@@ -14,17 +14,17 @@ Migrated from Robocop: https://bugzilla.
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
   <script type="application/javascript" src="head.js"></script>
   <script type="application/javascript">
 
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/Task.jsm");
+ChromeUtils.import("resource://testing-common/Task.jsm");
 
 let gChromeWin;
 let gBrowserApp;
 
 // Waiting for a tab to load or restore can be slow on the emulator.
 SimpleTest.requestLongerTimeout(2);
 
 setup_browser();
--- a/mobile/android/tests/browser/chrome/test_session_scroll_position.html
+++ b/mobile/android/tests/browser/chrome/test_session_scroll_position.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
 
   /** Tests for Bug 810981, 1282902, 1301016, 1265818, 1498892 **/
 
   "use strict";
 
   ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
   ChromeUtils.import("resource://gre/modules/Services.jsm");
   ChromeUtils.import("resource://gre/modules/Messaging.jsm");
-  ChromeUtils.import("resource://gre/modules/Task.jsm");
+  ChromeUtils.import("resource://testing-common/Task.jsm");
 
   // The chrome window and friends.
   let chromeWin = Services.wm.getMostRecentWindow("navigator:browser");
   let BrowserApp = chromeWin.BrowserApp;
 
   const BASE = "http://example.org/chrome/mobile/android/tests/browser/chrome/";
   // Use something with ample space for scrolling and zooming.
   const URL = BASE + "browser_scrollPositions_sample.html";
--- a/mobile/android/tests/browser/robocop/robocop_head.js
+++ b/mobile/android/tests/browser/robocop/robocop_head.js
@@ -700,17 +700,17 @@ var _Task;
  *   }
  *
  *   do_check_eq(result, "foo");
  * });
  */
 function add_task(func) {
   if (!_Task) {
     let ns = {};
-    _Task = Components.utils.import("resource://gre/modules/Task.jsm", ns).Task;
+    _Task = Components.utils.import("resource://testing-common/Task.jsm", ns).Task;
   }
 
   _gTests.push([true, func]);
 }
 
 /**
  * Runs the next test function from the list of async tests.
  */
--- a/testing/mochitest/BrowserTestUtils/content/content-task.js
+++ b/testing/mochitest/BrowserTestUtils/content/content-task.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/. */
 
 /* eslint-env mozilla/frame-script */
 
 "use strict";
 
-ChromeUtils.import("resource://gre/modules/Task.jsm", this);
+ChromeUtils.import("resource://testing-common/Task.jsm", this);
 ChromeUtils.import("resource://testing-common/ContentTaskUtils.jsm", this);
 const AssertCls = ChromeUtils.import("resource://testing-common/Assert.jsm", null).Assert;
 
 addMessageListener("content-task:spawn", function(msg) {
   let id = msg.data.id;
   let source = msg.data.runnable || "()=>{}";
 
   function getStack(aStack) {
--- a/testing/xpcshell/head.js
+++ b/testing/xpcshell/head.js
@@ -35,17 +35,17 @@ var _profileInitialized = false;
 var _XPCSHELL_PROCESS;
 
 // Register the testing-common resource protocol early, to have access to its
 // modules.
 var _Services = ChromeUtils.import("resource://gre/modules/Services.jsm", null).Services;
 _register_modules_protocol_handler();
 
 var _PromiseTestUtils = ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm", null).PromiseTestUtils;
-var _Task = ChromeUtils.import("resource://gre/modules/Task.jsm", null).Task;
+var _Task = ChromeUtils.import("resource://testing-common/Task.jsm", null).Task;
 
 let _NetUtil = ChromeUtils.import("resource://gre/modules/NetUtil.jsm", null).NetUtil;
 
 let _XPCOMUtils = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm", null).XPCOMUtils;
 
 // Support a common assertion library, Assert.jsm.
 var AssertCls = ChromeUtils.import("resource://testing-common/Assert.jsm", null).Assert;
 // Pass a custom report function for xpcshell-test style reporting.
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -152,16 +152,17 @@ with Files('WindowsRegistry.jsm'):
 XPCSHELL_TESTS_MANIFESTS += ['tests/xpcshell/xpcshell.ini']
 BROWSER_CHROME_MANIFESTS += ['tests/browser/browser.ini']
 MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini']
 
 TESTING_JS_MODULES += [
     'HiddenFrame.jsm',
     'tests/modules/MockDocument.jsm',
     'tests/modules/PromiseTestUtils.jsm',
+    'tests/modules/Task.jsm',
     'tests/xpcshell/TestIntegration.jsm',
 ]
 
 SPHINX_TREES['toolkit_modules'] = 'docs'
 
 with Files('docs/**'):
     SCHEDULES.exclusive = ['docs']
 
@@ -238,17 +239,16 @@ EXTRA_JS_MODULES += [
     'ResetProfile.jsm',
     'ResponsivenessMonitor.jsm',
     'SelectParentHelper.jsm',
     'ServiceRequest.jsm',
     'Services.jsm',
     'sessionstore/FormData.jsm',
     'ShortcutUtils.jsm',
     'Sqlite.jsm',
-    'Task.jsm',
     'Timer.jsm',
     'Troubleshoot.jsm',
     'UpdateUtils.jsm',
     'WebChannel.jsm',
     'WebProgressChild.jsm',
     'WindowDraggingUtils.jsm',
     'ZipUtils.jsm',
 ]
rename from toolkit/modules/Task.jsm
rename to toolkit/modules/tests/modules/Task.jsm
--- a/toolkit/modules/tests/xpcshell/test_Promise.js
+++ b/toolkit/modules/tests/xpcshell/test_Promise.js
@@ -1,15 +1,15 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/ */
 "use strict";
 
 ChromeUtils.import("resource://gre/modules/Promise.jsm");
 ChromeUtils.import("resource://gre/modules/Services.jsm");
-ChromeUtils.import("resource://gre/modules/Task.jsm");
+ChromeUtils.import("resource://testing-common/Task.jsm");
 ChromeUtils.import("resource://testing-common/PromiseTestUtils.jsm");
 
 // Prevent test failures due to the unhandled rejections in this test file.
 PromiseTestUtils.disableUncaughtRejectionObserverForSelfTest();
 
 // Test runner
 
 var run_promise_tests = function run_promise_tests(tests, cb) {
--- a/toolkit/modules/tests/xpcshell/test_task.js
+++ b/toolkit/modules/tests/xpcshell/test_task.js
@@ -8,17 +8,17 @@
 ////////////////////////////////////////////////////////////////////////////////
 /// Globals
 
 ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
 
 ChromeUtils.defineModuleGetter(this, "Services",
                                "resource://gre/modules/Services.jsm");
 ChromeUtils.defineModuleGetter(this, "Task",
-                               "resource://gre/modules/Task.jsm");
+                               "resource://testing-common/Task.jsm");
 
 /**
  * Returns a promise that will be resolved with the given value, when an event
  * posted on the event loop of the main thread is processed.
  */
 function promiseResolvedLater(aValue) {
   return new Promise(resolve => {
     Services.tm.dispatchToMainThread(() => resolve(aValue));
@@ -576,9 +576,8 @@ add_test(function test_without_maintainS
     run_next_test();
   });
 });
 
 add_test(function exit_stack_tests() {
   Task.Debugging.maintainStack = maintainStack;
   run_next_test();
 });
-
--- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
@@ -1521,18 +1521,17 @@ var AddonTestUtils = {
 
   /**
    * Monitors console output for the duration of a task, and returns a promise
    * which resolves to a tuple containing a list of all console messages
    * generated during the task's execution, and the result of the task itself.
    *
    * @param {function} task
    *        The task to run while monitoring console output. May be
-   *        either a generator function, per Task.jsm, or an ordinary
-   *        function which returns promose.
+   *        an async function, or an ordinary function which returns a promose.
    * @return {Promise<[Array<nsIConsoleMessage>, *]>}
    *        Resolves to an object containing a `messages` property, with
    *        the array of console messages emitted during the execution
    *        of the task, and a `result` property, containing the task's
    *        return value.
    */
   async promiseConsoleOutput(task) {
     const DONE = "=== xpcshell test console listener done ===";