Bug 1202458 - part2: fix eslint errors in string actor;r=pbro
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 02 Jun 2016 10:35:03 +0200
changeset 339344 e3622cb1ef4266152f887583a621df599452905f
parent 339343 00ee1688f8a29667b941be32f4b94b407926b022
child 339345 96f3ba6f40966164d51a040b8c8eb25c80ff07ed
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1202458
milestone49.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 1202458 - part2: fix eslint errors in string actor;r=pbro MozReview-Commit-ID: 1nguzarA57L
.eslintignore
devtools/server/actors/string.js
--- a/.eslintignore
+++ b/.eslintignore
@@ -105,16 +105,17 @@ devtools/client/webaudioeditor/**
 devtools/client/webconsole/**
 !devtools/client/webconsole/panel.js
 !devtools/client/webconsole/jsterm.js
 !devtools/client/webconsole/console-commands.js
 devtools/client/webide/**
 devtools/server/**
 !devtools/server/actors/webbrowser.js
 !devtools/server/actors/styles.js
+!devtools/server/actors/string.js
 devtools/shared/*.js
 !devtools/shared/css-lexer.js
 !devtools/shared/defer.js
 !devtools/shared/task.js
 devtools/shared/*.jsm
 devtools/shared/apps/**
 devtools/shared/client/**
 devtools/shared/discovery/**
--- a/devtools/server/actors/string.js
+++ b/devtools/server/actors/string.js
@@ -1,22 +1,21 @@
 /* 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";
 
-var {Cu} = require("chrome");
 var {DebuggerServer} = require("devtools/server/main");
 
 var promise = require("promise");
 var {Class} = require("sdk/core/heritage");
 
 var protocol = require("devtools/shared/protocol");
-var {method, Arg, Option, RetVal} = protocol;
+var {method, Arg, RetVal} = protocol;
 
 exports.LongStringActor = protocol.ActorClass({
   typeName: "longstractor",
 
   initialize: function (conn, str) {
     protocol.Actor.prototype.initialize.call(this, conn);
     this.str = str;
     this.short = (this.str.length < DebuggerServer.LONG_STRING_LENGTH);
@@ -59,19 +58,27 @@ exports.LongStringActor = protocol.Actor
  *
  * I'm very proud of this name.
  */
 exports.ShortLongString = Class({
   initialize: function (str) {
     this.str = str;
   },
 
-  get length() { return this.str.length; },
-  get initial() { return this.str; },
-  string: function () { return promise.resolve(this.str); },
+  get length() {
+    return this.str.length;
+  },
+
+  get initial() {
+    return this.str;
+  },
+
+  string: function () {
+    return promise.resolve(this.str);
+  },
 
   substring: function (start, end) {
     return promise.resolve(this.str.substring(start, end));
   },
 
   release: function () {
     this.str = null;
     return promise.resolve(undefined);
@@ -94,23 +101,22 @@ exports.LongStringFront = protocol.Front
     this.actorID = form.actor;
     this.initial = form.initial;
     this.length = form.length;
   },
 
   string: function () {
     if (!this.strPromise) {
       let promiseRest = (thusFar) => {
-        if (thusFar.length === this.length)
+        if (thusFar.length === this.length) {
           return promise.resolve(thusFar);
-        else {
-          return this.substring(thusFar.length,
-                                thusFar.length + DebuggerServer.LONG_STRING_READ_LENGTH)
-            .then((next) => promiseRest(thusFar + next));
         }
+        return this.substring(thusFar.length,
+          thusFar.length + DebuggerServer.LONG_STRING_READ_LENGTH)
+          .then((next) => promiseRest(thusFar + next));
       };
 
       this.strPromise = promiseRest(this.initial);
     }
     return this.strPromise;
   }
 });
 
@@ -119,21 +125,21 @@ exports.LongStringFront = protocol.Front
 
 var stringActorType = protocol.types.getType("longstractor");
 protocol.types.addType("longstring", {
   _actor: true,
   write: (value, context, detail) => {
     if (!(context instanceof protocol.Actor)) {
       throw Error("Passing a longstring as an argument isn't supported.");
     }
+
     if (value.short) {
       return value.str;
-    } else {
-      return stringActorType.write(value, context, detail);
     }
+    return stringActorType.write(value, context, detail);
   },
   read: (value, context, detail) => {
     if (context instanceof protocol.Actor) {
       throw Error("Passing a longstring as an argument isn't supported.");
     }
     if (typeof (value) === "string") {
       return exports.ShortLongString(value);
     }