Bug 1202458 - part2: fix eslint errors in string actor;r?pbro draft
authorJulian Descottes <jdescottes@mozilla.com>
Thu, 02 Jun 2016 10:35:03 +0200
changeset 374389 8e8ddea83d862d94a14c9a016792ba38d793345a
parent 374388 9c4619e709ffa46b69f18c8be24a1d4c186cacdb
child 374390 1bf11719e3901fe5913cabbf51ddf47ab7bbc599
push id20004
push userjdescottes@mozilla.com
push dateThu, 02 Jun 2016 09:01:27 +0000
reviewerspbro
bugs1202458
milestone49.0a1
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/promise_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);
     }