Bug 1394556: Part 1 - Fix strict mode errors in JSM scripts. r=Mossop

MozReview-Commit-ID: 4LmJQql7Y2c

--HG--
extra : rebase_source : f18b5547a5a57db4e8b990bfc34f06690ac9da7a
extra : histedit_source : 7281bafbde4bf231752d9d868ec8ca1d2f55a2f9
This commit is contained in:
Kris Maglione 2017-08-30 01:50:27 -07:00
Родитель ef4e38b6ea
Коммит 8b415f700f
14 изменённых файлов: 51 добавлений и 30 удалений

Просмотреть файл

@ -3,4 +3,4 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
this['EXPORTED_SYMBOLS'] = ['test'];
test = 'this is a jsm';
var test = 'this is a jsm';

Просмотреть файл

@ -2,6 +2,7 @@
/* 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";
const Cc = Components.classes;
const Ci = Components.interfaces;
@ -78,6 +79,13 @@ function FeedWriter() {
this._selectedAppMenuItem = null;
this._subscribeCallback = null;
this._defaultHandlerMenuItem = null;
XPCOMUtils.defineLazyGetter(this, "_mm", () =>
this._window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDocShell).
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIContentFrameMessageManager));
}
FeedWriter.prototype = {
@ -977,15 +985,6 @@ FeedWriter.prototype = {
}
},
get _mm() {
let mm = this._window.QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIDocShell).
QueryInterface(Ci.nsIInterfaceRequestor).
getInterface(Ci.nsIContentFrameMessageManager);
delete this._mm;
return this._mm = mm;
},
classID: FEEDWRITER_CID,
QueryInterface: XPCOMUtils.generateQI([Ci.nsIDOMEventListener, Ci.nsIObserver,
Ci.nsIDOMGlobalPropertyInitializer])

Просмотреть файл

@ -1,6 +1,7 @@
/* 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";
this.EXPORTED_SYMBOLS = ["WebVTT"];
@ -351,7 +352,6 @@ const { XPCOMUtils } = require("resource://gre/modules/XPCOMUtils.jsm");
return null;
}
var element = window.document.createElement(tagName);
element.localName = tagName;
var name = TAG_ANNOTATION[type];
if (name) {
element[name] = annotation ? annotation.trim() : "";

Просмотреть файл

@ -3,6 +3,7 @@
/* 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";
this.EXPORTED_SYMBOLS = ["OnRefTestLoad", "OnRefTestUnload"];
@ -852,9 +853,9 @@ function AddTestItem(aTest, aFilter)
if (!aFilter)
aFilter = [null, [], false];
globalFilter = aFilter[0];
manifestFilter = aFilter[1];
invertManifest = aFilter[2];
var globalFilter = aFilter[0];
var manifestFilter = aFilter[1];
var invertManifest = aFilter[2];
if ((globalFilter && !globalFilter.test(aTest.url1.spec)) ||
(manifestFilter &&
!(invertManifest ^ manifestFilter.test(aTest.url1.spec))))
@ -1495,7 +1496,7 @@ function StartCurrentURI(aState)
function DoneTests()
{
logger.suiteEnd(extra={'results': gTestResults});
logger.suiteEnd({'results': gTestResults});
logger.info("Slowest test took " + gSlowestTestTime + "ms (" + gSlowestTestURL + ")");
logger.info("Total canvas count = " + gRecycledCanvases.length);
if (gFailedUseWidgetLayers) {

Просмотреть файл

@ -2,6 +2,7 @@
/* 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";
/**
* Firefox Accounts Web Channel.
@ -379,7 +380,7 @@ var singleton;
// ever created - we require this because the WebChannel is global in scope and
// allowing multiple channels would cause such notifications to be sent multiple
// times.
this.EnsureFxAccountsWebChannel = function() {
this.EnsureFxAccountsWebChannel = () => {
if (!singleton) {
let contentUri = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.webchannel.uri");
// The FxAccountsWebChannel listens for events and updates the Java layer.

Просмотреть файл

@ -12,6 +12,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
/*
* This file is generated from kinto-http.js - do not modify directly.
@ -2932,4 +2933,4 @@ function cleanUndefinedProperties(obj) {
}
},{}]},{},[1])(1)
});
});

Просмотреть файл

@ -12,11 +12,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
"use strict";
/*
* This file is generated from kinto.js - do not modify directly.
*/
const global = this;
this.EXPORTED_SYMBOLS = ["Kinto"];
/*
@ -2512,4 +2515,4 @@ function omitKeys(obj, keys = []) {
}
},{}]},{},[1])(1)
});
});

Просмотреть файл

@ -1,6 +1,7 @@
/* 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";
/**
* Firefox Accounts Web Channel.
@ -540,7 +541,7 @@ var singleton;
// (eg, it uses the observer service to tell interested parties of interesting
// things) and allowing multiple channels would cause such notifications to be
// sent multiple times.
this.EnsureFxAccountsWebChannel = function() {
this.EnsureFxAccountsWebChannel = () => {
let contentUri = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.webchannel.uri");
if (singleton && singleton._contentUri !== contentUri) {
singleton.tearDown();

Просмотреть файл

@ -315,7 +315,11 @@ EngineSynchronizer.prototype = {
this._log.trace("The " + engineName + " engine was disabled remotely.");
// Don't automatically mark it as declined!
engine.enabled = false;
try {
engine.enabled = false;
} catch (e) {
this._log.trace("Failed to disable engine " + engineName);
}
}
}

Просмотреть файл

@ -1,3 +1,6 @@
"use strict";
const global = this;
this.EXPORTED_SYMBOLS = ["Ajv"];
/*
@ -7647,4 +7650,4 @@ function Ajv(opts) {
}
},{"./async":1,"./cache":2,"./compile":6,"./compile/formats":5,"./compile/resolve":7,"./compile/rules":8,"./compile/schema_obj":9,"./compile/util":10,"./compile/validation_error":11,"./keyword":35,"./refs/json-schema-draft-04.json":36,"./v5":38,"co":45,"json-stable-stringify":46}]},{},[])("ajv")
});
});

Просмотреть файл

@ -1,6 +1,7 @@
/* 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";
// Based on:
// https://bugzilla.mozilla.org/show_bug.cgi?id=549539
@ -132,7 +133,7 @@ SpecialPowersObserver.prototype.uninit = function() {
var obs = Services.obs;
obs.removeObserver(this, "chrome-document-global-created");
obs.removeObserver(this, "http-on-modify-request");
this._registerObservers._topics.forEach(function(element) {
this._registerObservers._topics.forEach((element) => {
obs.removeObserver(this._registerObservers, element);
});
this._removeProcessCrashObservers();
@ -254,7 +255,7 @@ SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
try {
let promises = [];
aMessage.data.forEach(function(request) {
const filePerms = 0666; // eslint-disable-line no-octal
const filePerms = 0o666;
let testFile = Services.dirsvc.get("ProfD", Ci.nsIFile);
if (request.name) {
testFile.appendRelativePath(request.name);

Просмотреть файл

@ -1,6 +1,7 @@
/* 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";
/**
* FormHistory
@ -441,6 +442,8 @@ function dbCreateAsyncStatement(aQuery, aParams, aBindingArrays) {
return stmt;
}
var dbMigrate;
/**
* Attempts to initialize the database. This creates the file if it doesn't
* exist, performs any migrations, etc.
@ -498,7 +501,7 @@ function dbCreate() {
_dbConnection.schemaVersion = DB_SCHEMA_VERSION;
}
function dbMigrate(oldVersion) {
dbMigrate = (oldVersion) => {
log("Attempting to migrate from version " + oldVersion);
if (oldVersion > DB_SCHEMA_VERSION) {
@ -539,7 +542,7 @@ function dbMigrate(oldVersion) {
_dbConnection.commitTransaction();
log("DB migration completed.");
}
};
/**
* Sanity check to ensure that the columns this version of the code expects

Просмотреть файл

@ -2341,8 +2341,12 @@ Engine.prototype = {
type = "application/x-moz-phonesearch";
}
delete this._defaultMobileResponseType;
return this._defaultMobileResponseType = type;
Object.defineProperty(this, "_defaultMobileResponseType", {
value: type,
configurable: true,
});
return type;
},
get _isWhiteListed() {

Просмотреть файл

@ -10,7 +10,7 @@
this.EXPORTED_SYMBOLS = ["NS_ASSERT"];
var gTraceOnAssert = true;
var gTraceOnAssert = false;
/**
* This function provides a simple assertion function for JavaScript.
@ -47,8 +47,6 @@ this.NS_ASSERT = function NS_ASSERT(condition, message) {
}
} catch (ex) {}
// eslint-disable-next-line no-caller
var caller = arguments.callee.caller;
var assertionText = "ASSERT: " + message + "\n";
// Report the error to the console
@ -63,6 +61,8 @@ this.NS_ASSERT = function NS_ASSERT(condition, message) {
if (gTraceOnAssert) {
stackText = "Stack Trace: \n";
var count = 0;
// eslint-disable-next-line no-caller
var caller = arguments.callee.caller;
while (caller) {
stackText += count++ + ":" + caller.name + "(";
for (var i = 0; i < caller.arguments.length; ++i) {