Bug 1322954 - Fix incorrect `instanceof` negations. r=markh
authorKit Cambridge <kit@yakshaving.ninja>
Mon, 12 Dec 2016 13:50:10 -0800
changeset 370652 4d6f11e2834346a28d02d139cdbdb489357f1fa7
parent 370651 fc1a3d4fd03c44ee9473556c2086b6f5bc722558
child 370653 2c1d9731a014b77a26d43d991ef096554c822c10
push id6996
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 20:48:21 +0000
treeherdermozilla-beta@d89512dab048 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmarkh
bugs1322954
milestone53.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 1322954 - Fix incorrect `instanceof` negations. r=markh MozReview-Commit-ID: PgQmAu9hbQ
devtools/server/child.js
devtools/server/main.js
mobile/android/chrome/content/InputWidgetHelper.js
services/fxaccounts/FxAccountsProfileClient.jsm
services/fxaccounts/FxAccountsStorage.jsm
services/sync/modules/record.js
services/sync/modules/service.js
services/sync/tps/extensions/mozmill/resource/driver/controller.js
services/sync/tps/extensions/mozmill/resource/modules/assertions.js
toolkit/components/osfile/modules/osfile_unix_front.jsm
toolkit/components/osfile/modules/osfile_win_front.jsm
toolkit/modules/Sqlite.jsm
--- a/devtools/server/child.js
+++ b/devtools/server/child.js
@@ -56,17 +56,17 @@ try {
     // See also: DebuggerServer.setupInChild()
     let onSetupInChild = DevToolsUtils.makeInfallible(msg => {
       let { module, setupChild, args } = msg.data;
       let m;
 
       try {
         m = require(module);
 
-        if (!setupChild in m) {
+        if (!(setupChild in m)) {
           dumpn(`ERROR: module '${module}' does not export '${setupChild}'`);
           return false;
         }
 
         m[setupChild].apply(m, args);
       } catch (e) {
         let errorMessage =
           "Exception during actor module setup running in the child process: ";
--- a/devtools/server/main.js
+++ b/devtools/server/main.js
@@ -1044,17 +1044,17 @@ var DebuggerServer = {
       }
 
       let { module, setupParent } = msg.json;
       let m;
 
       try {
         m = require(module);
 
-        if (!setupParent in m) {
+        if (!(setupParent in m)) {
           dumpn(`ERROR: module '${module}' does not export '${setupParent}'`);
           return false;
         }
 
         parentModules.push(m[setupParent]({ mm, prefix: connPrefix }));
 
         return true;
       } catch (e) {
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/chrome/content/InputWidgetHelper.js
@@ -58,17 +58,17 @@ var InputWidgetHelper = {
       // Else the user canceled the input.
 
       if (changed)
         this.fireOnChange(aElement);
     }).bind(this));
   },
 
   hasInputWidget: function(aElement) {
-    if (!aElement instanceof HTMLInputElement)
+    if (!(aElement instanceof HTMLInputElement))
       return false;
 
     let type = aElement.getAttribute('type');
     if (type == "date" || type == "datetime" || type == "datetime-local" ||
         type == "week" || type == "month" || type == "time") {
       return true;
     }
 
--- a/services/fxaccounts/FxAccountsProfileClient.jsm
+++ b/services/fxaccounts/FxAccountsProfileClient.jsm
@@ -84,33 +84,33 @@ this.FxAccountsProfileClient.prototype =
     let token = this.token;
     if (!token) {
       // tokens are cached, so getting them each request is cheap.
       token = yield this.fxa.getOAuthToken(this.oauthOptions);
     }
     try {
       return (yield this._rawRequest(path, method, token));
     } catch (ex) {
-      if (!ex instanceof FxAccountsProfileClientError || ex.code != 401) {
+      if (!(ex instanceof FxAccountsProfileClientError) || ex.code != 401) {
         throw ex;
       }
       // If this object was instantiated with a token then we don't refresh it.
       if (this.token) {
         throw ex;
       }
       // it's an auth error - assume our token expired and retry.
       log.info("Fetching the profile returned a 401 - revoking our token and retrying");
       yield this.fxa.removeCachedOAuthToken({token});
       token = yield this.fxa.getOAuthToken(this.oauthOptions);
       // and try with the new token - if that also fails then we fail after
       // revoking the token.
       try {
         return (yield this._rawRequest(path, method, token));
       } catch (ex) {
-        if (!ex instanceof FxAccountsProfileClientError || ex.code != 401) {
+        if (!(ex instanceof FxAccountsProfileClientError) || ex.code != 401) {
           throw ex;
         }
         log.info("Retry fetching the profile still returned a 401 - revoking our token and failing");
         yield this.fxa.removeCachedOAuthToken({token});
         throw ex;
       }
     }
   }),
--- a/services/fxaccounts/FxAccountsStorage.jsm
+++ b/services/fxaccounts/FxAccountsStorage.jsm
@@ -398,17 +398,17 @@ this.FxAccountsStorageManager.prototype 
     log.debug("writing secure storage", Object.keys(this.cachedSecure));
     let toWriteSecure = {
       version: DATA_FORMAT_VERSION,
       accountData: this.cachedSecure,
     }
     try {
       yield this.secureStorage.set(this.cachedPlain.uid, toWriteSecure);
     } catch (ex) {
-      if (!ex instanceof this.secureStorage.STORAGE_LOCKED) {
+      if (!(ex instanceof this.secureStorage.STORAGE_LOCKED)) {
         throw ex;
       }
       // This shouldn't be possible as once it is unlocked it can't be
       // re-locked, and we can only be here if we've previously managed to
       // read.
       log.error("setAccountData: secure storage is locked trying to write");
     }
   }),
--- a/services/sync/modules/record.js
+++ b/services/sync/modules/record.js
@@ -38,30 +38,30 @@ WBORecord.prototype = {
     if (this.data.sortindex)
       return this.data.sortindex;
     return 0;
   },
 
   // Get thyself from your URI, then deserialize.
   // Set thine 'response' field.
   fetch: function fetch(resource) {
-    if (!resource instanceof Resource) {
+    if (!(resource instanceof Resource)) {
       throw new Error("First argument must be a Resource instance.");
     }
 
     let r = resource.get();
     if (r.success) {
       this.deserialize(r);   // Warning! Muffles exceptions!
     }
     this.response = r;
     return this;
   },
 
   upload: function upload(resource) {
-    if (!resource instanceof Resource) {
+    if (!(resource instanceof Resource)) {
       throw new Error("First argument must be a Resource instance.");
     }
 
     return resource.put(this);
   },
 
   // Take a base URI string, with trailing slash, and return the URI of this
   // WBO based on collection and ID.
--- a/services/sync/modules/service.js
+++ b/services/sync/modules/service.js
@@ -451,17 +451,17 @@ Sync11Service.prototype = {
     pref = Svc.Prefs.get("declinedEngines");
     if (pref) {
       declined = pref.split(",");
     }
 
     this.clientsEngine = new ClientEngine(this);
 
     for (let name of engines) {
-      if (!name in ENGINE_MODULES) {
+      if (!(name in ENGINE_MODULES)) {
         this._log.info("Do not know about engine: " + name);
         continue;
       }
 
       let ns = {};
       try {
         Cu.import("resource://services-sync/engines/" + ENGINE_MODULES[name], ns);
 
--- a/services/sync/tps/extensions/mozmill/resource/driver/controller.js
+++ b/services/sync/tps/extensions/mozmill/resource/driver/controller.js
@@ -973,17 +973,17 @@ function browserAdditions (controller) {
 
     // Wait until the content in the tab has been loaded
     try {
       this.waitFor(function () {
         return windows.map.hasPageLoaded(utils.getWindowId(win));
       }, "Timeout", timeout, aInterval);
     }
     catch (ex) {
-      if (!ex instanceof errors.TimeoutError) {
+      if (!(ex instanceof errors.TimeoutError)) {
         throw ex;
       }
       timed_out = true;
     }
     finally {
       state = 'URI=' + win.document.location.href +
               ', readyState=' + win.document.readyState;
       message = "controller.waitForPageLoad(" + state + ")";
--- a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
+++ b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js
@@ -654,17 +654,17 @@ Expect.prototype._logFail = function Exp
 Expect.prototype.waitFor = function Expect_waitFor(aCallback, aMessage, aTimeout, aInterval, aThisObject) {
   let condition = true;
   let message = aMessage;
 
   try {
     Assert.prototype.waitFor.apply(this, arguments);
   }
   catch (ex) {
-    if (!ex instanceof errors.AssertionError) {
+    if (!(ex instanceof errors.AssertionError)) {
       throw ex;
     }
     message = ex.message;
     condition = false;
   }
 
   return this._test(condition, message);
 }
--- a/toolkit/components/osfile/modules/osfile_unix_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_unix_front.jsm
@@ -833,17 +833,17 @@
      /**
       * Return a version of an instance of
       * File.DirectoryIterator.Entry that can be sent from a worker
       * thread to the main thread. Note that deserialization is
       * asymmetric and returns an object with a different
       * implementation.
       */
      File.DirectoryIterator.Entry.toMsg = function toMsg(value) {
-       if (!value instanceof File.DirectoryIterator.Entry) {
+       if (!(value instanceof File.DirectoryIterator.Entry)) {
          throw new TypeError("parameter of " +
            "File.DirectoryIterator.Entry.toMsg must be a " +
            "File.DirectoryIterator.Entry");
        }
        let serialized = {};
        for (let key in File.DirectoryIterator.Entry.prototype) {
          serialized[key] = value[key];
        }
@@ -900,17 +900,17 @@
      });
 
      /**
       * Return a version of an instance of File.Info that can be sent
       * from a worker thread to the main thread. Note that deserialization
       * is asymmetric and returns an object with a different implementation.
       */
      File.Info.toMsg = function toMsg(stat) {
-       if (!stat instanceof File.Info) {
+       if (!(stat instanceof File.Info)) {
          throw new TypeError("parameter of File.Info.toMsg must be a File.Info");
        }
        let serialized = {};
        for (let key in File.Info.prototype) {
          serialized[key] = stat[key];
        }
        return serialized;
      };
--- a/toolkit/components/osfile/modules/osfile_win_front.jsm
+++ b/toolkit/components/osfile/modules/osfile_win_front.jsm
@@ -877,17 +877,17 @@
      /**
       * Return a version of an instance of
       * File.DirectoryIterator.Entry that can be sent from a worker
       * thread to the main thread. Note that deserialization is
       * asymmetric and returns an object with a different
       * implementation.
       */
      File.DirectoryIterator.Entry.toMsg = function toMsg(value) {
-       if (!value instanceof File.DirectoryIterator.Entry) {
+       if (!(value instanceof File.DirectoryIterator.Entry)) {
          throw new TypeError("parameter of " +
            "File.DirectoryIterator.Entry.toMsg must be a " +
            "File.DirectoryIterator.Entry");
        }
        let serialized = {};
        for (let key in File.DirectoryIterator.Entry.prototype) {
          serialized[key] = value[key];
        }
@@ -926,17 +926,17 @@
      File.Info.prototype = Object.create(SysAll.AbstractInfo.prototype);
 
      /**
       * Return a version of an instance of File.Info that can be sent
       * from a worker thread to the main thread. Note that deserialization
       * is asymmetric and returns an object with a different implementation.
       */
      File.Info.toMsg = function toMsg(stat) {
-       if (!stat instanceof File.Info) {
+       if (!(stat instanceof File.Info)) {
          throw new TypeError("parameter of File.Info.toMsg must be a File.Info");
        }
        let serialized = {};
        for (let key in File.Info.prototype) {
          serialized[key] = stat[key];
        }
        return serialized;
      };
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -990,17 +990,17 @@ function openConnection(options) {
  */
 function cloneStorageConnection(options) {
   let log = Log.repository.getLogger("Sqlite.ConnectionCloner");
 
   let source = options && options.connection;
   if (!source) {
     throw new TypeError("connection not specified in clone options.");
   }
-  if (!source instanceof Ci.mozIStorageAsyncConnection) {
+  if (!(source instanceof Ci.mozIStorageAsyncConnection)) {
     throw new TypeError("Connection must be a valid Storage connection.");
   }
 
   if (isClosed) {
     throw new Error("Sqlite.jsm has been shutdown. Cannot clone connection to: " + source.database.path);
   }
 
   let openedOptions = {};