Bug 1440320 - Get rid of the now useless require("devtools/shared/task"). r=jryans draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Mon, 19 Feb 2018 02:39:27 -0800
changeset 758721 a60d57ba054d47184a88857932a5e6bf82437981
parent 758720 26a38a62ad4ec3ca920fe52108a6096d0813ae7f
child 758722 96e50b2a69b7f0726904891f774f5f1f5db49f21
push id100153
push userbmo:poirot.alex@gmail.com
push dateThu, 22 Feb 2018 23:06:32 +0000
reviewersjryans
bugs1440320
milestone60.0a1
Bug 1440320 - Get rid of the now useless require("devtools/shared/task"). r=jryans $ find devtools/shared/ -type f -exec sed -i '/devtools\/shared\/task/d' {} \; $ git checkout devtools/shared/gcli $ git checkout devtools/shared/fronts/css-properties.js MozReview-Commit-ID: Ch5K2Wo9lK1
devtools/shared/async-utils.js
devtools/shared/client/connection-manager.js
devtools/shared/css/parsing-utils.js
devtools/shared/fronts/animation.js
devtools/shared/fronts/inspector.js
devtools/shared/fronts/memory.js
devtools/shared/fronts/performance.js
devtools/shared/fronts/styles.js
devtools/shared/fronts/stylesheets.js
devtools/shared/security/auth.js
devtools/shared/security/socket.js
devtools/shared/system.js
devtools/shared/task.js
devtools/shared/tests/mochitest/test_eventemitter_basic.html
devtools/shared/transport/tests/unit/head_dbg.js
devtools/shared/webconsole/test/common.js
--- a/devtools/shared/async-utils.js
+++ b/devtools/shared/async-utils.js
@@ -8,17 +8,16 @@
  * Helpers for async functions. Async functions are generator functions that are
  * run by Tasks. An async function returns a Promise for the resolution of the
  * function. When the function returns, the promise is resolved with the
  * returned value. If it throws the promise rejects with the thrown error.
  *
  * See Task documentation at https://developer.mozilla.org/en-US/docs/Mozilla/JavaScript_code_modules/Task.jsm.
  */
 
-var {Task} = require("devtools/shared/task");
 
 /**
  * Adds an event listener to the given element, and then removes its event
  * listener once the event is called, returning the event object as a promise.
  * @param  nsIDOMElement element
  *         The DOM element to listen on
  * @param  String event
  *         The name of the event type to listen for
--- a/devtools/shared/client/connection-manager.js
+++ b/devtools/shared/client/connection-manager.js
@@ -6,17 +6,16 @@
 
 "use strict";
 
 const {Cc, Ci, Cr} = require("chrome");
 const EventEmitter = require("devtools/shared/old-event-emitter");
 const { DebuggerServer } = require("devtools/server/main");
 const { DebuggerClient } = require("devtools/shared/client/debugger-client");
 const Services = require("Services");
-const { Task } = require("devtools/shared/task");
 
 const REMOTE_TIMEOUT = "devtools.debugger.remote-timeout";
 
 /**
  * Connection Manager.
  *
  * To use this module:
  * const {ConnectionManager} = require("devtools/shared/client/connection-manager");
--- a/devtools/shared/css/parsing-utils.js
+++ b/devtools/shared/css/parsing-utils.js
@@ -14,17 +14,16 @@
 
 "use strict";
 
 loader.lazyRequireGetter(this, "CSS_ANGLEUNIT",
   "devtools/shared/css/properties-db", true);
 
 const promise = require("promise");
 const {getCSSLexer} = require("devtools/shared/css/lexer");
-const {Task} = require("devtools/shared/task");
 
 const SELECTOR_ATTRIBUTE = exports.SELECTOR_ATTRIBUTE = 1;
 const SELECTOR_ELEMENT = exports.SELECTOR_ELEMENT = 2;
 const SELECTOR_PSEUDO_CLASS = exports.SELECTOR_PSEUDO_CLASS = 3;
 
 // Used to test whether a newline appears anywhere in some text.
 const NEWLINE_RX = /[\r\n]/;
 // Used to test whether a bit of text starts an empty comment, either
--- a/devtools/shared/fronts/animation.js
+++ b/devtools/shared/fronts/animation.js
@@ -8,17 +8,16 @@ const {
   FrontClassWithSpec,
   custom,
   preEvent
 } = require("devtools/shared/protocol");
 const {
   animationPlayerSpec,
   animationsSpec
 } = require("devtools/shared/specs/animation");
-const { Task } = require("devtools/shared/task");
 
 const AnimationPlayerFront = FrontClassWithSpec(animationPlayerSpec, {
   initialize: function (conn, form, detail, ctx) {
     Front.prototype.initialize.call(this, conn, form, detail, ctx);
 
     this.state = {};
   },
 
--- a/devtools/shared/fronts/inspector.js
+++ b/devtools/shared/fronts/inspector.js
@@ -10,17 +10,16 @@ const {
   preEvent,
   types
 } = require("devtools/shared/protocol.js");
 const {
   inspectorSpec,
   walkerSpec
 } = require("devtools/shared/specs/inspector");
 const defer = require("devtools/shared/defer");
-const { Task } = require("devtools/shared/task");
 loader.lazyRequireGetter(this, "nodeConstants",
   "devtools/shared/dom-node-constants");
 loader.lazyRequireGetter(this, "CommandUtils",
   "devtools/client/shared/developer-toolbar", true);
 
 /**
  * Client side of the DOM walker.
  */
--- a/devtools/shared/fronts/memory.js
+++ b/devtools/shared/fronts/memory.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 { memorySpec } = require("devtools/shared/specs/memory");
-const { Task } = require("devtools/shared/task");
 const protocol = require("devtools/shared/protocol");
 
 loader.lazyRequireGetter(this, "FileUtils",
                          "resource://gre/modules/FileUtils.jsm", true);
 loader.lazyRequireGetter(this, "HeapSnapshotFileUtils",
                          "devtools/shared/heapsnapshot/HeapSnapshotFileUtils");
 
 const MemoryFront = protocol.FrontClassWithSpec(memorySpec, {
--- a/devtools/shared/fronts/performance.js
+++ b/devtools/shared/fronts/performance.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 { Cu } = require("chrome");
 const { Front, FrontClassWithSpec, custom, preEvent } = require("devtools/shared/protocol");
 const { PerformanceRecordingFront } = require("devtools/shared/fronts/performance-recording");
 const { performanceSpec } = require("devtools/shared/specs/performance");
-const { Task } = require("devtools/shared/task");
 
 loader.lazyRequireGetter(this, "PerformanceIO",
   "devtools/client/performance/modules/io");
 loader.lazyRequireGetter(this, "getSystemInfo",
   "devtools/shared/system", true);
 
 const PerformanceFront = FrontClassWithSpec(performanceSpec, {
   initialize: function (client, form) {
--- a/devtools/shared/fronts/styles.js
+++ b/devtools/shared/fronts/styles.js
@@ -9,17 +9,16 @@ const {
   custom,
   preEvent
 } = require("devtools/shared/protocol");
 const {
   pageStyleSpec,
   styleRuleSpec
 } = require("devtools/shared/specs/styles");
 const promise = require("promise");
-const { Task } = require("devtools/shared/task");
 
 loader.lazyRequireGetter(this, "RuleRewriter",
   "devtools/shared/css/parsing-utils", true);
 
 /**
  * PageStyleFront, the front object for the PageStyleActor
  */
 const PageStyleFront = FrontClassWithSpec(pageStyleSpec, {
--- a/devtools/shared/fronts/stylesheets.js
+++ b/devtools/shared/fronts/stylesheets.js
@@ -5,17 +5,16 @@
 
 const { Front, FrontClassWithSpec } = require("devtools/shared/protocol");
 const {
   mediaRuleSpec,
   styleSheetSpec,
   styleSheetsSpec
 } = require("devtools/shared/specs/stylesheets");
 const promise = require("promise");
-const { Task } = require("devtools/shared/task");
 
 loader.lazyRequireGetter(this, "getIndentationFromPrefs",
   "devtools/shared/indentation", true);
 loader.lazyRequireGetter(this, "getIndentationFromString",
   "devtools/shared/indentation", true);
 
 /**
  * Corresponding client-side front for a MediaRuleActor.
--- a/devtools/shared/security/auth.js
+++ b/devtools/shared/security/auth.js
@@ -12,17 +12,16 @@ var defer = require("devtools/shared/def
 var DevToolsUtils = require("devtools/shared/DevToolsUtils");
 var { dumpn, dumpv } = DevToolsUtils;
 loader.lazyRequireGetter(this, "prompt",
   "devtools/shared/security/prompt");
 loader.lazyRequireGetter(this, "cert",
   "devtools/shared/security/cert");
 loader.lazyRequireGetter(this, "asyncStorage",
   "devtools/shared/async-storage");
-const { Task } = require("devtools/shared/task");
 
 /**
  * A simple enum-like object with keys mirrored to values.
  * This makes comparison to a specfic value simpler without having to repeat and
  * mis-type the value.
  */
 function createEnum(obj) {
   for (let key in obj) {
--- a/devtools/shared/security/socket.js
+++ b/devtools/shared/security/socket.js
@@ -47,17 +47,16 @@ DevToolsUtils.defineLazyGetter(this, "ce
          .getService(Ci.nsICertOverrideService);
 });
 
 DevToolsUtils.defineLazyGetter(this, "nssErrorsService", () => {
   return Cc["@mozilla.org/nss_errors_service;1"]
          .getService(Ci.nsINSSErrorsService);
 });
 
-const { Task } = require("devtools/shared/task");
 
 var DebuggerSocket = {};
 
 /**
  * Connects to a debugger server socket.
  *
  * @param host string
  *        The host name or IP address of the debugger server.
--- a/devtools/shared/system.js
+++ b/devtools/shared/system.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 { Cc, Ci } = require("chrome");
-const { Task } = require("devtools/shared/task");
 
 loader.lazyRequireGetter(this, "Services");
 loader.lazyRequireGetter(this, "promise");
 loader.lazyRequireGetter(this, "defer", "devtools/shared/defer");
 loader.lazyRequireGetter(this, "DebuggerServer", "devtools/server/main", true);
 loader.lazyRequireGetter(this, "AppConstants",
   "resource://gre/modules/AppConstants.jsm", true);
 loader.lazyGetter(this, "screenManager", () => {
--- a/devtools/shared/task.js
+++ b/devtools/shared/task.js
@@ -24,17 +24,16 @@
  *
  * The "Task.spawn" function takes a generator function and starts running it as
  * a task.  Every time the task yields a promise, it waits until the promise is
  * fulfilled.  "Task.spawn" returns a promise that is resolved when the task
  * completes successfully, or is rejected if an exception occurs.
  *
  * -----------------------------------------------------------------------------
  *
- * const {Task} = require("devtools/shared/task");
  *
  * Task.spawn(function* () {
  *
  *   // This is our task. Let's create a promise object, wait on it and capture
  *   // its resolution value.
  *   let myPromise = getPromiseResolvedOnTimeoutWithValue(1000, "Value");
  *   let result = yield myPromise;
  *
--- a/devtools/shared/tests/mochitest/test_eventemitter_basic.html
+++ b/devtools/shared/tests/mochitest/test_eventemitter_basic.html
@@ -19,17 +19,16 @@
   <body>
 
     <script type="application/javascript">
       "use strict";
 
       const { require } = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
       const promise = require("promise");
       const EventEmitter = require("devtools/shared/old-event-emitter");
-      const { Task } = require("devtools/shared/task");
 
       SimpleTest.waitForExplicitFinish();
 
       testEmitter();
       testEmitter({});
 
       testPromise()
           .catch(ok.bind(null, false))
--- a/devtools/shared/transport/tests/unit/head_dbg.js
+++ b/devtools/shared/transport/tests/unit/head_dbg.js
@@ -9,17 +9,16 @@
 
 var CC = Components.Constructor;
 
 const { require } =
   ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
 const { NetUtil } = require("resource://gre/modules/NetUtil.jsm");
 const promise = require("promise");
 const defer = require("devtools/shared/defer");
-const { Task } = require("devtools/shared/task");
 
 const Services = require("Services");
 
 // We do not want to log packets by default, because in some tests,
 // we can be sending large amounts of data. The test harness has
 // trouble dealing with logging all the data, and we end up with
 // intermittent time outs (e.g. bug 775924).
 // Services.prefs.setBoolPref("devtools.debugger.log", true);
--- a/devtools/shared/webconsole/test/common.js
+++ b/devtools/shared/webconsole/test/common.js
@@ -8,17 +8,16 @@
 
 /* exported ObjectClient, attachConsole, attachConsoleToTab, attachConsoleToWorker,
    closeDebugger, checkConsoleAPICalls, checkRawHeaders, runTests, nextTest, Ci, Cc,
    withActiveServiceWorker, Services */
 
 // This gives logging to stdout for tests
 const {console} = ChromeUtils.import("resource://gre/modules/Console.jsm", {});
 const {require} = ChromeUtils.import("resource://devtools/shared/Loader.jsm", {});
-const {Task} = require("devtools/shared/task");
 const {DebuggerServer} = require("devtools/server/main");
 const {DebuggerClient} = require("devtools/shared/client/debugger-client");
 const ObjectClient = require("devtools/shared/client/object-client");
 const Services = require("Services");
 
 function initCommon() {
   // Services.prefs.setBoolPref("devtools.debugger.log", true);
 }