Bug 1437828 - Get rid of the now useless require("devtools/shared/task"). r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 13 Feb 2018 08:00:33 -0800
changeset 754799 371dcd98fc452fc26fbe9eb60ad3e822216bc58e
parent 754798 3a83bbdb439ade5e8e45e2b9f41874a05c8278f7
child 754800 bece3cedb89fa11e36a22ce0eb28089cf7640ce3
child 754944 7836aeec12bd5059609e74bbb4595365b4ecd8d8
push id99001
push userbmo:poirot.alex@gmail.com
push dateWed, 14 Feb 2018 10:14:19 +0000
reviewersjryans
bugs1437828
milestone60.0a1
Bug 1437828 - Get rid of the now useless require("devtools/shared/task"). r=jryans But still import it from test_memory_allocations_01.html. MozReview-Commit-ID: 9sZfV5Isrcd
devtools/server/actors/addons.js
devtools/server/actors/heap-snapshot-file.js
devtools/server/actors/inspector/utils.js
devtools/server/actors/performance.js
devtools/server/actors/storage.js
devtools/server/actors/styles.js
devtools/server/actors/stylesheets.js
devtools/server/performance/profiler.js
devtools/server/performance/recorder.js
devtools/server/performance/timeline.js
devtools/server/tests/mochitest/inspector-helpers.js
devtools/server/tests/mochitest/memory-helpers.js
devtools/server/tests/mochitest/test_memory_allocations_01.html
devtools/server/tests/mochitest/test_websocket-server.html
devtools/server/tests/unit/head_dbg.js
devtools/server/websocket-server.js
--- a/devtools/server/actors/addons.js
+++ b/devtools/server/actors/addons.js
@@ -2,17 +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 {AddonManager} = require("resource://gre/modules/AddonManager.jsm");
 const protocol = require("devtools/shared/protocol");
 const {FileUtils} = require("resource://gre/modules/FileUtils.jsm");
-const {Task} = require("devtools/shared/task");
 const {addonsSpec} = require("devtools/shared/specs/addons");
 
 const AddonsActor = protocol.ActorClassWithSpec(addonsSpec, {
 
   initialize: function (conn) {
     protocol.Actor.prototype.initialize.call(this, conn);
   },
 
--- a/devtools/server/actors/heap-snapshot-file.js
+++ b/devtools/server/actors/heap-snapshot-file.js
@@ -1,17 +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";
 
 const protocol = require("devtools/shared/protocol");
 const Services = require("Services");
-const { Task } = require("devtools/shared/task");
 
 const { heapSnapshotFileSpec } = require("devtools/shared/specs/heap-snapshot-file");
 
 loader.lazyRequireGetter(this, "DevToolsUtils",
                          "devtools/shared/DevToolsUtils");
 loader.lazyRequireGetter(this, "OS", "resource://gre/modules/osfile.jsm", true);
 loader.lazyRequireGetter(this, "HeapSnapshotFileUtils",
                          "devtools/shared/heapsnapshot/HeapSnapshotFileUtils");
--- a/devtools/server/actors/inspector/utils.js
+++ b/devtools/server/actors/inspector/utils.js
@@ -1,18 +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";
 
 const {Ci, Cu} = require("chrome");
 
-const {Task} = require("devtools/shared/task");
-
 loader.lazyRequireGetter(this, "AsyncUtils", "devtools/shared/async-utils");
 loader.lazyRequireGetter(this, "flags", "devtools/shared/flags");
 loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/shared/DevToolsUtils");
 loader.lazyRequireGetter(this, "nodeFilterConstants", "devtools/shared/dom-node-filter-constants");
 
 loader.lazyRequireGetter(this, "isNativeAnonymous", "devtools/shared/layout/utils", true);
 loader.lazyRequireGetter(this, "isXBLAnonymous", "devtools/shared/layout/utils", true);
 
--- a/devtools/server/actors/performance.js
+++ b/devtools/server/actors/performance.js
@@ -1,15 +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/. */
 
 "use strict";
 
-const { Task } = require("devtools/shared/task");
 const { Actor, ActorClassWithSpec } = require("devtools/shared/protocol");
 const { actorBridgeWithSpec } = require("devtools/server/actors/common");
 const { performanceSpec } = require("devtools/shared/specs/performance");
 
 loader.lazyRequireGetter(this, "PerformanceRecorder",
   "devtools/server/performance/recorder", true);
 loader.lazyRequireGetter(this, "normalizePerformanceFeatures",
   "devtools/shared/performance/recording-utils", true);
--- a/devtools/server/actors/storage.js
+++ b/devtools/server/actors/storage.js
@@ -7,17 +7,16 @@
 const {Cc, Ci, Cu, CC} = require("chrome");
 const protocol = require("devtools/shared/protocol");
 const {LongStringActor} = require("devtools/server/actors/string");
 const {DebuggerServer} = require("devtools/server/main");
 const Services = require("Services");
 const defer = require("devtools/shared/defer");
 const {isWindowIncluded} = require("devtools/shared/layout/utils");
 const specs = require("devtools/shared/specs/storage");
-const { Task } = require("devtools/shared/task");
 
 const DEFAULT_VALUE = "value";
 
 loader.lazyRequireGetter(this, "naturalSortCaseInsensitive",
   "devtools/client/shared/natural-sort", true);
 
 // "Lax", "Strict" and "Unset" are special values of the sameSite property
 // that should not be translated.
--- a/devtools/server/actors/styles.js
+++ b/devtools/server/actors/styles.js
@@ -2,17 +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 {Ci} = require("chrome");
 const protocol = require("devtools/shared/protocol");
 const {LongStringActor} = require("devtools/server/actors/string");
-const {Task} = require("devtools/shared/task");
 const InspectorUtils = require("InspectorUtils");
 
 // This will also add the "stylesheet" actor type for protocol.js to recognize
 
 const {pageStyleSpec, styleRuleSpec, ELEMENT_STYLE} = require("devtools/shared/specs/styles");
 
 loader.lazyRequireGetter(this, "CssLogic", "devtools/server/css-logic", true);
 loader.lazyRequireGetter(this, "SharedCssLogic", "devtools/shared/inspector/css-logic");
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -2,17 +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 {Ci} = require("chrome");
 const Services = require("Services");
 const defer = require("devtools/shared/defer");
-const {Task} = require("devtools/shared/task");
 const protocol = require("devtools/shared/protocol");
 const {LongStringActor} = require("devtools/server/actors/string");
 const {fetch} = require("devtools/shared/DevToolsUtils");
 const {mediaRuleSpec, styleSheetSpec,
        styleSheetsSpec} = require("devtools/shared/specs/stylesheets");
 const {
   addPseudoClassLock, removePseudoClassLock } = require("devtools/server/actors/highlighters/utils/markup");
 const InspectorUtils = require("InspectorUtils");
--- a/devtools/server/performance/profiler.js
+++ b/devtools/server/performance/profiler.js
@@ -4,17 +4,16 @@
 "use strict";
 
 const { Cc, Ci, Cu } = require("chrome");
 const Services = require("Services");
 
 loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 loader.lazyRequireGetter(this, "DevToolsUtils", "devtools/shared/DevToolsUtils");
 loader.lazyRequireGetter(this, "DeferredTask", "resource://gre/modules/DeferredTask.jsm", true);
-loader.lazyRequireGetter(this, "Task", "devtools/shared/task", true);
 
 // Events piped from system observers to Profiler instances.
 const PROFILER_SYSTEM_EVENTS = [
   "console-api-profiler",
   "profiler-started",
   "profiler-stopped"
 ];
 
--- a/devtools/server/performance/recorder.js
+++ b/devtools/server/performance/recorder.js
@@ -1,15 +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/. */
 "use strict";
 
 const { Cu } = require("chrome");
-const { Task } = require("devtools/shared/task");
 
 loader.lazyRequireGetter(this, "Services");
 loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 
 loader.lazyRequireGetter(this, "Memory",
   "devtools/server/performance/memory", true);
 loader.lazyRequireGetter(this, "Timeline",
   "devtools/server/performance/timeline", true);
--- a/devtools/server/performance/timeline.js
+++ b/devtools/server/performance/timeline.js
@@ -19,17 +19,16 @@
  * When markers are available, an event is emitted:
  *   timeline.on("markers", function(markers) {...})
  */
 
 const { Ci, Cu } = require("chrome");
 
 // Be aggressive about lazy loading, as this will run on every
 // toolbox startup
-loader.lazyRequireGetter(this, "Task", "devtools/shared/task", true);
 loader.lazyRequireGetter(this, "Memory", "devtools/server/performance/memory", true);
 loader.lazyRequireGetter(this, "Framerate", "devtools/server/performance/framerate", true);
 loader.lazyRequireGetter(this, "StackFrameCache", "devtools/server/actors/utils/stack", true);
 loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
 
 // How often do we pull markers from the docShells, and therefore, how often do
 // we send events to the front (knowing that when there are no markers in the
 // docShell, no event is sent). In milliseconds.
--- a/devtools/server/tests/mochitest/inspector-helpers.js
+++ b/devtools/server/tests/mochitest/inspector-helpers.js
@@ -2,17 +2,16 @@
    promiseOnce, isSrcChange, isUnretained, isNewRoot, assertSrcChange, assertUnload,
    assertFrameLoad, assertChildList, waitForMutation, addTest, addAsyncTest,
    runNextTest */
 "use strict";
 
 const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const {DebuggerClient} = require("devtools/shared/client/debugger-client");
 const {DebuggerServer} = require("devtools/server/main");
-const { Task } = require("devtools/shared/task");
 
 const Services = require("Services");
 // promise is still used in tests using this helper
 const defer = require("devtools/shared/defer");
 const {DocumentWalker: _documentWalker} = require("devtools/server/actors/inspector/document-walker");
 
 // Always log packets when running tests.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
--- a/devtools/server/tests/mochitest/memory-helpers.js
+++ b/devtools/server/tests/mochitest/memory-helpers.js
@@ -1,15 +1,14 @@
 /* exported Task, startServerAndGetSelectedTabMemory, destroyServerAndFinish,
    waitForTime, waitUntil */
 "use strict";
 
 const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const Services = require("Services");
-const { Task } = require("devtools/shared/task");
 const { DebuggerClient } = require("devtools/shared/client/debugger-client");
 const { DebuggerServer } = require("devtools/server/main");
 
 const { MemoryFront } = require("devtools/shared/fronts/memory");
 
 // Always log packets when running tests.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
 var gReduceTimePrecision = Services.prefs.getBoolPref("privacy.reduceTimerPrecision");
--- a/devtools/server/tests/mochitest/test_memory_allocations_01.html
+++ b/devtools/server/tests/mochitest/test_memory_allocations_01.html
@@ -11,16 +11,17 @@ Bug 1067491 - Test recording allocations
 </head>
 <body>
 <pre id="test">
 <script src="memory-helpers.js" type="application/javascript"></script>
 <script>
 "use strict";
 
 window.onload = function () {
+  let { Task } = require("devtools/shared/task");
   SimpleTest.waitForExplicitFinish();
 
   Task.spawn(function* () {
     let { memory, client } = yield startServerAndGetSelectedTabMemory();
     yield memory.attach();
 
     yield memory.startRecordingAllocations();
     ok(true, "Can start recording allocations");
--- a/devtools/server/tests/mochitest/test_websocket-server.html
+++ b/devtools/server/tests/mochitest/test_websocket-server.html
@@ -9,17 +9,16 @@
 </head>
 <body>
 <script>
 "use strict";
 
 window.onload = function () {
   const CC = Components.Constructor;
   const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
-  const { Task } = require("devtools/shared/task");
   const WebSocketServer = require("devtools/server/websocket-server");
 
   const ServerSocket = CC("@mozilla.org/network/server-socket;1",
     "nsIServerSocket", "init");
 
   add_task(async function () {
     // Create a TCP server on auto-assigned port
     let server = new ServerSocket(-1, true, -1);
--- a/devtools/server/tests/unit/head_dbg.js
+++ b/devtools/server/tests/unit/head_dbg.js
@@ -16,17 +16,16 @@ ChromeUtils.import("resource://testing-c
   version: "1",
   platformVersion: "42",
   crashReporter: true,
 });
 
 const { require, loader } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const { worker } = ChromeUtils.import("resource://devtools/shared/worker/loader.js", {});
 const defer = require("devtools/shared/defer");
-const { Task } = require("devtools/shared/task");
 const { console } = require("resource://gre/modules/Console.jsm");
 const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
 
 const Services = require("Services");
 // Always log packets when running tests. runxpcshelltests.py will throw
 // the output away anyway, unless you give it the --verbose flag.
 Services.prefs.setBoolPref("devtools.debugger.log", true);
 // Enable remote debugging for the relevant tests.
--- a/devtools/server/websocket-server.js
+++ b/devtools/server/websocket-server.js
@@ -1,16 +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";
 
 const { Cc, CC } = require("chrome");
-const { Task } = require("devtools/shared/task");
 const { executeSoon } = require("devtools/shared/DevToolsUtils");
 const { delimitedRead } = require("devtools/shared/transport/stream-utils");
 const CryptoHash = CC("@mozilla.org/security/hash;1", "nsICryptoHash", "initWithString");
 const threadManager = Cc["@mozilla.org/thread-manager;1"].getService();
 
 // Limit the header size to put an upper bound on allocated memory
 const HEADER_MAX_LEN = 8000;