From 3442ae7718679a4da8664bdbb561f746e0357203 Mon Sep 17 00:00:00 2001 From: janekptacijarabaci Date: Wed, 2 May 2018 06:57:57 +0200 Subject: Fix unsafe "instanceof" negations https://github.com/MoonchildProductions/Pale-Moon/pull/1173 --- services/fxaccounts/FxAccountsProfileClient.jsm | 4 ++-- services/fxaccounts/FxAccountsStorage.jsm | 2 +- services/sync/modules/record.js | 4 ++-- services/sync/modules/service.js | 2 +- services/sync/tps/extensions/mozmill/resource/driver/controller.js | 2 +- services/sync/tps/extensions/mozmill/resource/modules/assertions.js | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) (limited to 'services') diff --git a/services/fxaccounts/FxAccountsProfileClient.jsm b/services/fxaccounts/FxAccountsProfileClient.jsm index 37115a3fa..1e5edc634 100644 --- a/services/fxaccounts/FxAccountsProfileClient.jsm +++ b/services/fxaccounts/FxAccountsProfileClient.jsm @@ -89,7 +89,7 @@ this.FxAccountsProfileClient.prototype = { 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. @@ -105,7 +105,7 @@ this.FxAccountsProfileClient.prototype = { 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"); diff --git a/services/fxaccounts/FxAccountsStorage.jsm b/services/fxaccounts/FxAccountsStorage.jsm index 021763b92..43e2d21a0 100644 --- a/services/fxaccounts/FxAccountsStorage.jsm +++ b/services/fxaccounts/FxAccountsStorage.jsm @@ -403,7 +403,7 @@ this.FxAccountsStorageManager.prototype = { 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 diff --git a/services/sync/modules/record.js b/services/sync/modules/record.js index 02f7f281a..f7a69d9ef 100644 --- a/services/sync/modules/record.js +++ b/services/sync/modules/record.js @@ -43,7 +43,7 @@ WBORecord.prototype = { // 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."); } @@ -56,7 +56,7 @@ WBORecord.prototype = { }, upload: function upload(resource) { - if (!resource instanceof Resource) { + if (!(resource instanceof Resource)) { throw new Error("First argument must be a Resource instance."); } diff --git a/services/sync/modules/service.js b/services/sync/modules/service.js index b0eb0f41d..5c91323b5 100644 --- a/services/sync/modules/service.js +++ b/services/sync/modules/service.js @@ -455,7 +455,7 @@ Sync11Service.prototype = { 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; } diff --git a/services/sync/tps/extensions/mozmill/resource/driver/controller.js b/services/sync/tps/extensions/mozmill/resource/driver/controller.js index a378ce51f..8d66a41ae 100644 --- a/services/sync/tps/extensions/mozmill/resource/driver/controller.js +++ b/services/sync/tps/extensions/mozmill/resource/driver/controller.js @@ -978,7 +978,7 @@ function browserAdditions (controller) { }, "Timeout", timeout, aInterval); } catch (ex) { - if (!ex instanceof errors.TimeoutError) { + if (!(ex instanceof errors.TimeoutError)) { throw ex; } timed_out = true; diff --git a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js index c9991acf0..c76f95747 100644 --- a/services/sync/tps/extensions/mozmill/resource/modules/assertions.js +++ b/services/sync/tps/extensions/mozmill/resource/modules/assertions.js @@ -659,7 +659,7 @@ Expect.prototype.waitFor = function Expect_waitFor(aCallback, aMessage, aTimeout Assert.prototype.waitFor.apply(this, arguments); } catch (ex) { - if (!ex instanceof errors.AssertionError) { + if (!(ex instanceof errors.AssertionError)) { throw ex; } message = ex.message; -- cgit v1.2.3