Bug 1385815 - Enable more whitespace related ESLint rules for mobile/android. r=sebastian

MozReview-Commit-ID: FuM6Neob0mC

--HG--
extra : rebase_source : 29a9fbbaf74b17f4b02a835a7ef88550413514a0
This commit is contained in:
Dan Banner 2017-08-01 16:36:00 +01:00
Родитель 12a96894b3
Коммит 9a7db035d4
61 изменённых файлов: 318 добавлений и 322 удалений

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

@ -28,9 +28,5 @@ module.exports = {
"no-unused-vars": "off",
"object-shorthand": "off",
"quotes": "off", // [2, "double"]
"space-before-blocks": "off",
"space-before-function-paren": "off",
"space-infix-ops": "off",
"spaced-comment": "off",
}
};

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

@ -123,7 +123,7 @@ var CastingApps = {
return Services.prefs.getBoolPref("browser.casting.enabled");
},
onEvent: function (event, message, callback) {
onEvent: function(event, message, callback) {
switch (event) {
case "Casting:Play":
if (this.session && this.session.remoteMedia.status == "paused") {
@ -143,7 +143,7 @@ var CastingApps = {
}
},
observe: function (aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "ssdp-service-found":
this.serviceAdded(SimpleServiceDiscovery.findServiceForID(aData));

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

@ -13,7 +13,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI",
var EmbedRT = {
_scopes: {},
onEvent: function (event, data, callback) {
onEvent: function(event, data, callback) {
switch (event) {
case "GeckoView:ImportScript":
this.importScript(data.scriptURL);

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

@ -15,7 +15,7 @@ Linkifier.prototype = {
let cleanedText = "";
for (let i = 0; i < aNumberText.length; i++) {
let c = aNumberText.charAt(i);
if ((c >= '0' && c <= '9') || c == '+') //assuming there is only the leading '+'.
if ((c >= '0' && c <= '9') || c == '+') // assuming there is only the leading '+'.
cleanedText += c;
}
anchorNode.setAttribute("href", "tel:" + cleanedText);
@ -48,7 +48,7 @@ Linkifier.prototype = {
if (!prevNode) // first time, need to replace the whole node with the first new one.
parent.replaceChild(nodeToAdd, aNodeToProcess);
else
parent.insertBefore(nodeToAdd, prevNode.nextSibling); //inserts after.
parent.insertBefore(nodeToAdd, prevNode.nextSibling); // inserts after.
if (textExistsBeforeNumber) // if we added the text node before the anchor, we still need to add the anchor node.
parent.insertBefore(anchorNode, nodeToAdd.nextSibling);
@ -74,7 +74,7 @@ Linkifier.prototype = {
this._linkifyTimer = null;
}
let filterNode = function (node) {
let filterNode = function(node) {
if (node.parentNode.tagName != 'A' &&
node.parentNode.tagName != 'SCRIPT' &&
node.parentNode.tagName != 'NOSCRIPT' &&

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

@ -120,7 +120,7 @@ var PluginHelper = {
},
// Copied from /browser/base/content/browser.js
isTooSmall: function (plugin, overlay) {
isTooSmall: function(plugin, overlay) {
// Is the <object>'s size too small to hold what we want to show?
let pluginRect = plugin.getBoundingClientRect();
// XXX bug 446693. The text-shadow on the submitted-report text at
@ -131,7 +131,7 @@ var PluginHelper = {
return overflows;
},
getPluginMimeType: function (plugin) {
getPluginMimeType: function(plugin) {
var tagMimetype = plugin.actualType;
if (tagMimetype == "") {
@ -141,7 +141,7 @@ var PluginHelper = {
return tagMimetype;
},
handlePluginBindingAttached: function (aTab, aEvent) {
handlePluginBindingAttached: function(aTab, aEvent) {
let plugin = aEvent.target;
let doc = plugin.ownerDocument;
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");

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

@ -7,7 +7,7 @@
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
var PrintHelper = {
onEvent: function (event, data, callback) {
onEvent: function(event, data, callback) {
let browser = BrowserApp.selectedBrowser;
switch (event) {
@ -58,10 +58,10 @@ var PrintHelper = {
}
}
},
onProgressChange: function () {},
onLocationChange: function () {},
onStatusChange: function () {},
onSecurityChange: function () {},
onProgressChange: function() {},
onLocationChange: function() {},
onStatusChange: function() {},
onSecurityChange: function() {},
});
});
}

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

@ -7,7 +7,7 @@
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
/*globals MAX_URI_LENGTH, MAX_TITLE_LENGTH */
/* globals MAX_URI_LENGTH, MAX_TITLE_LENGTH */
var Reader = {
// These values should match those defined in BrowserContract.java.
@ -203,7 +203,7 @@ var Reader = {
_sendMmaEvent: function(event) {
WindowEventDispatcher.sendRequest({
type: "Mma:"+event,
type: "Mma:" + event,
});
},

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

@ -129,7 +129,7 @@ var WebrtcUI = {
contentWindow.navigator.mozGetUserMediaDevices(
constraints,
function (devices) {
function(devices) {
if (!ParentalControls.isAllowed(ParentalControls.CAMERA_MICROPHONE)) {
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aSubject.callID);
WebrtcUI.showBlockMessage(devices);
@ -139,7 +139,7 @@ var WebrtcUI = {
WebrtcUI.prompt(contentWindow, aSubject.callID, constraints.audio,
constraints.video, devices);
},
function (error) {
function(error) {
Cu.reportError(error);
},
aSubject.innerWindowID,
@ -214,7 +214,7 @@ var WebrtcUI = {
return Strings.browser.GetStringFromName("getUserMedia." + aType + "." + res[1] + "Camera");
if (device.name.startsWith("&") && device.name.endsWith(";"))
return Strings.browser.GetStringFromName(device.name.substring(1, device.name.length -1));
return Strings.browser.GetStringFromName(device.name.substring(1, device.name.length - 1));
if (device.name.trim() == "") {
defaultCount++;

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

@ -24,12 +24,12 @@
"use strict";
var {classes: Cc, interfaces: Ci, utils: Cu} = Components; /*global Components */
var {classes: Cc, interfaces: Ci, utils: Cu} = Components; /* global Components */
Cu.import("resource://gre/modules/Accounts.jsm"); /*global Accounts */
Cu.import("resource://gre/modules/PromiseUtils.jsm"); /*global PromiseUtils */
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /*global XPCOMUtils */
Cu.import("resource://gre/modules/Accounts.jsm"); /* global Accounts */
Cu.import("resource://gre/modules/PromiseUtils.jsm"); /* global PromiseUtils */
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
const ACTION_URL_PARAM = "action";
@ -88,7 +88,7 @@ var wrapper = {
url: null,
init: function (url) {
init: function(url) {
this.url = url;
deferTransitionToRemoteAfterLoaded();
@ -107,7 +107,7 @@ var wrapper = {
webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
},
retry: function () {
retry: function() {
deferTransitionToRemoteAfterLoaded();
let webNav = this.iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);

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

@ -4,7 +4,7 @@
"use strict";
/*globals gChromeWin */
/* globals gChromeWin */
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
@ -86,12 +86,12 @@ var ContextMenus = {
this.target = null;
},
disable: function (event) {
disable: function(event) {
Addons.setEnabled(false, this.target.addon);
this.target = null;
},
uninstall: function (event) {
uninstall: function(event) {
Addons.uninstall(this.target.addon);
this.target = null;
}
@ -284,7 +284,7 @@ var Addons = {
aAddons.sort(function(a, b) {
return a.name.localeCompare(b.name);
});
for (let i=0; i<aAddons.length; i++) {
for (let i = 0; i < aAddons.length; i++) {
// Don't create item for system add-ons.
if (aAddons[i].isSystem)
continue;

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

@ -31,7 +31,7 @@ var contextMenu = {
_items: [],
_targetDownload: null,
init: function () {
init: function() {
let element = document.getElementById("downloadmenu");
element.addEventListener("click",
event => event.download = this._targetDownload,
@ -72,11 +72,11 @@ var contextMenu = {
];
},
addContextMenuEventListener: function (element) {
addContextMenuEventListener: function(element) {
element.addEventListener("contextmenu", this.onContextMenu.bind(this));
},
onContextMenu: function (event) {
onContextMenu: function(event) {
let target = event.target;
while (target && !target.download) {
target = target.parentNode;
@ -103,7 +103,7 @@ function ContextMenuItem(name, isVisible, action) {
}
ContextMenuItem.prototype = {
updateVisibility: function (download) {
updateVisibility: function(download) {
this.element.hidden = !this.isVisible(download);
}
};
@ -137,7 +137,7 @@ DownloadListView.prototype = {
return finished;
},
insertOrMoveItem: function (item) {
insertOrMoveItem: function(item) {
var compare = (a, b) => {
// active downloads always before stopped downloads
if (a.stopped != b.stopped) {
@ -154,13 +154,13 @@ DownloadListView.prototype = {
this.listElement.insertBefore(item.element, insertLocation);
},
onDownloadAdded: function (download) {
onDownloadAdded: function(download) {
let item = new DownloadItem(download);
this.items.set(download, item);
this.insertOrMoveItem(item);
},
onDownloadChanged: function (download) {
onDownloadChanged: function(download) {
let item = this.items.get(download);
if (!item) {
Cu.reportError("No DownloadItem found for download");
@ -174,7 +174,7 @@ DownloadListView.prototype = {
item.onDownloadChanged();
},
onDownloadRemoved: function (download) {
onDownloadRemoved: function(download) {
let item = this.items.get(download);
if (!item) {
Cu.reportError("No DownloadItem found for download");
@ -192,7 +192,7 @@ DownloadListView.prototype = {
};
var downloadLists = {
init: function () {
init: function() {
this.publicDownloads = new DownloadListView(Downloads.PUBLIC, "public-downloads-list");
this.privateDownloads = new DownloadListView(Downloads.PRIVATE, "private-downloads-list");
},
@ -201,7 +201,7 @@ var downloadLists = {
return this.publicDownloads.finished.concat(this.privateDownloads.finished);
},
removeFinished: function () {
removeFinished: function() {
let finished = this.finished;
if (finished.length == 0) {
return;
@ -244,7 +244,7 @@ const kDownloadStatePropertyNames = [
];
DownloadItem.prototype = {
_htmlEscape: function (s) {
_htmlEscape: function(s) {
s = s.replace(/&/g, "&amp;");
s = s.replace(/>/g, "&gt;");
s = s.replace(/</g, "&lt;");
@ -253,7 +253,7 @@ DownloadItem.prototype = {
return s;
},
_updateFromDownload: function () {
_updateFromDownload: function() {
this._state = {};
kDownloadStatePropertyNames.forEach(
name => this._state[name] = this._download[name],
@ -295,7 +295,7 @@ DownloadItem.prototype = {
return element;
},
updateElement: function (element) {
updateElement: function(element) {
element.querySelector(".date").textContent = this.startDate;
element.querySelector(".domain").textContent = this.domain;
element.querySelector(".icon").src = this.iconUrl;
@ -304,13 +304,13 @@ DownloadItem.prototype = {
element.querySelector(".title").setAttribute("value", this.fileName);
},
onClick: function (event) {
onClick: function(event) {
if (this.download.succeeded) {
this.download.launch().catch(Cu.reportError);
}
},
onDownloadChanged: function () {
onDownloadChanged: function() {
this._updateFromDownload();
this.updateElement(this.element);
},

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

@ -32,7 +32,7 @@ const EVENT_HEALTH_RESPONSE = "HealthReport:Response";
var sharedPrefs = SharedPreferences.forApp();
var healthReportWrapper = {
init: function () {
init: function() {
let iframe = document.getElementById("remote-report");
iframe.addEventListener("load", healthReportWrapper.initRemotePage);
let report = this._getReportURI();
@ -43,7 +43,7 @@ var healthReportWrapper = {
Services.obs.addObserver(this, EVENT_HEALTH_RESPONSE);
},
observe: function (subject, topic, data) {
observe: function(subject, topic, data) {
if (topic == PREF_UPLOAD_ENABLED) {
this.updatePrefState();
} else if (topic == EVENT_HEALTH_RESPONSE) {
@ -51,12 +51,12 @@ var healthReportWrapper = {
}
},
uninit: function () {
uninit: function() {
sharedPrefs.removeObserver(PREF_UPLOAD_ENABLED, this);
Services.obs.removeObserver(this, EVENT_HEALTH_RESPONSE);
},
_getReportURI: function () {
_getReportURI: function() {
let url = Services.urlFormatter.formatURLPref(PREF_REPORTURL);
// This handles URLs that already have query parameters.
let uri = Services.io.newURI(url).QueryInterface(Ci.nsIURL);
@ -64,19 +64,19 @@ var healthReportWrapper = {
return uri;
},
onOptIn: function () {
onOptIn: function() {
console.log("AboutHealthReport: page sent opt-in command.");
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, true);
this.updatePrefState();
},
onOptOut: function () {
onOptOut: function() {
console.log("AboutHealthReport: page sent opt-out command.");
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, false);
this.updatePrefState();
},
updatePrefState: function () {
updatePrefState: function() {
console.log("AboutHealthReport: sending pref state to page.");
try {
let prefs = {
@ -88,14 +88,14 @@ var healthReportWrapper = {
}
},
refreshPayload: function () {
refreshPayload: function() {
console.log("AboutHealthReport: page requested fresh payload.");
EventDispatcher.instance.sendRequest({
type: EVENT_HEALTH_REQUEST,
});
},
updatePayload: function (data) {
updatePayload: function(data) {
healthReportWrapper.injectData("payload", data);
// Data is supposed to be a string, so the length should be
// defined. Just in case, we do this after injecting the data.
@ -103,7 +103,7 @@ var healthReportWrapper = {
"(" + typeof(data) + " of length " + data.length + ").");
},
injectData: function (type, content) {
injectData: function(type, content) {
let report = this._getReportURI();
// file: URIs can't be used for targetOrigin, so we use "*" for
@ -120,7 +120,7 @@ var healthReportWrapper = {
iframe.contentWindow.postMessage(data, reportUrl);
},
showSettings: function () {
showSettings: function() {
console.log("AboutHealthReport: showing settings.");
EventDispatcher.instance.sendRequest({
type: "Settings:Show",
@ -128,14 +128,14 @@ var healthReportWrapper = {
});
},
launchUpdater: function () {
launchUpdater: function() {
console.log("AboutHealthReport: launching updater.");
EventDispatcher.instance.sendRequest({
type: "Updater:Launch",
});
},
handleRemoteCommand: function (evt) {
handleRemoteCommand: function(evt) {
switch (evt.detail.command) {
case "DisableDataSubmission":
this.onOptOut();
@ -162,7 +162,7 @@ var healthReportWrapper = {
}
},
initRemotePage: function () {
initRemotePage: function() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); });
@ -174,18 +174,18 @@ var healthReportWrapper = {
ERROR_PAYLOAD_FAILED: 2,
ERROR_PREFS_FAILED: 3,
reportFailure: function (error) {
reportFailure: function(error) {
let details = {
errorType: error,
};
healthReportWrapper.injectData("error", details);
},
handleInitFailure: function () {
handleInitFailure: function() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},
handlePayloadFailure: function () {
handlePayloadFailure: function() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
},
};

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

@ -4,7 +4,7 @@
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
Cu.import("resource://services-common/utils.js"); /*global: CommonUtils */
Cu.import("resource://services-common/utils.js"); /* global: CommonUtils */
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
@ -151,7 +151,7 @@ var Logins = {
}
},
init: function () {
init: function() {
window.addEventListener("popstate", this);
Services.obs.addObserver(this, "passwordmgr-storage-changed");
@ -202,12 +202,12 @@ var Logins = {
this._reloadList();
},
uninit: function () {
uninit: function() {
Services.obs.removeObserver(this, "passwordmgr-storage-changed");
window.removeEventListener("popstate", this);
},
_loadList: function (logins) {
_loadList: function(logins) {
let list = document.getElementById("logins-list");
let newList = list.cloneNode(false);
@ -219,7 +219,7 @@ var Logins = {
list.parentNode.replaceChild(newList, list);
},
_showList: function () {
_showList: function() {
let loginsListPage = document.getElementById("logins-list-page");
loginsListPage.classList.remove("hidden");
@ -232,7 +232,7 @@ var Logins = {
}
},
_onPopState: function (event) {
_onPopState: function(event) {
// Called when back/forward is used to change the state of the page
if (event.state) {
this._showEditLoginDialog(event.state.id);
@ -241,7 +241,7 @@ var Logins = {
this._showList();
}
},
_showEditLoginDialog: function (login) {
_showEditLoginDialog: function(login) {
let listPage = document.getElementById("logins-list-page");
listPage.classList.add("hidden");
@ -318,11 +318,11 @@ var Logins = {
this._showList();
},
_onPasswordBtn: function () {
_onPasswordBtn: function() {
this._updatePasswordBtn(this._isPasswordBtnInHideMode());
},
_updatePasswordBtn: function (aShouldShow) {
_updatePasswordBtn: function(aShouldShow) {
let passwordField = document.getElementById("password");
let button = document.getElementById("password-btn");
let show = gStringBundle.GetStringFromName("password-btn.show");
@ -333,12 +333,12 @@ var Logins = {
button.classList.remove("password-btn-hide");
} else {
passwordField.type = "text";
button.textContent= hide;
button.textContent = hide;
button.classList.add("password-btn-hide");
}
},
_isPasswordBtnInHideMode: function () {
_isPasswordBtnInHideMode: function() {
let button = document.getElementById("password-btn");
return button.classList.contains("password-btn-hide");
},
@ -359,7 +359,7 @@ var Logins = {
});
},
_onLoginClick: function (event) {
_onLoginClick: function(event) {
let loginItem = event.currentTarget;
let login = loginItem.login;
if (!login) {
@ -415,14 +415,14 @@ var Logins = {
});
},
_loadFavicon: function (aImg, aHostname) {
_loadFavicon: function(aImg, aHostname) {
// Load favicon from cache.
EventDispatcher.instance.sendRequestForResult({
type: "Favicon:Request",
url: aHostname,
skipNetwork: true
}).then(function(faviconUrl) {
aImg.style.backgroundImage= "url('" + faviconUrl + "')";
aImg.style.backgroundImage = "url('" + faviconUrl + "')";
aImg.style.visibility = "visible";
}, function(data) {
debug("Favicon cache failure : " + data);
@ -430,7 +430,7 @@ var Logins = {
});
},
_createItemForLogin: function (login) {
_createItemForLogin: function(login) {
let loginItem = document.createElement("div");
loginItem.setAttribute("loginID", login.guid);
@ -473,7 +473,7 @@ var Logins = {
return loginItem;
},
handleEvent: function (event) {
handleEvent: function(event) {
switch (event.type) {
case "popstate": {
this._onPopState(event);
@ -486,7 +486,7 @@ var Logins = {
}
},
observe: function (subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case "passwordmgr-storage-changed": {
this._reloadList();

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

@ -90,7 +90,7 @@ AboutRedirector.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
classID: Components.ID("{322ba47e-7047-4f71-aebf-cb7d69325cd9}"),
_getModuleInfo: function (aURI) {
_getModuleInfo: function(aURI) {
let moduleName = aURI.pathQueryRef.replace(/[?#].*/, "").toLowerCase();
return modules[moduleName];
},

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

@ -17,7 +17,7 @@ BrowserCLH.prototype = {
*
* Consumers can access Android assets using resource://android/assets/FILENAME.
*/
setResourceSubstitutions: function () {
setResourceSubstitutions: function() {
let registry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
// Like jar:jar:file:///data/app/org.mozilla.fennec-2.apk!/assets/omni.ja!/chrome/chrome/content/aboutHome.xhtml
let url = registry.convertChromeURL(Services.io.newURI("chrome://browser/content/aboutHome.xhtml")).spec;
@ -28,7 +28,7 @@ BrowserCLH.prototype = {
protocolHandler.setSubstitution("android", Services.io.newURI(url));
},
observe: function (subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case "app-startup":
this.setResourceSubstitutions();

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

@ -161,5 +161,5 @@ ContentPermissionPrompt.prototype = {
};
//module initialization
// module initialization
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);

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

@ -29,7 +29,7 @@ function FxAccountsPush() {
}
FxAccountsPush.prototype = {
observe: function (subject, topic, data) {
observe: function(subject, topic, data) {
switch (topic) {
case "android-push-service":
if (data === "android-fxa-subscribe") {

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

@ -3,7 +3,7 @@
* 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/. */
/*globals ContentAreaUtils */
/* globals ContentAreaUtils */
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
@ -52,7 +52,7 @@ HelperAppLauncherDialog.prototype = {
*
* Returns true otherwise.
*/
_canDownload: function (url, alreadyResolved=false) {
_canDownload: function(url, alreadyResolved = false) {
// The common case.
if (url.schemeIs("http") ||
url.schemeIs("https") ||
@ -89,7 +89,7 @@ HelperAppLauncherDialog.prototype = {
* Returns true if `launcher` represents a download for which we wish
* to prompt.
*/
_shouldPrompt: function (launcher) {
_shouldPrompt: function(launcher) {
let mimeType = this._getMimeTypeFromLauncher(launcher);
// Straight equality: nsIMIMEInfo normalizes.
@ -290,7 +290,7 @@ HelperAppLauncherDialog.prototype = {
return "browser.download.preferred." + mimetype.replace("\\", ".");
},
_getMimeTypeFromLauncher: function (launcher) {
_getMimeTypeFromLauncher: function(launcher) {
let mime = launcher.MIMEInfo.MIMEType;
if (!mime)
mime = ContentAreaUtils.getMIMETypeForURI(launcher.source) || "";
@ -321,7 +321,7 @@ HelperAppLauncherDialog.prototype = {
Services.prefs.clearUserPref(this._getPrefName(mime));
},
promptForSaveToFileAsync: function (aLauncher, aContext, aDefaultFile,
promptForSaveToFileAsync: function(aLauncher, aContext, aDefaultFile,
aSuggestedFileExt, aForcePrompt) {
Task.spawn(function* () {
let file = null;
@ -377,7 +377,7 @@ HelperAppLauncherDialog.prototype = {
}
else {
// replace the last (n) in the filename with (n+1)
aLocalFile.leafName = aLocalFile.leafName.replace(/^(.*\()\d+\)/, "$1" + (collisionCount+1) + ")");
aLocalFile.leafName = aLocalFile.leafName.replace(/^(.*\()\d+\)/, "$1" + (collisionCount + 1) + ")");
}
}
aLocalFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);

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

@ -8,21 +8,21 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Timer.jsm");
////////////////////////////////////////////////////////////////////////////////
//// Constants
// //////////////////////////////////////////////////////////////////////////////
// // Constants
//// SVG placeholder image for blocked image content
// // SVG placeholder image for blocked image content
const PLACEHOLDER_IMG = "chrome://browser/skin/images/placeholder_image.svg";
//// Telemetry
// // Telemetry
const TELEMETRY_TAP_TO_LOAD_ENABLED = "TAP_TO_LOAD_ENABLED";
const TELEMETRY_SHOW_IMAGE_SIZE = "TAP_TO_LOAD_IMAGE_SIZE";
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
//// Gecko preference
// // Gecko preference
const PREF_IMAGEBLOCKING = "browser.image_blocking";
//// Enabled options
// // Enabled options
const OPTION_NEVER = 0;
const OPTION_ALWAYS = 1;
const OPTION_WIFI_ONLY = 2;
@ -95,7 +95,7 @@ ImageBlockingPolicy.prototype = {
return Services.prefs.getIntPref(PREF_IMAGEBLOCKING);
},
observe: function (subject, topic, data) {
observe: function(subject, topic, data) {
if (topic == TOPIC_GATHER_TELEMETRY) {
Services.telemetry.getHistogramById(TELEMETRY_TAP_TO_LOAD_ENABLED).add(this._enabled());
}
@ -105,7 +105,7 @@ ImageBlockingPolicy.prototype = {
function sendImageSizeTelemetry(imageURL) {
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
xhr.open("HEAD", imageURL, true);
xhr.onreadystatechange = function (e) {
xhr.onreadystatechange = function(e) {
if (xhr.readyState != 4) {
return;
}

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

@ -90,7 +90,7 @@ LoginManagerPrompter.prototype = {
*
* Internal function for logging debug messages to the Error Console window.
*/
log: function (message) {
log: function(message) {
if (!this._debug)
return;
@ -104,7 +104,7 @@ LoginManagerPrompter.prototype = {
* init
*
*/
init: function (aWindow, aFactory) {
init: function(aWindow, aFactory) {
this._chromeWindow = this._getChromeWindow(aWindow).wrappedJSObject;
this._factory = aFactory || null;
this._browser = null;
@ -126,7 +126,7 @@ LoginManagerPrompter.prototype = {
* promptToSavePassword
*
*/
promptToSavePassword: function (aLogin) {
promptToSavePassword: function(aLogin) {
this._showSaveLoginNotification(aLogin);
Services.telemetry.getHistogramById("PWMGR_PROMPT_REMEMBER_ACTION").add(PROMPT_DISPLAYED);
Services.obs.notifyObservers(aLogin, "passwordmgr-prompt-save");
@ -145,7 +145,7 @@ LoginManagerPrompter.prototype = {
* @param aPassword
* Password string used in creating a doorhanger action
*/
_showLoginNotification: function (aBody, aButtons, aUsername, aPassword) {
_showLoginNotification: function(aBody, aButtons, aUsername, aPassword) {
let tabID = this._chromeWindow.BrowserApp.getTabForBrowser(this._browser).id;
let actionText = {
@ -181,7 +181,7 @@ LoginManagerPrompter.prototype = {
* their login, and only save a login which they know worked.
*
*/
_showSaveLoginNotification: function (aLogin) {
_showSaveLoginNotification: function(aLogin) {
let brandShortName = this._strBundle.brand.GetStringFromName("brandShortName");
let notificationText = this._getLocalizedString("saveLogin", [brandShortName]);
@ -226,7 +226,7 @@ LoginManagerPrompter.prototype = {
* fields.
*
*/
promptToChangePassword: function (aOldLogin, aNewLogin) {
promptToChangePassword: function(aOldLogin, aNewLogin) {
this._showChangeLoginNotification(aOldLogin, aNewLogin.password);
Services.telemetry.getHistogramById("PWMGR_PROMPT_UPDATE_ACTION").add(PROMPT_DISPLAYED);
let oldGUID = aOldLogin.QueryInterface(Ci.nsILoginMetaInfo).guid;
@ -239,7 +239,7 @@ LoginManagerPrompter.prototype = {
* Shows the Change Password notification doorhanger.
*
*/
_showChangeLoginNotification: function (aOldLogin, aNewPassword) {
_showChangeLoginNotification: function(aOldLogin, aNewPassword) {
var notificationText;
if (aOldLogin.username) {
let displayUser = this._sanitizeUsername(aOldLogin.username);
@ -290,7 +290,7 @@ LoginManagerPrompter.prototype = {
*
* Note; XPCOM stupidity: |count| is just |logins.length|.
*/
promptToChangePasswordWithUsernames: function (logins, count, aNewLogin) {
promptToChangePasswordWithUsernames: function(logins, count, aNewLogin) {
const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
var usernames = logins.map(l => l.username);
@ -317,7 +317,7 @@ LoginManagerPrompter.prototype = {
/*
* _updateLogin
*/
_updateLogin: function (login, newPassword) {
_updateLogin: function(login, newPassword) {
var now = Date.now();
var propBag = Cc["@mozilla.org/hash-property-bag;1"].
createInstance(Ci.nsIWritablePropertyBag);
@ -338,7 +338,7 @@ LoginManagerPrompter.prototype = {
*
* Given a content DOM window, returns the chrome window it's in.
*/
_getChromeWindow: function (aWindow) {
_getChromeWindow: function(aWindow) {
if (aWindow instanceof Ci.nsIDOMChromeWindow)
return aWindow;
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
@ -354,7 +354,7 @@ LoginManagerPrompter.prototype = {
* Returns the NativeWindow to this prompter, or null if there isn't
* a NativeWindow available (w/ error sent to logcat).
*/
_getNativeWindow: function () {
_getNativeWindow: function() {
let nativeWindow = null;
try {
let chromeWin = this._chromeWindow;
@ -384,7 +384,7 @@ LoginManagerPrompter.prototype = {
* formatted if required.
*
*/
_getLocalizedString: function (key, formatArgs) {
_getLocalizedString: function(key, formatArgs) {
if (formatArgs)
return this._strBundle.pwmgr.formatStringFromName(
key, formatArgs, formatArgs.length);
@ -399,7 +399,7 @@ LoginManagerPrompter.prototype = {
* it's too long. This helps prevent an evil site from messing with the
* "save password?" prompt too much.
*/
_sanitizeUsername: function (username) {
_sanitizeUsername: function(username) {
if (username.length > 30) {
username = username.substring(0, 30);
username += this._ellipsis;

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

@ -391,7 +391,7 @@ InternalPrompt.prototype = {
/* ---------- nsIAuthPrompt ---------- */
nsIAuthPrompt_prompt: function (title, text, passwordRealm, savePassword, defaultText, result) {
nsIAuthPrompt_prompt: function(title, text, passwordRealm, savePassword, defaultText, result) {
// TODO: Port functions from nsLoginManagerPrompter.js to here
if (defaultText)
result.value = defaultText;
@ -538,7 +538,7 @@ InternalPrompt.prototype = {
// If the user submits a login but it fails, we need to remove the
// notification bar that was displayed. Conveniently, the user will
// be prompted for authentication again, which brings us here.
//this._removeLoginNotifications();
// this._removeLoginNotifications();
cancelable = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
@ -811,7 +811,7 @@ var PromptUtils = {
return [username, password];
},
setAuthInfo: function (aAuthInfo, username, password) {
setAuthInfo: function(aAuthInfo, username, password) {
var flags = aAuthInfo.flags;
if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
// Domain is separated from username by a backslash
@ -820,7 +820,7 @@ var PromptUtils = {
aAuthInfo.username = username;
} else {
aAuthInfo.domain = username.substring(0, idx);
aAuthInfo.username = username.substring(idx+1);
aAuthInfo.username = username.substring(idx + 1);
}
} else {
aAuthInfo.username = username;
@ -850,11 +850,11 @@ var PromptUtils = {
}
};
XPCOMUtils.defineLazyGetter(PromptUtils, "passwdBundle", function () {
XPCOMUtils.defineLazyGetter(PromptUtils, "passwdBundle", function() {
return Services.strings.createBundle("chrome://passwordmgr/locale/passwordmgr.properties");
});
XPCOMUtils.defineLazyGetter(PromptUtils, "bundle", function () {
XPCOMUtils.defineLazyGetter(PromptUtils, "bundle", function() {
return Services.strings.createBundle("chrome://global/locale/commonDialogs.properties");
});

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

@ -1480,7 +1480,7 @@ SessionStore.prototype = {
}
// If the tab data is in the closedTabs array, remove it.
closedTabs.find(function (tabData, i) {
closedTabs.find(function(tabData, i) {
if (tabData == aCloseTabData) {
closedTabs.splice(i, 1);
return true;
@ -1554,7 +1554,7 @@ SessionStore.prototype = {
let tabs = closedTabs
.filter(tab => tab.isPrivate == isPrivate)
.map(function (tab) {
.map(function(tab) {
// Get the url and title for the current entry in the session history.
let entry = tab.entries[tab.index - 1];
return {

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

@ -24,7 +24,7 @@ let clearCookies = async function(options) {
if (options.since) {
// Convert it to microseconds
let since = options.since*1000;
let since = options.since * 1000;
// Iterate through the cookies and delete any created after our cutoff.
let cookiesEnum = cookieMgr.enumerator;
while (cookiesEnum.hasMoreElements()) {
@ -66,7 +66,7 @@ this.browsingData = class extends ExtensionAPI {
for (let item of PREF_LIST) {
// The property formData needs a different case than the
// formdata preference.
switch (item){
switch (item) {
case "formdata":
name = "formData";
break;

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

@ -26,11 +26,11 @@ function checkPrefs(key, actualValue, prefs, prefSuffix) {
is(actualValue, prefValue, `${key} property of dataToRemove matches the expected pref.`);
}
function testSettingsPreferences(dataToRemove){
function testSettingsPreferences(dataToRemove) {
let prefs = SharedPreferences.forProfile().getSetPref(PREF_DOMAIN);
for (let key of Object.keys(dataToRemove)) {
switch (key){
switch (key) {
case "formData":
checkPrefs(key, dataToRemove[key], prefs, "formdata");
break;

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

@ -8,10 +8,10 @@ this.EXPORTED_SYMBOLS = ["Accounts"];
const { utils: Cu } = Components;
Cu.import("resource://gre/modules/Deprecated.jsm"); /*global Deprecated */
Cu.import("resource://gre/modules/Messaging.jsm"); /*global Messaging */
Cu.import("resource://gre/modules/Promise.jsm"); /*global Promise */
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
Cu.import("resource://gre/modules/Deprecated.jsm"); /* global Deprecated */
Cu.import("resource://gre/modules/Messaging.jsm"); /* global Messaging */
Cu.import("resource://gre/modules/Promise.jsm"); /* global Promise */
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
/**
* A promise-based API for querying the existence of Sync accounts,
@ -33,25 +33,25 @@ Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
* );
*/
var Accounts = Object.freeze({
_accountsExist: function (kind) {
_accountsExist: function(kind) {
return EventDispatcher.instance.sendRequestForResult({
type: "Accounts:Exist",
kind: kind
}).then(data => data.exists);
},
firefoxAccountsExist: function () {
firefoxAccountsExist: function() {
return this._accountsExist("fxa");
},
syncAccountsExist: function () {
syncAccountsExist: function() {
Deprecated.warning("The legacy Sync account type has been removed from Firefox for Android. " +
"Please use `firefoxAccountsExist` instead.",
"https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/Accounts.jsm");
return Promise.resolve(false);
},
anySyncAccountsExist: function () {
anySyncAccountsExist: function() {
return this._accountsExist("any");
},
@ -65,14 +65,14 @@ var Accounts = Object.freeze({
*
* There is no return value from this method.
*/
launchSetup: function (extras) {
launchSetup: function(extras) {
EventDispatcher.instance.sendRequest({
type: "Accounts:Create",
extras: extras
});
},
_addDefaultEndpoints: function (json) {
_addDefaultEndpoints: function(json) {
let newData = Cu.cloneInto(json, {}, { cloneFunctions: false });
let associations = {
authServerEndpoint: 'identity.fxaccounts.auth.uri',
@ -94,7 +94,7 @@ var Accounts = Object.freeze({
*
* Returns a Promise that resolves to a boolean indicating success.
*/
createFirefoxAccountFromJSON: function (json) {
createFirefoxAccountFromJSON: function(json) {
return EventDispatcher.instance.sendRequestForResult({
type: "Accounts:CreateFirefoxAccountFromJSON",
json: this._addDefaultEndpoints(json)
@ -111,7 +111,7 @@ var Accounts = Object.freeze({
*
* Returns a Promise that resolves to a boolean indicating success.
*/
updateFirefoxAccountFromJSON: function (json) {
updateFirefoxAccountFromJSON: function(json) {
return EventDispatcher.instance.sendRequestForResult({
type: "Accounts:UpdateFirefoxAccountFromJSON",
json: this._addDefaultEndpoints(json)
@ -126,7 +126,7 @@ var Accounts = Object.freeze({
*
* There is no return value from this method.
*/
notifyFirefoxAccountProfileChanged: function () {
notifyFirefoxAccountProfileChanged: function() {
EventDispatcher.instance.sendRequest({
type: "Accounts:ProfileUpdated",
});
@ -138,7 +138,7 @@ var Accounts = Object.freeze({
* Returns a Promise that resolves to null if no Android Firefox Account
* exists, or an object including at least a string-valued 'email' key.
*/
getFirefoxAccount: function () {
getFirefoxAccount: function() {
return EventDispatcher.instance.sendRequestForResult({
type: "Accounts:Exist",
kind: "fxa",
@ -158,13 +158,13 @@ var Accounts = Object.freeze({
*
* Returns a Promise that resolves to a boolean indicating success.
*/
deleteFirefoxAccount: function () {
deleteFirefoxAccount: function() {
return EventDispatcher.instance.sendRequestForResult({
type: "Accounts:DeleteFirefoxAccount",
});
},
showSyncPreferences: function () {
showSyncPreferences: function() {
// Only show Sync preferences of an existing Android Account.
return Accounts.getFirefoxAccount().then(account => {
if (!account) {

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

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict"
/*globals MessageLoop */
/* globals MessageLoop */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
@ -49,7 +49,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "MessageLoop",
* InitLater(() => Bar.init(), this, "Bar");
*/
var DelayedInit = {
schedule: function (fn, object, name, maxWait) {
schedule: function(fn, object, name, maxWait) {
return Impl.scheduleInit(fn, object, name, maxWait);
},
};
@ -61,7 +61,7 @@ const MAX_IDLE_RUN_MS = 50;
var Impl = {
pendingInits: [],
onIdle: function () {
onIdle: function() {
let startTime = Cu.now();
let time = startTime;
let nextDue;
@ -92,12 +92,12 @@ var Impl = {
}
},
addPendingInit: function (fn, wait) {
addPendingInit: function(fn, wait) {
let init = {
fn: fn,
due: Cu.now() + wait,
complete: false,
maybeInit: function () {
maybeInit: function() {
if (this.complete) {
return false;
}
@ -116,7 +116,7 @@ var Impl = {
return init;
},
scheduleInit: function (fn, object, name, wait) {
scheduleInit: function(fn, object, name, wait) {
let init = this.addPendingInit(fn, wait);
if (!object || !name) {
@ -156,7 +156,7 @@ var Impl = {
}
return prop.value;
},
set: function (newVal) {
set: function(newVal) {
init.maybeInit();
// Since our initializer already ran,

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

@ -46,7 +46,7 @@ var notifications = new Map();
var DownloadNotifications = {
_notificationKey: "downloads",
init: function () {
init: function() {
Downloads.getList(Downloads.ALL)
.then(list => list.addView(this))
.then(() => this._viewAdded = true, Cu.reportError);
@ -55,7 +55,7 @@ var DownloadNotifications = {
Notifications.registerHandler(this._notificationKey, this);
},
onDownloadAdded: function (download) {
onDownloadAdded: function(download) {
// Don't create notifications for pre-existing succeeded downloads.
// We still add notifications for canceled downloads in case the
// user decides to retry the download.
@ -80,7 +80,7 @@ var DownloadNotifications = {
}
},
onDownloadChanged: function (download) {
onDownloadChanged: function(download) {
let notification = notifications.get(download);
if (download.succeeded) {
@ -108,7 +108,7 @@ var DownloadNotifications = {
}
},
onDownloadRemoved: function (download) {
onDownloadRemoved: function(download) {
let notification = notifications.get(download);
if (!notification) {
Cu.reportError("Download doesn't have a notification.");
@ -138,7 +138,7 @@ var DownloadNotifications = {
// TODO: I'm not sure what we do here...
},
showInAboutDownloads: function (download) {
showInAboutDownloads: function(download) {
let hash = "#" + window.encodeURIComponent(download.target.path);
// Force using string equality to find a tab
@ -191,7 +191,7 @@ function DownloadNotification(download) {
}
DownloadNotification.prototype = {
_updateFromDownload: function () {
_updateFromDownload: function() {
this._downloading = !this.download.stopped;
this._paused = this.download.canceled && this.download.hasPartialData;
this._succeeded = this.download.succeeded;
@ -229,12 +229,12 @@ DownloadNotification.prototype = {
return options;
},
_updateOptionsForStatic: function (options, titleName) {
_updateOptionsForStatic: function(options, titleName) {
options.title = strings.GetStringFromName(titleName);
options.message = this._fileName;
},
_updateOptionsForOngoing: function (options, buttons) {
_updateOptionsForOngoing: function(options, buttons) {
options.title = this._fileName;
options.message = this.download.progress + "%";
options.buttons = buttons;
@ -243,7 +243,7 @@ DownloadNotification.prototype = {
options.persistent = true;
},
showOrUpdate: function () {
showOrUpdate: function() {
this._updateFromDownload();
if (this._show) {
@ -263,7 +263,7 @@ DownloadNotification.prototype = {
}
},
hide: function () {
hide: function() {
if (this.id) {
Notifications.cancel(this.id);
this.id = null;
@ -272,7 +272,7 @@ DownloadNotification.prototype = {
};
var ConfirmCancelPrompt = {
show: function (download) {
show: function(download) {
// Open a prompt that offers a choice to cancel the download
let title = strings.GetStringFromName("downloadCancelPromptTitle1");
let message = strings.GetStringFromName("downloadCancelPromptMessage1");

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

@ -11,12 +11,12 @@
*/
this.EXPORTED_SYMBOLS = ["EnsureFxAccountsWebChannel"];
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; /*global Components */
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; /* global Components */
Cu.import("resource://gre/modules/Accounts.jsm"); /*global Accounts */
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
Cu.import("resource://gre/modules/WebChannel.jsm"); /*global WebChannel */
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /*global XPCOMUtils */
Cu.import("resource://gre/modules/Accounts.jsm"); /* global Accounts */
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
Cu.import("resource://gre/modules/WebChannel.jsm"); /* global WebChannel */
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
const log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccounts");
@ -33,7 +33,7 @@ const COMMAND_SYNC_PREFERENCES = "fxaccounts:sync_preferences";
const PREF_LAST_FXA_USER = "identity.fxaccounts.lastSignedInUserHash";
XPCOMUtils.defineLazyGetter(this, "strings",
() => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties")); /*global strings */
() => Services.strings.createBundle("chrome://browser/locale/aboutAccounts.properties")); /* global strings */
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt", "resource://gre/modules/Prompt.jsm");

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

@ -178,9 +178,9 @@ var HelperApps = {
let apps = [];
for (let i = 0; i < appInfo.length; i += numAttr) {
apps.push(new App({"name": appInfo[i],
"isDefault": appInfo[i+1],
"packageName": appInfo[i+2],
"activityName": appInfo[i+3]}));
"isDefault": appInfo[i + 1],
"packageName": appInfo[i + 2],
"activityName": appInfo[i + 3]}));
}
return apps;

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

@ -61,7 +61,7 @@ function BannerMessage(options) {
// private members without leaking it outside Home.jsm.
var HomeBannerMessageHandlers;
var HomeBanner = (function () {
var HomeBanner = (function() {
// Whether there is a "HomeBanner:Get" request we couldn't fulfill.
let _pendingRequest = false;
@ -190,7 +190,7 @@ var HomeBanner = (function () {
// private members without leaking it outside Home.jsm.
var HomePanelsMessageHandlers;
var HomePanels = (function () {
var HomePanels = (function() {
// Functions used to handle messages sent from Java.
HomePanelsMessageHandlers = {
@ -472,7 +472,7 @@ this.Home = Object.freeze({
panels: HomePanels,
// Lazy notification observer registered in browser.js
onEvent: function (event, data, callback) {
onEvent: function(event, data, callback) {
if (event in HomeBannerMessageHandlers) {
HomeBannerMessageHandlers[event](data);
} else if (event in HomePanelsMessageHandlers) {

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

@ -809,18 +809,18 @@ var ensureSig = function(classname_or_signature) {
var wrap = function(obj, classSig) {
if (!classSig) { return obj; }
// don't wrap primitive types.
if (classSig.charAt(0)!=='L' &&
classSig.charAt(0)!=='[') { return obj; }
var proto = registry[classSig][PREFIX+'proto'];
if (classSig.charAt(0) !== 'L' &&
classSig.charAt(0) !== '[') { return obj; }
var proto = registry[classSig][PREFIX + 'proto'];
return new proto(obj);
};
var unwrap = function(obj, opt_jenv, opt_ctype) {
if (obj && typeof(obj)==='object' && (PREFIX+'obj') in obj) {
return obj[PREFIX+'obj'];
if (obj && typeof(obj) === 'object' && (PREFIX + 'obj') in obj) {
return obj[PREFIX + 'obj'];
} else if (opt_jenv && opt_ctype) {
if (opt_ctype !== jobject)
return opt_ctype(obj); // cast to given primitive ctype
if (typeof(obj)==='string')
if (typeof(obj) === 'string')
return unwrap(JNINewString(opt_jenv, obj)); // create Java String
}
return obj;
@ -873,7 +873,7 @@ function JNIClassObj(jenv, classSig) {
// Classes get the leading & trailing chars stripped; primitives
// have to be looked up via their wrapper type.
var prim = function(ty) {
var jcls = jenvpp().FindClass(jenv, "java/lang/"+ty);
var jcls = jenvpp().FindClass(jenv, "java/lang/" + ty);
var jfld = jenvpp().GetStaticFieldID(jenv, jcls, "TYPE",
"Ljava/lang/Class;");
return jenvpp().GetStaticObjectField(jenv, jcls, jfld);
@ -901,7 +901,7 @@ function JNIClassSig(jenv, jcls) {
// API is weird. Make sure we're using slashes not dots
name = name.replace(/\./g, '/');
// special case primitives, arrays
if (name.charAt(0)==='[') return name;
if (name.charAt(0) === '[') return name;
switch (name) {
case 'void': return 'V';
case 'boolean': return 'Z';
@ -923,7 +923,7 @@ function JNIClassSig(jenv, jcls) {
// obj['toString()Ljava/lang/String'].call(obj);
var overloadFunc = function(basename) {
return function() {
return this[basename+'('+arguments.length+')'].apply(this, arguments);
return this[basename + '(' + arguments.length + ')'].apply(this, arguments);
};
};
@ -952,13 +952,13 @@ function JNILoadClass(jenv, classSig, opt_props) {
jsuper = JNIClassSig(jenv, jsuper);
}
registry[classSig] = Object.create(jsuper?ensureLoaded(jenv, jsuper):null);
registry[classSig][PREFIX+'obj'] = jcls; // global ref, persistent.
registry[classSig][PREFIX+'proto'] =
function(o) { this[PREFIX+'obj'] = o; };
registry[classSig][PREFIX+'proto'].prototype =
registry[classSig] = Object.create(jsuper ? ensureLoaded(jenv, jsuper) : null);
registry[classSig][PREFIX + 'obj'] = jcls; // global ref, persistent.
registry[classSig][PREFIX + 'proto'] =
function(o) { this[PREFIX + 'obj'] = o; };
registry[classSig][PREFIX + 'proto'].prototype =
Object.create(jsuper ?
ensureLoaded(jenv, jsuper)[PREFIX+'proto'].prototype :
ensureLoaded(jenv, jsuper)[PREFIX + 'proto'].prototype :
null);
// Add a __cast__ method to the wrapper corresponding to the class
registry[classSig].__cast__ = function(obj) {
@ -967,26 +967,26 @@ function JNILoadClass(jenv, classSig, opt_props) {
// make wrapper accessible via the classes object.
var path = sig2type(classSig).toLowerCase();
if (classSig.charAt(0)==='L') {
path = classSig.substring(1, classSig.length-1);
if (classSig.charAt(0) === 'L') {
path = classSig.substring(1, classSig.length - 1);
}
if (classSig.charAt(0)!=='[') {
if (classSig.charAt(0) !== '[') {
var root = classes, i;
var parts = path.split('/');
for (i = 0; i < parts.length-1; i++) {
for (i = 0; i < parts.length - 1; i++) {
if (!Object.hasOwnProperty.call(root, parts[i])) {
root[parts[i]] = Object.create(null);
}
root = root[parts[i]];
}
root[parts[parts.length-1]] = registry[classSig];
root[parts[parts.length - 1]] = registry[classSig];
}
}
var r = registry[classSig];
var rpp = r[PREFIX+'proto'].prototype;
var rpp = r[PREFIX + 'proto'].prototype;
if (classSig.charAt(0)==='[') {
if (classSig.charAt(0) === '[') {
// add 'length' field for arrays
Object.defineProperty(rpp, 'length', {
get: function() {
@ -1001,7 +1001,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
if (!Object.hasOwnProperty.call(registry[elemSig], 'array'))
registry[elemSig].array = r;
if (elemSig.charAt(0)==='L' || elemSig.charAt(0)==='[') {
if (elemSig.charAt(0) === 'L' || elemSig.charAt(0) === '[') {
var elemClass = unwrap(registry[elemSig]);
rpp.get = function(idx) {
@ -1013,12 +1013,12 @@ function JNILoadClass(jenv, classSig, opt_props) {
unwrap(value, jenv, jobject));
};
rpp.getElements = function(start, len) {
var i, r=[];
for (i=0; i<len; i++) { r.push(this.get(start+i)); }
var i, r = [];
for (i = 0; i < len; i++) { r.push(this.get(start + i)); }
return r;
};
rpp.setElements = function(start, vals) {
vals.forEach((v, i) => { this.set(start+i, v); });
vals.forEach((v, i) => { this.set(start + i, v); });
};
r.new = function(length) {
return wrap(jenvpp().NewObjectArray(jenv, length, elemClass, null),
@ -1026,9 +1026,9 @@ function JNILoadClass(jenv, classSig, opt_props) {
};
} else {
var ty = sig2type(elemSig), ctype = sig2ctype(elemSig);
var constructor = "New"+ty+"Array";
var getter = "Get"+ty+"ArrayRegion";
var setter = "Set"+ty+"ArrayRegion";
var constructor = "New" + ty + "Array";
var getter = "Get" + ty + "ArrayRegion";
var setter = "Set" + ty + "ArrayRegion";
rpp.get = function(idx) { return this.getElements(idx, 1)[0]; };
rpp.set = function(idx, val) { this.setElements(idx, [val]); };
rpp.getElements = function(start, len) {
@ -1052,7 +1052,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
(props.static_fields || []).forEach(function(fld) {
var jfld = jenvpp().GetStaticFieldID(jenv, jcls, fld.name, fld.sig);
var ty = sig2type(fld.sig), nm = fld.sig;
var getter = "GetStatic"+ty+"Field", setter = "SetStatic"+ty+"Field";
var getter = "GetStatic" + ty + "Field", setter = "SetStatic" + ty + "Field";
ensureLoaded(jenv, nm);
var props = {
get: function() {
@ -1071,17 +1071,17 @@ function JNILoadClass(jenv, classSig, opt_props) {
(props.static_methods || []).forEach(function(mtd) {
var jmtd = jenvpp().GetStaticMethodID(jenv, jcls, mtd.name, mtd.sig);
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1);
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')') + 1);
var ty = sig2type(returnSig), nm = returnSig;
var call = "CallStatic"+ty+"Method";
var call = "CallStatic" + ty + "Method";
ensureLoaded(jenv, nm);
r[mtd.name] = rpp[mtd.name] = overloadFunc(mtd.name);
r[mtd.name + mtd.sig] = r[mtd.name+'('+(argctypes.length-1)+')'] =
r[mtd.name + mtd.sig] = r[mtd.name + '(' + (argctypes.length - 1) + ')'] =
// add static methods to object instances, too.
rpp[mtd.name + mtd.sig] = rpp[mtd.name+'('+(argctypes.length-1)+')'] = function() {
rpp[mtd.name + mtd.sig] = rpp[mtd.name + '(' + (argctypes.length - 1) + ')'] = function() {
var i, j = jenvpp();
var args = [jenv, jcls, jmtd];
for (i=0; i<arguments.length; i++) {
for (i = 0; i < arguments.length; i++) {
args.push(unwrap(arguments[i], jenv, argctypes[i]));
}
return wrap(j[call].apply(j, args), nm);
@ -1091,13 +1091,13 @@ function JNILoadClass(jenv, classSig, opt_props) {
mtd.name = "<init>";
var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig);
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1);
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')') + 1);
r.new = overloadFunc('new');
r['new'+mtd.sig] = r['new('+(argctypes.length-1)+')'] = function() {
r['new' + mtd.sig] = r['new(' + (argctypes.length - 1) + ')'] = function() {
var i, j = jenvpp();
var args = [jenv, jcls, jmtd];
for (i=0; i<arguments.length; i++) {
for (i = 0; i < arguments.length; i++) {
args.push(unwrap(arguments[i], jenv, argctypes[i]));
}
return wrap(j.NewObject.apply(j, args), classSig);
@ -1106,7 +1106,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
(props.fields || []).forEach(function(fld) {
var jfld = jenvpp().GetFieldID(jenv, jcls, fld.name, fld.sig);
var ty = sig2type(fld.sig), nm = fld.sig;
var getter = "Get"+ty+"Field", setter = "Set"+ty+"Field";
var getter = "Get" + ty + "Field", setter = "Set" + ty + "Field";
ensureLoaded(jenv, nm);
Object.defineProperty(rpp, fld.name, {
get: function() {
@ -1122,15 +1122,15 @@ function JNILoadClass(jenv, classSig, opt_props) {
(props.methods || []).forEach(function(mtd) {
var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig);
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')')+1);
var returnSig = mtd.sig.substring(mtd.sig.indexOf(')') + 1);
var ty = sig2type(returnSig), nm = returnSig;
var call = "Call"+ty+"Method";
var call = "Call" + ty + "Method";
ensureLoaded(jenv, nm);
rpp[mtd.name] = overloadFunc(mtd.name);
rpp[mtd.name + mtd.sig] = rpp[mtd.name+'('+(argctypes.length-1)+')'] = function() {
rpp[mtd.name + mtd.sig] = rpp[mtd.name + '(' + (argctypes.length - 1) + ')'] = function() {
var i, j = jenvpp();
var args = [jenv, unwrap(this), jmtd];
for (i=0; i<arguments.length; i++) {
for (i = 0; i < arguments.length; i++) {
args.push(unwrap(arguments[i], jenv, argctypes[i]));
}
return wrap(j[call].apply(j, args), nm);

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

@ -22,20 +22,20 @@ function LightweightThemeConsumer(aDocument) {
}
LightweightThemeConsumer.prototype = {
observe: function (aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
if (aTopic == "lightweight-theme-styling-update")
this._update(JSON.parse(aData));
else if (aTopic == "lightweight-theme-apply")
this._update(LightweightThemeManager.currentThemeForDisplay);
},
destroy: function () {
destroy: function() {
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
Services.obs.removeObserver(this, "lightweight-theme-apply");
this._doc = null;
},
_update: function (aData) {
_update: function(aData) {
if (!aData)
aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };

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

@ -133,7 +133,7 @@ RemoteMedia.prototype = {
return this._status;
},
onEvent: function (event, message, callback) {
onEvent: function(event, message, callback) {
switch (event) {
case "MediaPlayer:Playing":
if (this._status !== "started") {

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

@ -238,7 +238,7 @@ var Notifications = {
}
},
QueryInterface: function (aIID) {
QueryInterface: function(aIID) {
if (!aIID.equals(Ci.nsISupports) &&
!aIID.equals(Ci.nsIObserver) &&
!aIID.equals(Ci.nsISupportsWeakReference))

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

@ -3,7 +3,7 @@
* 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/. */
/*globals LoadContextInfo, FormHistory, Accounts */
/* globals LoadContextInfo, FormHistory, Accounts */
var Cc = Components.classes;
var Ci = Components.interfaces;
@ -33,7 +33,7 @@ this.EXPORTED_SYMBOLS = ["Sanitizer"];
function Sanitizer() {}
Sanitizer.prototype = {
clearItem: function (aItemName)
clearItem: function(aItemName)
{
let item = this.items[aItemName];
let canClear = item.canClear;
@ -49,7 +49,7 @@ Sanitizer.prototype = {
items: {
cache: {
clear: function ()
clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
@ -78,7 +78,7 @@ Sanitizer.prototype = {
},
cookies: {
clear: function ()
clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
@ -138,7 +138,7 @@ Sanitizer.prototype = {
},
offlineApps: {
clear: function ()
clear: function()
{
return new Promise(function(resolve, reject) {
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
@ -158,7 +158,7 @@ Sanitizer.prototype = {
},
history: {
clear: function ()
clear: function()
{
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_HISTORY", refObj);
@ -188,7 +188,7 @@ Sanitizer.prototype = {
},
openTabs: {
clear: function ()
clear: function()
{
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_OPENWINDOWS", refObj);
@ -212,7 +212,7 @@ Sanitizer.prototype = {
},
searchHistory: {
clear: function ()
clear: function()
{
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearHistory", clearSearchHistory: true })
.catch(e => Cu.reportError("Java-side search history clearing failed: " + e))
@ -225,7 +225,7 @@ Sanitizer.prototype = {
},
formdata: {
clear: function ()
clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
@ -238,7 +238,7 @@ Sanitizer.prototype = {
});
},
canClear: function (aCallback)
canClear: function(aCallback)
{
let count = 0;
let countDone = {
@ -297,7 +297,7 @@ Sanitizer.prototype = {
},
passwords: {
clear: function ()
clear: function()
{
return new Promise(function(resolve, reject) {
Services.logins.removeAllLogins();
@ -313,7 +313,7 @@ Sanitizer.prototype = {
},
sessions: {
clear: function ()
clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
@ -338,7 +338,7 @@ Sanitizer.prototype = {
},
syncedTabs: {
clear: function ()
clear: function()
{
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearSyncedTabs" })
.catch(e => Cu.reportError("Java-side synced tabs clearing failed: " + e));

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

@ -210,7 +210,7 @@ function best(iterable, by, isBetter) {
let bestSoFar, bestKeySoFar;
let isFirst = true;
forEach(
function (item) {
function(item) {
const key = by(item);
if (isBetter(key, bestKeySoFar) || isFirst) {
bestSoFar = item;
@ -261,7 +261,7 @@ function ruleset(...rules) {
// elements. Return the knowledgebase.
//
// This is the "rank" portion of the rank-and-yank algorithm.
score: function (tree) {
score: function(tree) {
const kb = knowledgebase();
// Introduce the whole DOM into the KB as flavor 'dom' to get
@ -354,7 +354,7 @@ function knowledgebase() {
return {
// Return the "node" (our own data structure that we control) that
// corresponds to a given DOM element, creating one if necessary.
nodeForElement: function (element) {
nodeForElement: function(element) {
return getDefault(nodesByElement,
element,
() => ({element,
@ -364,17 +364,17 @@ function knowledgebase() {
// Return the highest-scored node of the given flavor, undefined if
// there is none.
max: function (flavor) {
max: function(flavor) {
const nodes = nodesByFlavor.get(flavor);
return nodes === undefined ? undefined : max(nodes, node => node.score);
},
// Let the KB know that a new flavor has been added to an element.
indexNodeByFlavor: function (node, flavor) {
indexNodeByFlavor: function(node, flavor) {
getDefault(nodesByFlavor, flavor, () => []).push(node);
},
nodesOfFlavor: function (flavor) {
nodesOfFlavor: function(flavor) {
return getDefault(nodesByFlavor, flavor, () => []);
}
};

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

@ -43,7 +43,7 @@ DispatcherDelegate.prototype = {
* @param listener Target listener implementing nsIAndroidEventListener.
* @param events String or array of strings of events to listen to.
*/
registerListener: function (listener, events) {
registerListener: function(listener, events) {
if (!this._dispatcher) {
throw new Error("Can only listen in parent process");
}
@ -56,7 +56,7 @@ DispatcherDelegate.prototype = {
* @param listener Registered listener implementing nsIAndroidEventListener.
* @param events String or array of strings of events to stop listening to.
*/
unregisterListener: function (listener, events) {
unregisterListener: function(listener, events) {
if (!this._dispatcher) {
throw new Error("Can only listen in parent process");
}
@ -72,7 +72,7 @@ DispatcherDelegate.prototype = {
* @param data Optional object containing data for the event.
* @param callback Optional callback implementing nsIAndroidEventCallback.
*/
dispatch: function (event, data, callback) {
dispatch: function(event, data, callback) {
if (this._dispatcher) {
this._dispatcher.dispatch(event, data, callback);
return;
@ -113,7 +113,7 @@ DispatcherDelegate.prototype = {
*
* @param msg Message to send; must be an object with a "type" property
*/
sendRequest: function (msg) {
sendRequest: function(msg) {
let type = msg.type;
msg.type = undefined;
this.dispatch(type, msg);
@ -125,7 +125,7 @@ DispatcherDelegate.prototype = {
* @param msg Message to send; must be an object with a "type" property
* @returns A Promise resolving to the response
*/
sendRequestForResult: function (msg) {
sendRequestForResult: function(msg) {
return new Promise((resolve, reject) => {
let type = msg.type;
msg.type = undefined;
@ -167,7 +167,7 @@ DispatcherDelegate.prototype = {
* (see example usage above).
* @param event Event name that this listener should observe.
*/
addListener: function (listener, event) {
addListener: function(listener, event) {
if (this._requestHandler.listeners[event]) {
throw new Error("Error in addListener: A listener already exists for event " + event);
}
@ -184,7 +184,7 @@ DispatcherDelegate.prototype = {
*
* @param event The event to stop listening for.
*/
removeListener: function (event) {
removeListener: function(event) {
if (!this._requestHandler.listeners[event]) {
throw new Error("Error in removeListener: There is no listener for event " + event);
}
@ -216,7 +216,7 @@ DispatcherDelegate.prototype = {
var EventDispatcher = {
instance: new DispatcherDelegate(IS_PARENT_PROCESS ? Services.androidBridge : undefined),
for: function (aWindow) {
for: function(aWindow) {
let view = aWindow && aWindow.arguments && aWindow.arguments[0] &&
aWindow.arguments[0].QueryInterface(Ci.nsIAndroidView);
@ -232,11 +232,11 @@ var EventDispatcher = {
return new DispatcherDelegate(view);
},
forMessageManager: function (aMessageManager) {
forMessageManager: function(aMessageManager) {
return new DispatcherDelegate(null, aMessageManager);
},
receiveMessage: function (aMsg) {
receiveMessage: function(aMsg) {
// aMsg.data includes keys: global, event, data, uuid
let callback;
if (aMsg.data.uuid) {

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

@ -78,7 +78,7 @@ function makeObserver(observerId) {
id: observerId,
count: 0,
promise: deferred.promise,
observe: function (subject, topic, data) {
observe: function(subject, topic, data) {
ret.count += 1;
let msg = { subject: subject,
topic: topic,

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

@ -28,8 +28,8 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
is(anyExists, firefoxExists || syncExists, "sync/firefox account existence consistent with any existence");
// TODO: How can this be cleaned up?
//info("Launching setup.\n");
//Accounts.launchSetup();
// info("Launching setup.\n");
// Accounts.launchSetup();
});
</script>

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

@ -12,7 +12,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
/*globals AndroidLog */
/* globals AndroidLog */
const TAG = "AndroidLogTest";

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

@ -90,14 +90,14 @@
Services.obs.notifyObservers(null, "child-gc-request");
if (schedGC) {
schedGC.call(Cu, { callback: function () {
runSoon(function () { cc(); runSoon(minimizeInner); });
schedGC.call(Cu, { callback: function() {
runSoon(function() { cc(); runSoon(minimizeInner); });
} });
} else {
if (domWindowUtils.garbageCollect) {
domWindowUtils.garbageCollect();
}
runSoon(function () { cc(); runSoon(minimizeInner); });
runSoon(function() { cc(); runSoon(minimizeInner); });
}
} else {
runSoon(aCallback);
@ -211,7 +211,7 @@
var result = gResults[i];
logsum += Math.log(result[aProperty]);
}
return Math.round(Math.exp(logsum/gResults.length));
return Math.round(Math.exp(logsum / gResults.length));
}
function finalReport() {
@ -229,7 +229,7 @@
perfherder += `{\"name\": \"${result.name}\", \"value\": ${result.resident}}`;
}
perfherder += "], "; // end subtests
perfherder += "\"value\": "+geomean("resident");
perfherder += "\"value\": " + geomean("resident");
perfherder += "}"; // end Resident Memory suite
perfherder += "]"; // end suites
perfherder += "}"; // end PERFHERDER_DATA

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

@ -26,13 +26,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1178722
let SelectHelper = sandbox.SelectHelper;
// Returns whether an element should be visible according to its text content.
function shouldBeVisible(e){
function shouldBeVisible(e) {
return e.label.indexOf("visible") > 0;
}
// Returns an object for the callback method that would normally be created by Prompt.java's
// addListResult(..) method.
function createCallBackDummyData(select){
function createCallBackDummyData(select) {
var dummyList = [];
let listElements = SelectHelper.getListForElement(select);
for (var i = 0; i < listElements.length; i++) {
@ -43,7 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1178722
// Wait until the page has loaded so that we can access the DOM.
SimpleTest.waitForExplicitFinish();
window.onload = function () {
window.onload = function() {
let select = document.getElementById("sample-select");
// ##############################################

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

@ -75,7 +75,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
ok((yield db.tableExists("items")), "items table exists");
// Make sure the correct values for the item ended up in there.
let result = yield db.execute("SELECT * FROM items", null, function onRow(row){
let result = yield db.execute("SELECT * FROM items", null, function onRow(row) {
is(row.getResultByName("dataset_id"), TEST_DATASET_ID, "expected dataset ID");
is(row.getResultByName("url"), TEST_URL, "expected test url");
is(row.getResultByName("background_url"), TEST_BACKGROUND_URL, "expected background url");

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

@ -15,9 +15,9 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Promise.jsm"); /*global Promise */
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
Cu.import("resource://gre/modules/NetUtil.jsm"); /*global NetUtil */
Cu.import("resource://gre/modules/Promise.jsm"); /* global Promise */
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
Cu.import("resource://gre/modules/NetUtil.jsm"); /* global NetUtil */
function readChannel(url) {
let deferred = Promise.defer();

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

@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1263589
// Wait until the page has loaded so that we can access the DOM.
SimpleTest.waitForExplicitFinish();
window.onload = function () {
window.onload = function() {
// test options are not incorrectly disabled...
let isEnabled1 = document.getElementById("is_enabled_1");
let isEnabled2 = document.getElementById("is_enabled_2");

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

@ -14,7 +14,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
"use strict";
/*globals SimpleServiceDiscovery */
/* globals SimpleServiceDiscovery */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

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

@ -14,7 +14,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
"use strict";
/*globals SimpleServiceDiscovery */
/* globals SimpleServiceDiscovery */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;

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

@ -13,14 +13,14 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; /*global Components */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components; /* global Components */
Cu.import("resource://gre/modules/Promise.jsm"); /*global Promise */
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /*global XPCOMUtils */
Cu.import("resource://gre/modules/Task.jsm"); /*global Task */
Cu.import("resource://gre/modules/Promise.jsm"); /* global Promise */
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
Cu.import("resource://gre/modules/Task.jsm"); /* global Task */
XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
"resource://gre/modules/WebChannel.jsm"); /*global WebChannel */
"resource://gre/modules/WebChannel.jsm"); /* global WebChannel */
const HTTP_PATH = "http://mochi.test:8888";
const HTTP_ENDPOINT = "/chrome/mobile/android/tests/browser/chrome/web_channel.html";
@ -40,7 +40,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
return new Promise(function(resolve, reject) {
let tab;
let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH));
channel.listen(function (id, message, target) {
channel.listen(function(id, message, target) {
is(id, "generic");
is(message.something.nested, "hello");
channel.stopListening();
@ -59,7 +59,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
let tab;
let channel = new WebChannel("twoway", Services.io.newURI(HTTP_PATH));
channel.listen(function (id, message, sender) {
channel.listen(function(id, message, sender) {
is(id, "twoway");
ok(message.command);
@ -86,7 +86,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
let tab;
let channel = new WebChannel("multichannel", Services.io.newURI(HTTP_PATH));
channel.listen(function (id, message, sender) {
channel.listen(function(id, message, sender) {
is(id, "multichannel");
BrowserApp.closeTab(tab);
resolve();

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

@ -356,15 +356,15 @@ make -f client.mk build
<script src="../../media/js/wiki-min.js%3Fbuild=f424781"></script>
<script type="text/javascript">
//<![CDATA[
var _tag=new WebTrends();
// <![CDATA[
var _tag = new WebTrends();
_tag.dcsGetId();
//]]>>
// ]]>>
</script>
<script type="text/javascript">
//<![CDATA[
// <![CDATA[
_tag.dcsCollect();
//]]>>
// ]]>>
</script>
<noscript>
<div><img alt="DCSIMG" id="DCSIMG" width="1" height="1" src="../../../statse.webtrendslive.com/dcs8yrjuavz5bdaun34r2o8bi_8o8x/njs.gif%3Fdcsuri=%252Fnojavascript&amp;WT.js=No&amp;WT.tv=8.6.2"/></div>

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

@ -170,7 +170,7 @@ function _dump_exception_stack(stack) {
});
}
/************** Functions to be used from the tests **************/
/** ************ Functions to be used from the tests **************/
/**
* Prints a message to the output log.
@ -291,7 +291,7 @@ function _do_check_neq(left, right, stack, todo) {
do_throw(text, stack);
} else {
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
" : " + stack.lineNumber + "] " + text +"\n");
" : " + stack.lineNumber + "] " + text + "\n");
}
} else {
if (!todo) {
@ -328,7 +328,7 @@ function do_report_result(passed, text, stack, todo) {
} else {
if (todo) {
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
" : " + stack.lineNumber + "] " + text +"\n");
" : " + stack.lineNumber + "] " + text + "\n");
} else {
do_throw(text, stack);
}
@ -400,11 +400,11 @@ function todo_check_false(condition, stack) {
todo_check_eq(condition, false, stack);
}
function do_check_null(condition, stack=Components.stack.caller) {
function do_check_null(condition, stack = Components.stack.caller) {
do_check_eq(condition, null, stack);
}
function todo_check_null(condition, stack=Components.stack.caller) {
function todo_check_null(condition, stack = Components.stack.caller) {
todo_check_eq(condition, null, stack);
}
@ -475,7 +475,7 @@ function todo_check_null(condition, stack=Components.stack.caller) {
* is ideal. If you do want to be more careful, you can use function
* patterns to implement more stringent checks.
*/
function do_check_matches(pattern, value, stack=Components.stack.caller, todo=false) {
function do_check_matches(pattern, value, stack = Components.stack.caller, todo = false) {
var matcher = pattern_matcher(pattern);
var text = "VALUE: " + uneval(value) + "\nPATTERN: " + uneval(pattern) + "\n";
var diagnosis = []
@ -490,7 +490,7 @@ function do_check_matches(pattern, value, stack=Components.stack.caller, todo=fa
}
}
function todo_check_matches(pattern, value, stack=Components.stack.caller) {
function todo_check_matches(pattern, value, stack = Components.stack.caller) {
do_check_matches(pattern, value, stack, true);
}
@ -522,7 +522,7 @@ function pattern_matcher(pattern) {
if (ld && !ld.enumerable) {
matchers.push(['length', pattern_matcher(pattern.length)])
}
return function (value, diagnosis) {
return function(value, diagnosis) {
if (!(value && typeof value == "object")) {
return explain(diagnosis, "value not object");
}
@ -538,7 +538,7 @@ function pattern_matcher(pattern) {
} else if (pattern === undefined) {
return function(value) { return true; };
} else {
return function (value, diagnosis) {
return function(value, diagnosis) {
if (value !== pattern) {
return explain(diagnosis, "pattern " + uneval(pattern) + " not === to value " + uneval(value));
}
@ -549,7 +549,7 @@ function pattern_matcher(pattern) {
// Format an explanation for a pattern match failure, as stored in the
// second argument to a matching function.
function format_pattern_match_failure(diagnosis, indent="") {
function format_pattern_match_failure(diagnosis, indent = "") {
var a;
if (!diagnosis) {
a = "Matcher did not explain reason for mismatch.";
@ -785,7 +785,7 @@ JavaBridge.prototype = {
_EventDispatcher: Components.utils.import(
"resource://gre/modules/Messaging.jsm", {}).EventDispatcher.instance,
_getArgs: function (args) {
_getArgs: function(args) {
let out = {
length: Math.max(0, args.length - 1),
};
@ -795,7 +795,7 @@ JavaBridge.prototype = {
return out;
},
_sendMessage: function (innerType, args) {
_sendMessage: function(innerType, args) {
this._EventDispatcher.dispatch(this._JAVA_EVENT_TYPE, {
innerType: innerType,
method: args[0],
@ -828,7 +828,7 @@ JavaBridge.prototype = {
* Synchronously call a method in Java,
* given the method name followed by a list of arguments.
*/
syncCall: function (methodName /*, ... */) {
syncCall: function(methodName /* , ... */) {
this._sendMessage("sync-call", arguments);
let thread = this._Services.tm.currentThread;
let initialReplies = this._repliesNeeded;
@ -845,14 +845,14 @@ JavaBridge.prototype = {
* Asynchronously call a method in Java,
* given the method name followed by a list of arguments.
*/
asyncCall: function (methodName /*, ... */) {
asyncCall: function(methodName /* , ... */) {
this._sendMessage("async-call", arguments);
},
/**
* Disconnect with Java.
*/
disconnect: function () {
disconnect: function() {
this._EventDispatcher.unregisterListener(this, this._EVENT_TYPE);
},
};

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

@ -1,8 +1,8 @@
<html>
<script>
function login(){
document.login.username.value="Test1";
document.login.password.value="Test2";
function login() {
document.login.username.value = "Test1";
document.login.password.value = "Test2";
document.getElementById('submit').click();
}
</script>

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

@ -1,8 +1,8 @@
<html>
<script>
function login(){
document.login.username.value="Test2";
document.login.password.value="Test2";
function login() {
document.login.username.value = "Test2";
document.login.password.value = "Test2";
document.getElementById('submit').click();
}
</script>

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

@ -58,7 +58,7 @@ function testOneFile(uri) {
// Output from head.js is fed, line by line, to this function. We
// send any such output back to the Java Robocop harness.
testScope.dump = function (str) {
testScope.dump = function(str) {
let message = { type: "Robocop:Java",
innerType: "progress",
message: str,

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

@ -39,7 +39,7 @@ function startup(aData, aReason) {
// Load into any new windows
wm.addListener(windowListener);
EventDispatcher.instance.registerListener(function (event, data, callback) {
EventDispatcher.instance.registerListener(function(event, data, callback) {
dump("Robocop:Quit received -- requesting quit");
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
appStartup.quit(Ci.nsIAppStartup.eForceQuit);

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

@ -120,7 +120,7 @@ function check_response(key, response) {
}
let listener = {
_checkObject: function (obj) {
_checkObject: function(obj) {
do_check_eq(obj.boolean, true);
do_check_eq(obj.booleanArray.length, 2);
do_check_eq(obj.booleanArray[0], false);
@ -163,7 +163,7 @@ let listener = {
do_check_eq(obj.mixedArray[1], 1.5);
},
onEvent: function (event, data, callback) {
onEvent: function(event, data, callback) {
do_check_eq(event, this._type);
this._callCount++;
@ -186,7 +186,7 @@ let listener = {
};
let callbackListener = {
onEvent: function (event, data, callback) {
onEvent: function(event, data, callback) {
do_check_eq(event, this._type);
this._callCount++;

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

@ -17,7 +17,7 @@ function sleep(wait) {
return new Promise((resolve, reject) => {
do_print("sleep start");
gTimer.initWithCallback({
notify: function () {
notify: function() {
do_print("sleep end");
resolve();
},
@ -25,7 +25,7 @@ function sleep(wait) {
});
}
function promiseLoadEvent(browser, url, eventType="load") {
function promiseLoadEvent(browser, url, eventType = "load") {
return new Promise((resolve, reject) => {
do_print("Wait browser event: " + eventType);

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

@ -3,7 +3,7 @@
* 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/. */
/*globals ReaderMode */
/* globals ReaderMode */
var { utils: Cu } = Components;

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

@ -14,7 +14,7 @@ add_task(function* test_snackbar_api() {
Snackbars.show("This is a Snackbar", Snackbars.LENGTH_INDEFINITE, {
action: {
label: "Click me",
callback: function () {}
callback: function() {}
}
});

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

@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Messaging.jsm");
function promiseLoadEvent(browser, url, eventType="load", runBeforeLoad) {
function promiseLoadEvent(browser, url, eventType = "load", runBeforeLoad) {
return new Promise((resolve, reject) => {
do_print("Wait browser event: " + eventType);

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

@ -92,7 +92,7 @@ add_test(function test_telemetry_events() {
let obs = getObserver();
let measurements = removeNonTestMeasurements(obs.getUIMeasurements(clearMeasurements));
measurements.forEach(function (m, i) {
measurements.forEach(function(m, i) {
if (m.type === "event") {
m.sessions = removeNonTestSessions(m.sessions);
m.sessions.sort(); // Mutates.
@ -101,7 +101,7 @@ add_test(function test_telemetry_events() {
do_check_measurement_eq(expected[i], m);
});
expected.forEach(function (m, i) {
expected.forEach(function(m, i) {
do_check_measurement_eq(m, measurements[i]);
});
@ -113,7 +113,7 @@ add_test(function test_telemetry_events() {
* for less typing when initializing the expected arrays.
*/
function expectedArraysToObjs(expectedArrays) {
return expectedArrays.map(function (arr) {
return expectedArrays.map(function(arr) {
let type = arr[0];
if (type === "event") {
return {
@ -135,7 +135,7 @@ function expectedArraysToObjs(expectedArrays) {
}
function removeNonTestMeasurements(measurements) {
return measurements.filter(function (measurement) {
return measurements.filter(function(measurement) {
if (measurement.type === "event") {
return measurement.action.startsWith("_test_event_");
} else if (measurement.type === "session") {
@ -146,7 +146,7 @@ function removeNonTestMeasurements(measurements) {
}
function removeNonTestSessions(sessions) {
return sessions.filter(function (sessionName) {
return sessions.filter(function(sessionName) {
return sessionName.startsWith("_test_session_");
});
}

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

@ -15,7 +15,7 @@ var isResetDone;
function getAsyncClientId() {
isClientIDSet = false;
ClientID.getClientID().then(function (retClientID) {
ClientID.getClientID().then(function(retClientID) {
// Ideally, we'd directly send the client ID back to Java but Java won't listen for
// js messages after we return from the containing function (bug 1253467).
//
@ -23,7 +23,7 @@ function getAsyncClientId() {
// working failed - I have other things to focus on.
clientID = retClientID;
isClientIDSet = true;
}, function (fail) {
}, function(fail) {
// Since Java doesn't listen to our messages (bug 1253467), I don't expect
// this throw to work correctly but we should timeout in Java.
do_throw('Could not retrieve client ID: ' + fail);
@ -36,7 +36,7 @@ function pollGetAsyncClientId() {
function getAsyncReset() {
isResetDone = false;
ClientID._reset().then(function () {
ClientID._reset().then(function() {
isResetDone = true;
});
}