Bug 1436978 - Replace all other lower case usages. r=jdescottes draft
authorAlexandre Poirot <poirot.alex@gmail.com>
Tue, 13 Feb 2018 02:32:29 -0800
changeset 754401 eb60b4880a5321810adf4c3159d5b6cc457b915a
parent 754400 e3f762e0eea5dc19f91ca69f511106c868b48fea
child 754402 62d4b4d3197def92dbb5799a20af816d5d139238
push id98837
push userbmo:poirot.alex@gmail.com
push dateTue, 13 Feb 2018 10:36:35 +0000
reviewersjdescottes
bugs1436978
milestone60.0a1
Bug 1436978 - Replace all other lower case usages. r=jdescottes MozReview-Commit-ID: 2HYxwQVjr8r
devtools/server/actors/animation.js
devtools/server/actors/common.js
devtools/server/actors/inspector/utils.js
devtools/server/actors/source.js
devtools/server/actors/storage.js
devtools/server/actors/string.js
devtools/server/actors/styles.js
devtools/server/actors/stylesheets.js
devtools/server/actors/thread.js
devtools/server/actors/webbrowser.js
devtools/server/performance/recorder.js
devtools/server/tests/mochitest/test_inspector-mutations-childlist.html
devtools/server/tests/mochitest/test_inspector-retain.html
devtools/server/tests/mochitest/test_inspector-traversal.html
devtools/server/tests/unit/test_blackboxing-06.js
devtools/server/tests/unit/test_protocol_async.js
devtools/server/tests/unit/test_protocol_children.js
devtools/server/tests/unit/test_protocol_simple.js
devtools/server/tests/unit/test_sourcemaps-10.js
devtools/server/tests/unit/test_sourcemaps-11.js
--- a/devtools/server/actors/animation.js
+++ b/devtools/server/actors/animation.js
@@ -808,64 +808,64 @@ exports.AnimationsActor = protocol.Actor
     // Until the WebAnimations API provides a way to play/pause via the document
     // timeline, we have to iterate through the whole DOM to find all players.
     for (let player of
          this.getAllAnimations(this.tabActor.window.document, true)) {
       player.pause();
       readyPromises.push(player.ready);
     }
     this.allAnimationsPaused = true;
-    return promise.all(readyPromises);
+    return Promise.all(readyPromises);
   },
 
   /**
    * Play all animations in the current tabActor's frames.
    * This method only returns when animations have left their pending states.
    */
   playAll: function () {
     let readyPromises = [];
     // Until the WebAnimations API provides a way to play/pause via the document
     // timeline, we have to iterate through the whole DOM to find all players.
     for (let player of
          this.getAllAnimations(this.tabActor.window.document, true)) {
       player.play();
       readyPromises.push(player.ready);
     }
     this.allAnimationsPaused = false;
-    return promise.all(readyPromises);
+    return Promise.all(readyPromises);
   },
 
   toggleAll: function () {
     if (this.allAnimationsPaused) {
       return this.playAll();
     }
     return this.pauseAll();
   },
 
   /**
    * Toggle (play/pause) several animations at the same time.
    * @param {Array} players A list of AnimationPlayerActor objects.
    * @param {Boolean} shouldPause If set to true, the players will be paused,
    * otherwise they will be played.
    */
   toggleSeveral: function (players, shouldPause) {
-    return promise.all(players.map(player => {
+    return Promise.all(players.map(player => {
       return shouldPause ? player.pause() : player.play();
     }));
   },
 
   /**
    * Set the current time of several animations at the same time.
    * @param {Array} players A list of AnimationPlayerActor.
    * @param {Number} time The new currentTime.
    * @param {Boolean} shouldPause Should the players be paused too.
    */
   setCurrentTimes: function (players, time, shouldPause) {
-    return promise.all(players.map(player => {
-      let pause = shouldPause ? player.pause() : promise.resolve();
+    return Promise.all(players.map(player => {
+      let pause = shouldPause ? player.pause() : Promise.resolve();
       return pause.then(() => player.setCurrentTime(time));
     }));
   },
 
   /**
    * Set the playback rate of several animations at the same time.
    * @param {Array} players A list of AnimationPlayerActor.
    * @param {Number} rate The new rate.
--- a/devtools/server/actors/common.js
+++ b/devtools/server/actors/common.js
@@ -482,17 +482,17 @@ exports.GeneratedLocation = GeneratedLoc
  *          The decorated method.
  */
 function expectState(expectedState, methodFunc, activity) {
   return function (...args) {
     if (this.state !== expectedState) {
       const msg = `Wrong state while ${activity}:` +
                   `Expected '${expectedState}', ` +
                   `but current state is '${this.state}'.`;
-      return promise.reject(new Error(msg));
+      return Promise.reject(new Error(msg));
     }
 
     return methodFunc.apply(this, args);
   };
 }
 
 exports.expectState = expectState;
 
--- a/devtools/server/actors/inspector/utils.js
+++ b/devtools/server/actors/inspector/utils.js
@@ -135,44 +135,44 @@ function nodeHasSize(node) {
  * before the waiting is aborted. Ignored if flags.testing is set.
  *
  * @return {Promise} that is fulfilled once the image has loaded. If the image
  * fails to load or the load takes too long, the promise is rejected.
  */
 function ensureImageLoaded(image, timeout) {
   let { HTMLImageElement } = image.ownerGlobal;
   if (!(image instanceof HTMLImageElement)) {
-    return promise.reject("image must be an HTMLImageELement");
+    return Promise.reject("image must be an HTMLImageELement");
   }
 
   if (image.complete) {
     // The image has already finished loading.
-    return promise.resolve();
+    return Promise.resolve();
   }
 
   // This image is still loading.
   let onLoad = AsyncUtils.listenOnce(image, "load");
 
   // Reject if loading fails.
   let onError = AsyncUtils.listenOnce(image, "error").then(() => {
-    return promise.reject("Image '" + image.src + "' failed to load.");
+    return Promise.reject("Image '" + image.src + "' failed to load.");
   });
 
   // Don't timeout when testing. This is never settled.
   let onAbort = new Promise(() => {});
 
   if (!flags.testing) {
     // Tests are not running. Reject the promise after given timeout.
     onAbort = DevToolsUtils.waitForTime(timeout).then(() => {
-      return promise.reject("Image '" + image.src + "' took too long to load.");
+      return Promise.reject("Image '" + image.src + "' took too long to load.");
     });
   }
 
   // See which happens first.
-  return promise.race([onLoad, onError, onAbort]);
+  return Promise.race([onLoad, onError, onAbort]);
 }
 
 /**
  * Given an <img> or <canvas> element, return the image data-uri. If @param node
  * is an <img> element, the method waits a while for the image to load before
  * the data is generated. If the image does not finish loading in a reasonable
  * time (IMAGE_FETCHING_TIMEOUT milliseconds) the process aborts.
  *
--- a/devtools/server/actors/source.js
+++ b/devtools/server/actors/source.js
@@ -474,17 +474,17 @@ let SourceActor = ActorClassWithSpec(sou
 
     return offsets;
   },
 
   /**
    * Handler for the "source" packet.
    */
   onSource: function () {
-    return promise.resolve(this._init)
+    return Promise.resolve(this._init)
       .then(this._getSourceText)
       .then(({ content, contentType }) => {
         if (typeof content === "object" && content && content.constructor &&
             content.constructor.name === "ArrayBuffer") {
           return {
             source: arrayBufferGrip(content, this.threadActor.threadLifetimePool),
             contentType,
           };
@@ -783,17 +783,17 @@ let SourceActor = ActorClassWithSpec(sou
         // to how scripts are kept alive. A parent Debugger.Script
         // keeps all of its children alive, so as long as we have a
         // valid script, we can slide through it and know we won't
         // slide through any of its child scripts. Additionally, if a
         // script gets GCed, that means that all parents scripts are
         // GCed as well, and no scripts will exist on those lines
         // anymore. We will never slide through a GCed script.
         if (originalLocation.originalColumn || scripts.length === 0) {
-          return promise.resolve(actor);
+          return Promise.resolve(actor);
         }
 
         // Find the script that spans the largest amount of code to
         // determine the bounds for sliding.
         const largestScript = scripts.reduce((largestScr, script) => {
           if (script.lineCount > largestScr.lineCount) {
             return script;
           }
@@ -809,17 +809,17 @@ let SourceActor = ActorClassWithSpec(sou
           }
         }
 
         // The above loop should never complete. We only did breakpoint sliding
         // because we found scripts on the line we started from,
         // which means there must be valid entry points somewhere
         // within those scripts.
         if (actualLine > maxLine) {
-          return promise.reject({
+          return Promise.reject({
             error: "noCodeAtLineColumn",
             message:
               "Could not find any entry points to set a breakpoint on, " +
               "even though I was told a script existed on the line I started " +
               "the search with."
           });
         }
 
@@ -832,17 +832,17 @@ let SourceActor = ActorClassWithSpec(sou
           actor.delete();
           actor = existingActor;
         } else {
           actor.originalLocation = actualLocation;
           this.breakpointActorMap.setActor(actualLocation, actor);
         }
       }
 
-      return promise.resolve(actor);
+      return Promise.resolve(actor);
     }
     return this.sources.getAllGeneratedLocations(originalLocation)
       .then((generatedLocations) => {
         this._setBreakpointAtAllGeneratedLocations(
           actor,
           generatedLocations
         );
 
--- a/devtools/server/actors/storage.js
+++ b/devtools/server/actors/storage.js
@@ -1449,17 +1449,17 @@ StorageActors.createActor({
     const parsedName = JSON.parse(name);
 
     // Only a Cache object is a valid object to clear
     if (parsedName.length == 1) {
       const [ cacheName ] = parsedName;
       const cache = cacheMap.get(cacheName);
       if (cache) {
         let keys = yield cache.keys();
-        yield promise.all(keys.map(key => cache.delete(key)));
+        yield Promise.all(keys.map(key => cache.delete(key)));
         this.onItemUpdated("cleared", host, [ cacheName ]);
       }
     }
   }),
 
   /**
    * CacheStorage API doesn't support any notifications, we must fake them
    */
--- a/devtools/server/actors/string.js
+++ b/devtools/server/actors/string.js
@@ -31,13 +31,13 @@ exports.LongStringActor = protocol.Actor
       type: "longString",
       actor: this.actorID,
       length: this.str.length,
       initial: this.str.substring(0, DebuggerServer.LONG_STRING_INITIAL_LENGTH)
     };
   },
 
   substring: function (start, end) {
-    return promise.resolve(this.str.substring(start, end));
+    return Promise.resolve(this.str.substring(start, end));
   },
 
   release: function () { }
 });
--- a/devtools/server/actors/styles.js
+++ b/devtools/server/actors/styles.js
@@ -1232,21 +1232,21 @@ var StyleRuleActor = protocol.ActorClass
    * authored form is available, this also sets |this.authoredText|.
    * The authored text will include invalid and otherwise ignored
    * properties.
    */
   getAuthoredCssText: function () {
     if (!this.canSetRuleText ||
         (this.type !== CSSRule.STYLE_RULE &&
          this.type !== CSSRule.KEYFRAME_RULE)) {
-      return promise.resolve("");
+      return Promise.resolve("");
     }
 
     if (typeof this.authoredText === "string") {
-      return promise.resolve(this.authoredText);
+      return Promise.resolve(this.authoredText);
     }
 
     let parentStyleSheet =
         this.pageStyle._sheetRef(this._parentSheet);
     return parentStyleSheet.getText().then((longStr) => {
       let cssText = longStr.str;
       let {text} = getRuleText(cssText, this.line, this.column);
 
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -254,21 +254,21 @@ var StyleSheetActor = protocol.ActorClas
     let rules;
     try {
       rules = this.rawSheet.cssRules;
     } catch (e) {
       // sheet isn't loaded yet
     }
 
     if (rules) {
-      return promise.resolve(rules);
+      return Promise.resolve(rules);
     }
 
     if (!this.ownerNode) {
-      return promise.resolve([]);
+      return Promise.resolve([]);
     }
 
     if (this._cssRules) {
       return this._cssRules;
     }
 
     let deferred = defer();
 
@@ -366,30 +366,30 @@ var StyleSheetActor = protocol.ActorClas
    * Fetch the text for this stylesheet from the cache or network. Return
    * cached text if it's already been fetched.
    *
    * @return {Promise}
    *         Promise that resolves with a string text of the stylesheet.
    */
   _getText: function () {
     if (typeof this.text === "string") {
-      return promise.resolve(this.text);
+      return Promise.resolve(this.text);
     }
 
     let cssText = modifiedStyleSheets.get(this.rawSheet);
     if (cssText !== undefined) {
       this.text = cssText;
-      return promise.resolve(cssText);
+      return Promise.resolve(cssText);
     }
 
     if (!this.href) {
       // this is an inline <style> sheet
       let content = this.ownerNode.textContent;
       this.text = content;
-      return promise.resolve(content);
+      return Promise.resolve(content);
     }
 
     return this.fetchStylesheet(this.href).then(({ content }) => {
       this.text = content;
       return content;
     });
   },
 
--- a/devtools/server/actors/thread.js
+++ b/devtools/server/actors/thread.js
@@ -1639,17 +1639,17 @@ const ThreadActor = ActorClassWithSpec(t
                   sourceActor._setBreakpointAtAllGeneratedLocations(
                     actor, generatedLocations);
                 }
               }));
         }
       }
 
       if (promises.length > 0) {
-        this.unsafeSynchronize(promise.all(promises));
+        this.unsafeSynchronize(Promise.all(promises));
       }
     } else {
       // Bug 1225160: If addSource is called in response to a new script
       // notification, and this notification was triggered by loading a JSM from
       // chrome code, calling unsafeSynchronize could cause a debuggee timer to
       // fire. If this causes the JSM to be loaded a second time, the browser
       // will crash, because loading JSMS is not reentrant, and the first load
       // has not completed yet.
--- a/devtools/server/actors/webbrowser.js
+++ b/devtools/server/actors/webbrowser.js
@@ -299,17 +299,17 @@ BrowserTabList.prototype.getList = funct
 
   if (this._testing && initialMapSize !== this._foundCount) {
     throw new Error("_actorByBrowser map contained actors for dead tabs");
   }
 
   this._mustNotify = true;
   this._checkListening();
 
-  return promise.all(actorPromises).then(values => {
+  return Promise.all(actorPromises).then(values => {
     // Filter out null values if we received a tabDestroyed error.
     return values.filter(value => value != null);
   });
 };
 
 /**
  * @param browserActorOptions see options argument of BrowserTabActor constructor.
  */
@@ -328,17 +328,17 @@ BrowserTabList.prototype._getActorForBro
 };
 
 BrowserTabList.prototype.getTab = function ({ outerWindowID, tabId }) {
   if (typeof outerWindowID == "number") {
     // First look for in-process frames with this ID
     let window = Services.wm.getOuterWindowWithId(outerWindowID);
     // Safety check to prevent debugging top level window via getTab
     if (window && window.isChromeWindow) {
-      return promise.reject({
+      return Promise.reject({
         error: "forbidden",
         message: "Window with outerWindowID '" + outerWindowID + "' is chrome"
       });
     }
     if (window) {
       let iframe = window.QueryInterface(Ci.nsIInterfaceRequestor)
                          .getInterface(Ci.nsIDOMWindowUtils)
                          .containerElement;
@@ -348,42 +348,42 @@ BrowserTabList.prototype.getTab = functi
     }
     // Then also look on registered <xul:browsers> when using outerWindowID for
     // OOP tabs
     for (let browser of this._getBrowsers()) {
       if (browser.outerWindowID == outerWindowID) {
         return this._getActorForBrowser(browser);
       }
     }
-    return promise.reject({
+    return Promise.reject({
       error: "noTab",
       message: "Unable to find tab with outerWindowID '" + outerWindowID + "'"
     });
   } else if (typeof tabId == "number") {
     // Tabs OOP
     for (let browser of this._getBrowsers()) {
       if (browser.frameLoader &&
           browser.frameLoader.tabParent &&
           browser.frameLoader.tabParent.tabId === tabId) {
         return this._getActorForBrowser(browser);
       }
     }
-    return promise.reject({
+    return Promise.reject({
       error: "noTab",
       message: "Unable to find tab with tabId '" + tabId + "'"
     });
   }
 
   let topXULWindow = Services.wm.getMostRecentWindow(
     DebuggerServer.chromeWindowType);
   if (topXULWindow) {
     let selectedBrowser = this._getSelectedBrowser(topXULWindow);
     return this._getActorForBrowser(selectedBrowser);
   }
-  return promise.reject({
+  return Promise.reject({
     error: "noTab",
     message: "Unable to find any selected browser"
   });
 };
 
 Object.defineProperty(BrowserTabList.prototype, "onListChanged", {
   enumerable: true,
   configurable: true,
--- a/devtools/server/performance/recorder.js
+++ b/devtools/server/performance/recorder.js
@@ -343,17 +343,17 @@ PerformanceRecorder.prototype = {
         this._memory.attach();
       }
       let recordingOptions = Object.assign(mapRecordingOptions("memory", options), {
         drainAllocationsTimeout: DRAIN_ALLOCATIONS_TIMEOUT
       });
       memoryStart = this._memory.startRecordingAllocations(recordingOptions);
     }
 
-    let [profilerStartData, timelineStartData, memoryStartData] = yield promise.all([
+    let [profilerStartData, timelineStartData, memoryStartData] = yield Promise.all([
       profilerStart, timelineStart, memoryStart
     ]);
 
     let data = Object.create(null);
     // Filter out start times that are not actually used (0 or undefined), and
     // find the earliest time since all sources use same epoch.
     let startTimes = [
       profilerStartData.currentTime,
--- a/devtools/server/tests/mochitest/test_inspector-mutations-childlist.html
+++ b/devtools/server/tests/mochitest/test_inspector-mutations-childlist.html
@@ -59,17 +59,17 @@ function setParent(nodeSelector, newPare
 
 function loadSelector(selector) {
   return gWalker.querySelectorAll(gWalker.rootNode, selector).then(nodeList => {
     return nodeList.items();
   });
 }
 
 function loadSelectors(selectors) {
-  return promise.all(Array.from(selectors, (sel) => loadSelector(sel)));
+  return Promise.all(Array.from(selectors, (sel) => loadSelector(sel)));
 }
 
 function doMoves(moves) {
   for (let move of moves) {
     setParent(move[0], move[1]);
   }
 }
 
--- a/devtools/server/tests/mochitest/test_inspector-retain.html
+++ b/devtools/server/tests/mochitest/test_inspector-retain.html
@@ -106,17 +106,17 @@ addTest(function testRetain() {
 // retain request), because we haven't issued `getMutations` yet.
 addTest(function testWinRace() {
   let front = null;
   promiseDone(gWalker.querySelector(gWalker.rootNode, "#a").then(node => {
     front = node;
     let contentNode = gInspectee.querySelector("#a");
     contentNode.remove();
     // Now wait for that mutation and retain response to come in.
-    return promise.all([
+    return Promise.all([
       gWalker.retainNode(front),
       waitForMutation(gWalker, isChildList)
     ]);
   }).then(() => {
     assertOwnership();
     is(gWalker._retainedOrphans.size, 1, "Should have a retained orphan.");
     ok(gWalker._retainedOrphans.has(front), "Should have retained our expected node.");
     return gWalker.unretainNode(front);
--- a/devtools/server/tests/mochitest/test_inspector-traversal.html
+++ b/devtools/server/tests/mochitest/test_inspector-traversal.html
@@ -332,17 +332,17 @@ addTest(function testShortValue() {
   }).then(runNextTest));
 });
 
 addTest(function testReleaseWalker() {
   checkActorIDs.push(gWalker.actorID);
 
   promiseDone(gWalker.release().then(() => {
     let promises = Array.from(checkActorIDs, (id) => checkMissing(gClient, id));
-    return promise.all(promises);
+    return Promise.all(promises);
   }).then(runNextTest));
 });
 
 addTest(function cleanup() {
   gWalker = null;
   gInspectee = null;
   gClient = null;
   runNextTest();
--- a/devtools/server/tests/unit/test_blackboxing-06.js
+++ b/devtools/server/tests/unit/test_blackboxing-06.js
@@ -19,17 +19,17 @@ function run_test() {
   gDebuggee = addTestGlobal("test-black-box");
   gClient = new DebuggerClient(DebuggerServer.connectPipe());
   gClient.connect().then(function () {
     attachTestTabAndResume(
       gClient, "test-black-box",
       function (response, tabClient, threadClient) {
         gThreadClient = threadClient;
 
-        promise.resolve(setup_code())
+        Promise.resolve(setup_code())
           .then(black_box_code)
           .then(run_code)
           .then(test_correct_location)
           .catch(function (error) {
             Assert.ok(false, "Should not get an error, got " + error);
           })
           .then(function () {
             finishClient(gClient);
--- a/devtools/server/tests/unit/test_protocol_async.js
+++ b/devtools/server/tests/unit/test_protocol_async.js
@@ -183,16 +183,16 @@ function run_test() {
       return deferAfterRejection.promise.then(function () {
         // Check right return order
         Assert.equal(sequence, 7);
         // Check request handling order
         Assert.equal(ret, sequence++);
       });
     }));
 
-    promise.all(calls).then(() => {
+    Promise.all(calls).then(() => {
       client.close().then(() => {
         do_test_finished();
       });
     });
   });
   do_test_pending();
 }
--- a/devtools/server/tests/unit/test_protocol_children.js
+++ b/devtools/server/tests/unit/test_protocol_children.js
@@ -187,17 +187,17 @@ var ChildFront = protocol.FrontClassWith
     this.detail = form.detail;
   },
 
   onEvent1: preEvent("event1", function (a, b, c) {
     this.event1arg3 = c;
   }),
 
   onEvent2a: preEvent("event2", function (a, b, c) {
-    return promise.resolve().then(() => {
+    return Promise.resolve().then(() => {
       this.event2arg3 = c;
     });
   }),
 
   onEvent2b: preEvent("event2", function (a, b, c) {
     this.event2arg2 = b;
   }),
 });
@@ -320,17 +320,17 @@ var RootFront = protocol.FrontClassWithS
     }
     return this._getTemporaryChild(id);
   }, {
     impl: "_getTemporaryChild"
   }),
 
   clearTemporaryChildren: protocol.custom(function () {
     if (!this._temporaryHolder) {
-      return promise.resolve(undefined);
+      return Promise.resolve(undefined);
     }
     this._temporaryHolder.destroy();
     delete this._temporaryHolder;
     return this._clearTemporaryChildren();
   }, {
     impl: "_clearTemporaryChildren"
   })
 });
--- a/devtools/server/tests/unit/test_protocol_simple.js
+++ b/devtools/server/tests/unit/test_protocol_simple.js
@@ -113,17 +113,17 @@ var RootActor = protocol.ActorClassWithS
 
   sayHello: simpleHello,
 
   simpleReturn: function () {
     return 1;
   },
 
   promiseReturn: function () {
-    return promise.resolve(1);
+    return Promise.resolve(1);
   },
 
   simpleArgs: function (a, b) {
     return { firstResponse: a + 1, secondResponse: b + 1 };
   },
 
   nestedArgs: function (a, b, c) {
     return { a: a, b: b, c: c };
--- a/devtools/server/tests/unit/test_sourcemaps-10.js
+++ b/devtools/server/tests/unit/test_sourcemaps-10.js
@@ -17,17 +17,17 @@ function run_test() {
   initTestDebuggerServer();
   gDebuggee = addTestGlobal("test-source-map");
   gClient = new DebuggerClient(DebuggerServer.connectPipe());
   gClient.connect().then(function () {
     attachTestTabAndResume(
       gClient, "test-source-map",
       function (response, tabClient, threadClient) {
         gThreadClient = threadClient;
-        promise.resolve(define_code())
+        Promise.resolve(define_code())
           .then(run_code)
           .then(test_frame_location)
           .catch(error => {
             dump(error + "\n");
             dump(error.stack);
             Assert.ok(false);
           })
           .then(() => {
--- a/devtools/server/tests/unit/test_sourcemaps-11.js
+++ b/devtools/server/tests/unit/test_sourcemaps-11.js
@@ -17,17 +17,17 @@ function run_test() {
   initTestDebuggerServer();
   gDebuggee = addTestGlobal("test-source-map");
   gClient = new DebuggerClient(DebuggerServer.connectPipe());
   gClient.connect().then(function () {
     attachTestTabAndResume(
       gClient, "test-source-map",
       function (response, tabClient, threadClient) {
         gThreadClient = threadClient;
-        promise.resolve(define_code())
+        Promise.resolve(define_code())
           .then(run_code)
           .then(test_frames)
           .catch(error => {
             dump(error + "\n");
             dump(error.stack);
             Assert.ok(false);
           })
           .then(() => {