--- a/mobile/android/.eslintrc.js
+++ b/mobile/android/.eslintrc.js
@@ -23,14 +23,10 @@ module.exports = {
"no-redeclare": "off",
"no-useless-call": "off",
"no-useless-concat": "off",
"no-useless-return": "off",
"no-undef": "off",
"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",
}
};
--- a/mobile/android/chrome/content/CastingApps.js
+++ b/mobile/android/chrome/content/CastingApps.js
@@ -118,17 +118,17 @@ var CastingApps = {
serviceLost: function(aService) {
},
isCastingEnabled: function isCastingEnabled() {
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") {
this.session.remoteMedia.play();
}
break;
case "Casting:Pause":
if (this.session && this.session.remoteMedia.status == "started") {
@@ -138,17 +138,17 @@ var CastingApps = {
case "Casting:Stop":
if (this.session) {
this.closeExternal();
}
break;
}
},
- observe: function (aSubject, aTopic, aData) {
+ observe: function(aSubject, aTopic, aData) {
switch (aTopic) {
case "ssdp-service-found":
this.serviceAdded(SimpleServiceDiscovery.findServiceForID(aData));
break;
case "ssdp-service-lost":
this.serviceLost(SimpleServiceDiscovery.findServiceForID(aData));
break;
case "application-background":
--- a/mobile/android/chrome/content/EmbedRT.js
+++ b/mobile/android/chrome/content/EmbedRT.js
@@ -8,17 +8,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
/*
* Collection of methods and features specific to using a GeckoView instance.
* The code is isolated from browser.js for code size and performance reasons.
*/
var EmbedRT = {
_scopes: {},
- onEvent: function (event, data, callback) {
+ onEvent: function(event, data, callback) {
switch (event) {
case "GeckoView:ImportScript":
this.importScript(data.scriptURL);
break;
}
},
/*
--- a/mobile/android/chrome/content/Linkify.js
+++ b/mobile/android/chrome/content/Linkify.js
@@ -10,17 +10,17 @@ function Linkifier() {
}
Linkifier.prototype = {
_buildAnchor: function(aDoc, aNumberText) {
let anchorNode = aDoc.createElement("a");
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);
let nodeText = aDoc.createTextNode(aNumberText);
anchorNode.appendChild(nodeText);
return anchorNode;
},
@@ -43,17 +43,17 @@ Linkifier.prototype = {
if (textExistsBeforeNumber)
nodeToAdd = aDoc.createTextNode(nodeText.substr(startIndex, m.index - startIndex));
else
nodeToAdd = anchorNode;
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);
// next nodes need to be appended to this node.
prevNode = anchorNode;
startIndex = m.index + m[0].length;
}
@@ -69,17 +69,17 @@ Linkifier.prototype = {
linkifyNumbers: function(aDoc) {
// Removing any installed timer in case the page has changed and a previous timer is still running.
if (this._linkifyTimer) {
clearTimeout(this._linkifyTimer);
this._linkifyTimer = null;
}
- let filterNode = function (node) {
+ let filterNode = function(node) {
if (node.parentNode.tagName != 'A' &&
node.parentNode.tagName != 'SCRIPT' &&
node.parentNode.tagName != 'NOSCRIPT' &&
node.parentNode.tagName != 'STYLE' &&
node.parentNode.tagName != 'APPLET' &&
node.parentNode.tagName != 'TEXTAREA')
return NodeFilter.FILTER_ACCEPT;
else
--- a/mobile/android/chrome/content/PluginHelper.js
+++ b/mobile/android/chrome/content/PluginHelper.js
@@ -115,38 +115,38 @@ var PluginHelper = {
case "2": // Enable Plugins = Tap to Play (default)
Services.prefs.clearUserPref("plugin.disable");
Services.prefs.clearUserPref("plugin.default.state");
break;
}
},
// 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
// the bottom causes scrollHeight to be larger than it should be.
let overflows = (overlay.scrollWidth > pluginRect.width) ||
(overlay.scrollHeight - 5 > pluginRect.height);
return overflows;
},
- getPluginMimeType: function (plugin) {
+ getPluginMimeType: function(plugin) {
var tagMimetype = plugin.actualType;
if (tagMimetype == "") {
tagMimetype = plugin.type;
}
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");
if (!overlay || overlay._bindingHandled) {
return;
}
overlay._bindingHandled = true;
--- a/mobile/android/chrome/content/PrintHelper.js
+++ b/mobile/android/chrome/content/PrintHelper.js
@@ -2,17 +2,17 @@
/* 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";
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) {
case "Print:PDF":
this.generatePDF(browser).then((data) => callback.onSuccess(data),
(error) => callback.onError(error));
break;
}
@@ -53,16 +53,16 @@ var PrintHelper = {
if (Components.isSuccessCode(status)) {
// Send the details to Java
resolve({ file: file.path, title: fileName });
} else {
reject();
}
}
},
- onProgressChange: function () {},
- onLocationChange: function () {},
- onStatusChange: function () {},
- onSecurityChange: function () {},
+ onProgressChange: function() {},
+ onLocationChange: function() {},
+ onStatusChange: function() {},
+ onSecurityChange: function() {},
});
});
}
};
--- a/mobile/android/chrome/content/Reader.js
+++ b/mobile/android/chrome/content/Reader.js
@@ -2,17 +2,17 @@
/* 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";
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.
STATUS_UNFETCHED: 0,
STATUS_FETCH_FAILED_TEMPORARY: 1,
STATUS_FETCH_FAILED_PERMANENT: 2,
STATUS_FETCH_FAILED_UNSUPPORTED_FORMAT: 3,
STATUS_FETCHED_ARTICLE: 4,
@@ -198,17 +198,17 @@ var Reader = {
this._sendMmaEvent("reader_available");
} else {
UITelemetry.addEvent("show.1", "button", null, "reader_unavailable");
}
},
_sendMmaEvent: function(event) {
WindowEventDispatcher.sendRequest({
- type: "Mma:"+event,
+ type: "Mma:" + event,
});
},
_showSystemUI: function(visibility) {
WindowEventDispatcher.sendRequest({
type: "SystemUI:Visibility",
visible: visibility
});
--- a/mobile/android/chrome/content/WebrtcUI.js
+++ b/mobile/android/chrome/content/WebrtcUI.js
@@ -124,27 +124,27 @@ var WebrtcUI = {
},
handleGumRequest: function handleGumRequest(aSubject, aTopic, aData) {
let constraints = aSubject.getConstraints();
let contentWindow = Services.wm.getOuterWindowWithId(aSubject.windowID);
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);
return;
}
WebrtcUI.prompt(contentWindow, aSubject.callID, constraints.audio,
constraints.video, devices);
},
- function (error) {
+ function(error) {
Cu.reportError(error);
},
aSubject.innerWindowID,
aSubject.callID);
},
getDeviceButtons: function(audioDevices, videoDevices, aCallID, aUri) {
return [{
@@ -209,17 +209,17 @@ var WebrtcUI = {
let defaultCount = 0;
return aDevices.map(function(device) {
// if this is a Camera input, convert the name to something readable
let res = /Camera\ \d+,\ Facing (front|back)/.exec(device.name);
if (res)
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++;
return Strings.browser.formatStringFromName("getUserMedia." + aType + ".default", [defaultCount], 1);
}
return device.name
}, this);
},
--- a/mobile/android/chrome/content/aboutAccounts.js
+++ b/mobile/android/chrome/content/aboutAccounts.js
@@ -19,22 +19,22 @@
* WebChannel LOADED messages produced by multiple about:accounts tabs.)
*
* We capture error conditions by accessing the inner nsIWebNavigation of the
* iframe directly.
*/
"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";
const COMMAND_LOADED = "fxaccounts:loaded";
const log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccounts");
XPCOMUtils.defineLazyServiceGetter(this, "ParentalControls",
@@ -83,17 +83,17 @@ function handleLoadedMessage(message) {
loadedDeferred.resolve();
};
var wrapper = {
iframe: null,
url: null,
- init: function (url) {
+ init: function(url) {
this.url = url;
deferTransitionToRemoteAfterLoaded();
let iframe = document.getElementById("remote");
this.iframe = iframe;
this.iframe.QueryInterface(Ci.nsIFrameLoaderOwner);
let docShell = this.iframe.frameLoader.docShell;
docShell.QueryInterface(Ci.nsIWebProgress);
@@ -102,17 +102,17 @@ var wrapper = {
Ci.nsIWebProgress.NOTIFY_LOCATION);
// Set the iframe's location with loadURI/LOAD_FLAGS_BYPASS_HISTORY to
// avoid having a new history entry being added.
let webNav = iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
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);
webNav.loadURI(this.url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
},
iframeListener: {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWebProgressListener,
--- a/mobile/android/chrome/content/aboutAddons.js
+++ b/mobile/android/chrome/content/aboutAddons.js
@@ -1,15 +1,15 @@
/* 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";
-/*globals gChromeWin */
+/* globals gChromeWin */
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm")
Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const AMO_ICON = "chrome://browser/skin/images/amo-logo.png";
@@ -81,22 +81,22 @@ var ContextMenus = {
}
},
enable: function(event) {
Addons.setEnabled(true, this.target.addon);
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;
}
}
function init() {
window.addEventListener("popstate", onPopState);
@@ -279,17 +279,17 @@ var Addons = {
AddonManager.getAllAddons(function(aAddons) {
// Clear all content before filling the addons
let list = document.getElementById("addons-list");
list.innerHTML = "";
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;
let item = self._createItemForAddon(aAddons[i]);
list.appendChild(item);
}
--- a/mobile/android/chrome/content/aboutDownloads.js
+++ b/mobile/android/chrome/content/aboutDownloads.js
@@ -26,17 +26,17 @@ function deleteDownload(download) {
}
});
}
var contextMenu = {
_items: [],
_targetDownload: null,
- init: function () {
+ init: function() {
let element = document.getElementById("downloadmenu");
element.addEventListener("click",
event => event.download = this._targetDownload,
true);
this._items = [
new ContextMenuItem("open",
download => download.succeeded,
download => download.launch().catch(Cu.reportError)),
@@ -67,21 +67,21 @@ var contextMenu = {
}),
// following menu item is a global action
new ContextMenuItem("removeall",
() => downloadLists.finished.length > 0,
() => downloadLists.removeFinished())
];
},
- 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;
}
if (!target) {
Cu.reportError("No download found for context menu target");
event.preventDefault();
return;
@@ -98,17 +98,17 @@ var contextMenu = {
function ContextMenuItem(name, isVisible, action) {
this.element = document.getElementById("contextmenu-" + name);
this.isVisible = isVisible;
this.element.addEventListener("click", event => action(event.download));
}
ContextMenuItem.prototype = {
- updateVisibility: function (download) {
+ updateVisibility: function(download) {
this.element.hidden = !this.isVisible(download);
}
};
function DownloadListView(type, listElementId) {
this.listElement = document.getElementById(listElementId);
contextMenu.addContextMenuEventListener(this.listElement);
@@ -132,54 +132,54 @@ DownloadListView.prototype = {
if (download.stopped && (!download.hasPartialData || download.error)) {
finished.push(download);
}
}
return finished;
},
- insertOrMoveItem: function (item) {
+ insertOrMoveItem: function(item) {
var compare = (a, b) => {
// active downloads always before stopped downloads
if (a.stopped != b.stopped) {
return b.stopped ? -1 : 1
}
// most recent downloads first
return b.startTime - a.startTime;
};
let insertLocation = this.listElement.firstChild;
while (insertLocation && compare(item.download, insertLocation.download) > 0) {
insertLocation = insertLocation.nextElementSibling;
}
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");
return;
}
if (item.stateChanged) {
this.insertOrMoveItem(item);
}
item.onDownloadChanged();
},
- onDownloadRemoved: function (download) {
+ onDownloadRemoved: function(download) {
let item = this.items.get(download);
if (!item) {
Cu.reportError("No DownloadItem found for download");
return;
}
this.items.delete(download);
this.listElement.removeChild(item.element);
@@ -187,26 +187,26 @@ DownloadListView.prototype = {
EventDispatcher.instance.sendRequest({
type: "Download:Remove",
path: download.target.path
});
}
};
var downloadLists = {
- init: function () {
+ init: function() {
this.publicDownloads = new DownloadListView(Downloads.PUBLIC, "public-downloads-list");
this.privateDownloads = new DownloadListView(Downloads.PRIVATE, "private-downloads-list");
},
get finished() {
return this.publicDownloads.finished.concat(this.privateDownloads.finished);
},
- removeFinished: function () {
+ removeFinished: function() {
let finished = this.finished;
if (finished.length == 0) {
return;
}
let title = strings.GetStringFromName("downloadAction.deleteAll");
let messageForm = strings.GetStringFromName("downloadMessage.deleteAll");
let message = PluralForm.get(finished.length, messageForm).replace("#1", finished.length);
@@ -239,26 +239,26 @@ const kDownloadStatePropertyNames = [
"stopped",
"succeeded",
"canceled",
"error",
"startTime"
];
DownloadItem.prototype = {
- _htmlEscape: function (s) {
+ _htmlEscape: function(s) {
s = s.replace(/&/g, "&");
s = s.replace(/>/g, ">");
s = s.replace(/</g, "<");
s = s.replace(/"/g, """);
s = s.replace(/'/g, "'");
return s;
},
- _updateFromDownload: function () {
+ _updateFromDownload: function() {
this._state = {};
kDownloadStatePropertyNames.forEach(
name => this._state[name] = this._download[name],
this);
},
get stateChanged() {
return kDownloadStatePropertyNames.some(
@@ -290,32 +290,32 @@ DownloadItem.prototype = {
element.download = this.download;
// fill in template placeholders
this.updateElement(element);
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;
element.querySelector(".size").textContent = this.size;
element.querySelector(".state").textContent = this.stateDescription;
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);
},
// template properties below
get domain() {
return this._domain;
},
--- a/mobile/android/chrome/content/aboutHealthReport.js
+++ b/mobile/android/chrome/content/aboutHealthReport.js
@@ -27,120 +27,120 @@ const WRAPPER_VERSION = 1;
const EVENT_HEALTH_REQUEST = "HealthReport:Request";
const EVENT_HEALTH_RESPONSE = "HealthReport:Response";
// about:healthreport prefs are stored in Firefox's default Android
// SharedPreferences.
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();
iframe.src = report.spec;
console.log("AboutHealthReport: loading content from " + report.spec);
sharedPrefs.addObserver(PREF_UPLOAD_ENABLED, this);
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) {
this.updatePayload(data);
}
},
- 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);
uri.query += ((uri.query != "") ? "&v=" : "v=") + WRAPPER_VERSION;
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 = {
enabled: sharedPrefs.getBoolPref(PREF_UPLOAD_ENABLED),
};
this.injectData("prefs", prefs);
} catch (e) {
this.reportFailure(this.ERROR_PREFS_FAILED);
}
},
- 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.
console.log("AboutHealthReport: sending payload to page " +
"(" + 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
// this special case. In all other cases, pass in the URL to the
// report so we properly restrict the message dispatch.
let reportUrl = (report.scheme == "file") ? "*" : report.spec;
let data = {
type: type,
content: content,
};
let iframe = document.getElementById("remote-report");
iframe.contentWindow.postMessage(data, reportUrl);
},
- showSettings: function () {
+ showSettings: function() {
console.log("AboutHealthReport: showing settings.");
EventDispatcher.instance.sendRequest({
type: "Settings:Show",
resource: "preferences_privacy",
});
},
- 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();
break;
case "EnableDataSubmission":
this.onOptIn();
break;
case "RequestCurrentPrefs":
@@ -157,38 +157,38 @@ var healthReportWrapper = {
break;
default:
Cu.reportError("Unexpected remote command received: " + evt.detail.command +
". Ignoring command.");
break;
}
},
- initRemotePage: function () {
+ initRemotePage: function() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); });
healthReportWrapper.injectData("begin", null);
},
// error handling
ERROR_INIT_FAILED: 1,
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);
},
};
window.addEventListener("load", healthReportWrapper.init.bind(healthReportWrapper));
window.addEventListener("unload", healthReportWrapper.uninit.bind(healthReportWrapper));
--- a/mobile/android/chrome/content/aboutLogins.js
+++ b/mobile/android/chrome/content/aboutLogins.js
@@ -1,15 +1,15 @@
/* 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/. */
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");
XPCOMUtils.defineLazyGetter(window, "gChromeWin", () =>
window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
@@ -146,17 +146,17 @@ var Logins = {
contentBody.classList.add("hidden");
loadingBody.classList.remove("hidden");
} else {
loadingBody.classList.add("hidden");
contentBody.classList.remove("hidden");
}
},
- init: function () {
+ init: function() {
window.addEventListener("popstate", this);
Services.obs.addObserver(this, "passwordmgr-storage-changed");
document.getElementById("update-btn").addEventListener("click", this._onSaveEditLogin.bind(this));
document.getElementById("password-btn").addEventListener("click", this._onPasswordBtn.bind(this));
let filterInput = document.getElementById("filter-input");
let filterContainer = document.getElementById("filter-input-container");
@@ -197,56 +197,56 @@ var Logins = {
this._showList();
this._updatePasswordBtn(true);
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);
logins.forEach(login => {
let item = this._createItemForLogin(login);
newList.appendChild(item);
});
list.parentNode.replaceChild(newList, list);
},
- _showList: function () {
+ _showList: function() {
let loginsListPage = document.getElementById("logins-list-page");
loginsListPage.classList.remove("hidden");
let editLoginPage = document.getElementById("edit-login-page");
editLoginPage.classList.add("hidden");
// If the Show/Hide password button has been flipped, reset it
if (this._isPasswordBtnInHideMode()) {
this._updatePasswordBtn(true);
}
},
- _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);
} else {
this._selectedLogin = null;
this._showList();
}
},
- _showEditLoginDialog: function (login) {
+ _showEditLoginDialog: function(login) {
let listPage = document.getElementById("logins-list-page");
listPage.classList.add("hidden");
let editLoginPage = document.getElementById("edit-login-page");
editLoginPage.classList.remove("hidden");
let usernameField = document.getElementById("username");
usernameField.value = login.username;
@@ -313,37 +313,37 @@ var Logins = {
} catch (e) {
Snackbars.show(gStringBundle.GetStringFromName("editLogin.couldNotSave"), Snackbars.LENGTH_LONG);
return;
}
Snackbars.show(gStringBundle.GetStringFromName("editLogin.saved1"), Snackbars.LENGTH_LONG);
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");
let hide = gStringBundle.GetStringFromName("password-btn.hide");
if (aShouldShow) {
passwordField.type = "password";
button.textContent = show;
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");
},
_showPassword: function(password) {
let passwordPrompt = new Prompt({
window: window,
message: password,
@@ -354,17 +354,17 @@ var Logins = {
switch (data.button) {
case 0:
// Corresponds to "Copy password" button.
copyStringShowSnackbar(password, gStringBundle.GetStringFromName("loginsDetails.passwordCopied"));
}
});
},
- _onLoginClick: function (event) {
+ _onLoginClick: function(event) {
let loginItem = event.currentTarget;
let login = loginItem.login;
if (!login) {
debug("No login!");
return;
}
let prompt = new Prompt({
@@ -410,32 +410,32 @@ var Logins = {
// Corresponds to "confirm" button.
Services.logins.removeLogin(login);
}
});
}
});
},
- _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);
aImg.style.visibility = "visible";
});
},
- _createItemForLogin: function (login) {
+ _createItemForLogin: function(login) {
let loginItem = document.createElement("div");
loginItem.setAttribute("loginID", login.guid);
loginItem.className = "login-item list-item";
loginItem.addEventListener("click", this, true);
// Create item icon.
@@ -468,30 +468,30 @@ var Logins = {
descPart.className = "username";
inner.appendChild(descPart);
loginItem.appendChild(inner);
loginItem.login = login;
return loginItem;
},
- handleEvent: function (event) {
+ handleEvent: function(event) {
switch (event.type) {
case "popstate": {
this._onPopState(event);
break;
}
case "click": {
this._onLoginClick(event);
break;
}
}
},
- observe: function (subject, topic, data) {
+ observe: function(subject, topic, data) {
switch (topic) {
case "passwordmgr-storage-changed": {
this._reloadList();
break;
}
}
},
--- a/mobile/android/components/AboutRedirector.js
+++ b/mobile/android/components/AboutRedirector.js
@@ -85,17 +85,17 @@ if (AppConstants.MOZ_SERVICES_HEALTHREPO
};
}
function AboutRedirector() {}
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];
},
// nsIAboutModule
getURIFlags: function(aURI) {
let flags;
let moduleInfo = this._getModuleInfo(aURI);
--- a/mobile/android/components/BrowserCLH.js
+++ b/mobile/android/components/BrowserCLH.js
@@ -12,28 +12,28 @@ Cu.import("resource://gre/modules/Servic
function BrowserCLH() {}
BrowserCLH.prototype = {
/**
* Register resource://android as the APK root.
*
* 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;
// Like jar:file:///data/app/org.mozilla.fennec-2.apk!/
url = url.substring(4, url.indexOf("!/") + 2);
let protocolHandler = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
protocolHandler.setSubstitution("android", Services.io.newURI(url));
},
- observe: function (subject, topic, data) {
+ observe: function(subject, topic, data) {
switch (topic) {
case "app-startup":
this.setResourceSubstitutions();
break;
}
},
// QI
--- a/mobile/android/components/ContentPermissionPrompt.js
+++ b/mobile/android/components/ContentPermissionPrompt.js
@@ -156,10 +156,10 @@ ContentPermissionPrompt.prototype = {
options = { checkbox: browserBundle.GetStringFromName(entityName + ".dontAskAgain") };
}
chromeWin.NativeWindow.doorhanger.show(message, entityName + request.principal.URI.host, buttons, tab.id, options, entityName.toUpperCase());
}
};
-//module initialization
+// module initialization
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);
--- a/mobile/android/components/FxAccountsPush.js
+++ b/mobile/android/components/FxAccountsPush.js
@@ -24,17 +24,17 @@ function FxAccountsPush() {
Services.obs.addObserver(this, "FxAccountsPush:ReceivedPushMessageToDecode");
EventDispatcher.instance.sendRequestForResult({
type: "FxAccountsPush:Initialized"
});
}
FxAccountsPush.prototype = {
- observe: function (subject, topic, data) {
+ observe: function(subject, topic, data) {
switch (topic) {
case "android-push-service":
if (data === "android-fxa-subscribe") {
this._subscribe();
} else if (data === "android-fxa-unsubscribe") {
this._unsubscribe();
} else if (data === "android-fxa-resubscribe") {
// If unsubscription fails, we still want to try to subscribe.
--- a/mobile/android/components/HelperAppDialog.js
+++ b/mobile/android/components/HelperAppDialog.js
@@ -1,14 +1,14 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* 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/. */
-/*globals ContentAreaUtils */
+/* globals ContentAreaUtils */
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
const APK_MIME_TYPE = "application/vnd.android.package-archive";
const OMA_DOWNLOAD_DESCRIPTOR_MIME_TYPE = "application/vnd.oma.dd+xml";
const OMA_DRM_MESSAGE_MIME = "application/vnd.oma.drm.message";
const OMA_DRM_CONTENT_MIME = "application/vnd.oma.drm.content";
@@ -47,17 +47,17 @@ HelperAppLauncherDialog.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIHelperAppLauncherDialog]),
/**
* Returns false if `url` represents a local or special URL that we don't
* wish to ever download.
*
* Returns true otherwise.
*/
- _canDownload: function (url, alreadyResolved=false) {
+ _canDownload: function(url, alreadyResolved = false) {
// The common case.
if (url.schemeIs("http") ||
url.schemeIs("https") ||
url.schemeIs("ftp")) {
return true;
}
// The less-common opposite case.
@@ -84,17 +84,17 @@ HelperAppLauncherDialog.prototype = {
// Anything else is fine to download.
return true;
},
/**
* 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.
return APK_MIME_TYPE == mimeType || OMA_DOWNLOAD_DESCRIPTOR_MIME_TYPE == mimeType;
},
/**
* Returns true if `launcher` represents a download for which we wish to
@@ -285,17 +285,17 @@ HelperAppLauncherDialog.prototype = {
'filename': aLauncher.suggestedFileName
});
},
_getPrefName: function getPrefName(mimetype) {
return "browser.download.preferred." + mimetype.replace("\\", ".");
},
- _getMimeTypeFromLauncher: function (launcher) {
+ _getMimeTypeFromLauncher: function(launcher) {
let mime = launcher.MIMEInfo.MIMEType;
if (!mime)
mime = ContentAreaUtils.getMIMETypeForURI(launcher.source) || "";
return mime;
},
_getPreferredApp: function getPreferredApp(launcher) {
let mime = this._getMimeTypeFromLauncher(launcher);
@@ -316,17 +316,17 @@ HelperAppLauncherDialog.prototype = {
return;
if (app)
Services.prefs.setCharPref(this._getPrefName(mime), app.packageName);
else
Services.prefs.clearUserPref(this._getPrefName(mime));
},
- promptForSaveToFileAsync: function (aLauncher, aContext, aDefaultFile,
+ promptForSaveToFileAsync: function(aLauncher, aContext, aDefaultFile,
aSuggestedFileExt, aForcePrompt) {
Task.spawn(function* () {
let file = null;
try {
let hasPermission = yield RuntimePermissions.waitForPermissions(RuntimePermissions.WRITE_EXTERNAL_STORAGE);
if (hasPermission) {
// If we do have the STORAGE permission then pick the public downloads directory as destination
// for this file. Without the permission saveDestinationAvailable(null) will be called which
@@ -372,17 +372,17 @@ HelperAppLauncherDialog.prototype = {
// special case .ext.gz etc files so we don't wind up with .tar(2).gz
if (aLocalFile.leafName.match(/\.[^\.]{1,3}\.(gz|bz2|Z)$/i))
aLocalFile.leafName = aLocalFile.leafName.replace(/\.[^\.]{1,3}\.(gz|bz2|Z)$/i, "(2)$&");
else
aLocalFile.leafName = aLocalFile.leafName.replace(/(\.[^\.]*)?$/, "(2)$&");
}
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);
}
catch (e) {
dump("*** exception in validateLeafName: " + e + "\n");
if (e.result == Cr.NS_ERROR_FILE_ACCESS_DENIED)
--- a/mobile/android/components/ImageBlockingPolicy.js
+++ b/mobile/android/components/ImageBlockingPolicy.js
@@ -3,31 +3,31 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
const { classes: Cc, interfaces: Ci, manager: Cm, utils: Cu, results: Cr } = Components;
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;
/**
* Content policy for blocking images
*/
@@ -90,27 +90,27 @@ ImageBlockingPolicy.prototype = {
network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_USB ||
network.linkType == Ci.nsINetworkLinkService.LINK_TYPE_WIFI);
},
_enabled: function() {
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());
}
},
};
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;
}
if (xhr.status != 200) {
return;
}
let contentLength = xhr.getResponseHeader("Content-Length");
if (!contentLength) {
--- a/mobile/android/components/LoginManagerPrompter.js
+++ b/mobile/android/components/LoginManagerPrompter.js
@@ -85,31 +85,31 @@ LoginManagerPrompter.prototype = {
return this.__ellipsis;
},
/*
* log
*
* Internal function for logging debug messages to the Error Console window.
*/
- log: function (message) {
+ log: function(message) {
if (!this._debug)
return;
dump("Pwmgr Prompter: " + message + "\n");
Services.console.logStringMessage("Pwmgr Prompter: " + message);
},
/* ---------- nsILoginManagerPrompter prompts ---------- */
/*
* init
*
*/
- init: function (aWindow, aFactory) {
+ init: function(aWindow, aFactory) {
this._chromeWindow = this._getChromeWindow(aWindow).wrappedJSObject;
this._factory = aFactory || null;
this._browser = null;
var prefBranch = Services.prefs.getBranch("signon.");
this._debug = prefBranch.getBoolPref("debug");
this.log("===== initialized =====");
},
@@ -121,17 +121,17 @@ LoginManagerPrompter.prototype = {
// setting this attribute is ignored because Android does not consider
// opener windows when displaying login notifications
set opener(aOpener) { },
/*
* 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");
},
/*
* _showLoginNotification
*
@@ -140,17 +140,17 @@ LoginManagerPrompter.prototype = {
* String message to be displayed in the doorhanger
* @param aButtons
* Buttons to display with the doorhanger
* @param aUsername
* Username string used in creating a doorhanger action
* @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 = {
text: aUsername,
type: "EDIT",
bundle: { username: aUsername,
password: aPassword }
};
@@ -176,17 +176,17 @@ LoginManagerPrompter.prototype = {
/*
* _showSaveLoginNotification
*
* Displays a notification doorhanger (rather than a popup), to allow the user to
* save the specified login. This allows the user to see the results of
* 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]);
let username = aLogin.username ? this._sanitizeUsername(aLogin.username) : "";
// The callbacks in |buttons| have a closure to access the variables
// in scope here; set one to |this._pwmgr| so we can get back to pwmgr
// without a getService() call.
@@ -221,30 +221,30 @@ LoginManagerPrompter.prototype = {
/*
* promptToChangePassword
*
* Called when we think we detect a password change for an existing
* login, when the form being submitted contains multiple password
* 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;
Services.obs.notifyObservers(aNewLogin, "passwordmgr-prompt-change", oldGUID);
},
/*
* _showChangeLoginNotification
*
* 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);
notificationText = this._getLocalizedString("updatePassword", [displayUser]);
} else {
notificationText = this._getLocalizedString("updatePasswordNoUser");
}
@@ -285,17 +285,17 @@ LoginManagerPrompter.prototype = {
* to select a username and confirm the password change.
*
* Note: The caller doesn't know the username for aNewLogin, so this
* function fills in .username and .usernameField with the values
* from the login selected by the user.
*
* 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);
var dialogText = this._getLocalizedString("userSelectText2");
var dialogTitle = this._getLocalizedString("passwordChangeTitle");
var selectedIndex = { value: null };
// If user selects ok, outparam.value is set to the index
@@ -312,17 +312,17 @@ LoginManagerPrompter.prototype = {
}
},
/* ---------- Internal Methods ---------- */
/*
* _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);
if (newPassword) {
propBag.setProperty("password", newPassword);
// Explicitly set the password change time here (even though it would
// be changed automatically), to ensure that it's exactly the same
// value as timeLastUsed.
@@ -333,33 +333,33 @@ LoginManagerPrompter.prototype = {
this._pwmgr.modifyLogin(login, propBag);
},
/*
* _getChromeWindow
*
* 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)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerGlobal;
return chromeWin;
},
/*
* _getNativeWindow
*
* 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;
if (chromeWin.NativeWindow) {
nativeWindow = chromeWin.NativeWindow;
} else {
Cu.reportError("NativeWindow not available on window");
}
@@ -379,32 +379,32 @@ LoginManagerPrompter.prototype = {
* _getLocalizedString("key2", ["arg1"]);
* _getLocalizedString("key3", ["arg1", "arg2"]);
* (etc)
*
* Returns the localized string for the specified key,
* formatted if required.
*
*/
- _getLocalizedString: function (key, formatArgs) {
+ _getLocalizedString: function(key, formatArgs) {
if (formatArgs)
return this._strBundle.pwmgr.formatStringFromName(
key, formatArgs, formatArgs.length);
else
return this._strBundle.pwmgr.GetStringFromName(key);
},
/*
* _sanitizeUsername
*
* Sanitizes the specified username, by stripping quotes and truncating if
* 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;
}
return username.replace(/['"]/g, "");
},
}; // end of LoginManagerPrompter implementation
--- a/mobile/android/components/PromptService.js
+++ b/mobile/android/components/PromptService.js
@@ -386,17 +386,17 @@ InternalPrompt.prototype = {
if (ok)
aOutSelection.value = data.menulist0;
return ok;
},
/* ---------- 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;
return this.nsIPrompt_prompt(title, text, result, null, {});
},
nsIAuthPrompt_promptUsernameAndPassword: function(aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass) {
return this.nsIAuthPrompt_loginPrompt(aTitle, aText, aPasswordRealm, aSavePassword, aUser, aPass);
@@ -533,17 +533,17 @@ InternalPrompt.prototype = {
},
asyncPromptAuth: function asyncPromptAuth(aChannel, aCallback, aContext, aLevel, aAuthInfo) {
let cancelable = null;
try {
// 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]),
callback: aCallback,
context: aContext,
cancel: function() {
this.callback.onAuthCancelled(this.context, false);
this.callback = null;
@@ -806,26 +806,26 @@ var PromptUtils = {
else
username.value = aAuthInfo.username;
password.value = aAuthInfo.password
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
var idx = username.indexOf("\\");
if (idx == -1) {
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;
}
aAuthInfo.password = password;
},
/**
@@ -845,21 +845,21 @@ var PromptUtils = {
let winUtils = aDomWin.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
winUtils.dispatchEventToChromeOnly(aDomWin, event);
} catch (ex) {
}
}
};
-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");
});
// Factory for wrapping nsIAuthPrompt interfaces to make them usable via an nsIAuthPrompt2 interface.
// XXX Copied from nsPrompter.js.
function AuthPromptAdapterFactory() {
}
--- a/mobile/android/components/SessionStore.js
+++ b/mobile/android/components/SessionStore.js
@@ -1475,17 +1475,17 @@ SessionStore.prototype = {
}
let closedTabs = this._windows[aWindow.__SSID].closedTabs;
if (!closedTabs) {
return null;
}
// 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;
}
});
// create a new tab and bring to front
let params = {
@@ -1549,17 +1549,17 @@ SessionStore.prototype = {
throw (Components.returnCode = Cr.NS_ERROR_INVALID_ARG);
}
let closedTabs = this._windows[aWindow.__SSID].closedTabs;
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(aWindow.BrowserApp.selectedBrowser);
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 {
url: entry.url,
title: entry.title || "",
data: JSON.stringify(tab),
};
});
--- a/mobile/android/components/extensions/ext-browsingData.js
+++ b/mobile/android/components/extensions/ext-browsingData.js
@@ -19,17 +19,17 @@ let clearCookies = async function(option
}
let cookieMgr = Services.cookies;
let yieldCounter = 0;
const YIELD_PERIOD = 10;
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()) {
let cookie = cookiesEnum.getNext().QueryInterface(Ci.nsICookie2);
if (cookie.creationTime >= since) {
// This cookie was created after our cutoff, clear it.
cookieMgr.remove(cookie.host, cookie.name, cookie.path,
@@ -61,17 +61,17 @@ this.browsingData = class extends Extens
let name;
let dataToRemove = {};
let dataRemovalPermitted = {};
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;
case "cookies_sessions":
name = "cookies";
break;
case "downloadFiles":
name = "downloads";
--- a/mobile/android/components/extensions/test/mochitest/test_ext_browsingData_settings.html
+++ b/mobile/android/components/extensions/test/mochitest/test_ext_browsingData_settings.html
@@ -21,21 +21,21 @@ const PREF_DOMAIN = "android.not_a_prefe
const PREF_KEY_PREFIX = "private.data.";
const SETTINGS_LIST = ["cache", "cookies", "history", "formData", "downloads"];
function checkPrefs(key, actualValue, prefs, prefSuffix) {
let prefValue = prefs.includes(`${PREF_KEY_PREFIX}${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;
case "cookies":
checkPrefs(key, dataToRemove[key], prefs, "cookies_sessions");
break;
case "downloads":
checkPrefs(key, dataToRemove[key], prefs, "downloadFiles");
--- a/mobile/android/modules/Accounts.jsm
+++ b/mobile/android/modules/Accounts.jsm
@@ -3,20 +3,20 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
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,
* and accessing the Sync setup wizard.
*
* Usage:
*
* Cu.import("resource://gre/modules/Accounts.jsm");
@@ -28,56 +28,56 @@ Cu.import("resource://gre/modules/Servic
* }
* },
* (err) => {
* console.log("We failed so hard.");
* }
* );
*/
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");
},
/**
* Fire-and-forget: open the Firefox accounts activity, which
* will be the Getting Started screen if FxA isn't yet set up.
*
* Optional extras are passed, as a JSON string, to the Firefox
* Account Getting Started activity in the extras bundle of the
* activity launch intent, under the key "extras".
*
* 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',
profileServerEndpoint: 'identity.fxaccounts.remote.profile.uri',
tokenServerEndpoint: 'identity.sync.tokenserver.uri'
};
for (let key in associations) {
newData[key] = newData[key] || Services.urlFormatter.formatURLPref(associations[key]);
@@ -89,61 +89,61 @@ var Accounts = Object.freeze({
* Create a new Android Account corresponding to the given
* fxa-content-server "login" JSON datum. The new account will be
* in the "Engaged" state, and will start syncing immediately.
*
* It is an error if an Android Account already exists.
*
* 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)
});
},
/**
* Move an existing Android Account to the "Engaged" state with the given
* fxa-content-server "login" JSON datum. The account will (re)start
* syncing immediately, unless the user has manually configured the account
* to not Sync.
*
* It is an error if no Android Account exists.
*
* 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)
});
},
/**
* Notify that profile for Android Account has updated.
* The account will re-fetch the profile image.
*
* It is an error if no Android Account exists.
*
* There is no return value from this method.
*/
- notifyFirefoxAccountProfileChanged: function () {
+ notifyFirefoxAccountProfileChanged: function() {
EventDispatcher.instance.sendRequest({
type: "Accounts:ProfileUpdated",
});
},
/**
* Fetch information about an existing Android Firefox Account.
*
* 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",
}).then(data => {
if (!data || !data.exists) {
return null;
}
delete data.exists;
@@ -153,23 +153,23 @@ var Accounts = Object.freeze({
/**
* Delete an existing Android Firefox Account.
*
* It is an error if no Android Account exists.
*
* 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) {
throw new Error("Can't show Sync preferences of non-existent Firefox Account!");
}
return EventDispatcher.instance.sendRequestForResult({
type: "Accounts:ShowSyncPreferences"
});
--- a/mobile/android/modules/DelayedInit.jsm
+++ b/mobile/android/modules/DelayedInit.jsm
@@ -1,14 +1,14 @@
/* 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"
-/*globals MessageLoop */
+/* globals MessageLoop */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
this.EXPORTED_SYMBOLS = ["DelayedInit"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "MessageLoop",
@@ -44,29 +44,29 @@ XPCOMUtils.defineLazyServiceGetter(this,
*
* function InitLater(fn, obj, name) {
* return DelayedInit.schedule(fn, obj, name, 5000); // constant max wait
* }
* InitLater(() => Foo.init());
* 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);
},
};
// Maximum duration for each idling period. Pending inits are run until this
// duration is exceeded; then we wait for next idling period.
const MAX_IDLE_RUN_MS = 50;
var Impl = {
pendingInits: [],
- onIdle: function () {
+ onIdle: function() {
let startTime = Cu.now();
let time = startTime;
let nextDue;
// Go through all the pending inits. Even if we don't run them,
// we still need to find out when the next timeout should be.
for (let init of this.pendingInits) {
if (init.complete) {
@@ -87,22 +87,22 @@ var Impl = {
if (nextDue !== undefined) {
// Schedule the next idle, if we still have pending inits.
MessageLoop.postIdleTask(() => this.onIdle(),
Math.max(0, nextDue - time));
}
},
- 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;
}
this.complete = true;
this.fn.call();
this.fn = null;
return true;
},
@@ -111,17 +111,17 @@ var Impl = {
if (!this.pendingInits.length) {
// Schedule for the first idle.
MessageLoop.postIdleTask(() => this.onIdle(), wait);
}
this.pendingInits.push(init);
return init;
},
- scheduleInit: function (fn, object, name, wait) {
+ scheduleInit: function(fn, object, name, wait) {
let init = this.addPendingInit(fn, wait);
if (!object || !name) {
// No lazy getter needed.
return;
}
// Get any existing information about the property.
@@ -151,17 +151,17 @@ var Impl = {
Object.defineProperty(object, name, prop);
}
if (prop.get) {
return prop.get.call(object);
}
return prop.value;
},
- set: function (newVal) {
+ set: function(newVal) {
init.maybeInit();
// Since our initializer already ran,
// we can get rid of our proxy property.
if (prop.get || prop.set) {
Object.defineProperty(object, name, prop);
return prop.set.call(object);
}
--- a/mobile/android/modules/DownloadNotifications.jsm
+++ b/mobile/android/modules/DownloadNotifications.jsm
@@ -41,26 +41,26 @@ const kButtons = {
"alertDownloadsCancel")
};
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);
// All click, cancel, and button presses will be handled by this handler as part of the Notifications callback API.
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.
if (download.succeeded && !this._viewAdded) {
return;
}
if (!ParentalControls.isAllowed(ParentalControls.DOWNLOAD)) {
@@ -75,17 +75,17 @@ var DownloadNotifications = {
notification.showOrUpdate();
// If this is a new download, show a snackbar as well.
if (this._viewAdded) {
Snackbars.show(strings.GetStringFromName("alertDownloadsToast"), Snackbars.LENGTH_LONG);
}
},
- onDownloadChanged: function (download) {
+ onDownloadChanged: function(download) {
let notification = notifications.get(download);
if (download.succeeded) {
let file = new FileUtils.File(download.target.path);
Snackbars.show(strings.formatStringFromName("alertDownloadSucceeded", [file.leafName], 1), Snackbars.LENGTH_LONG, {
action: {
label: strings.GetStringFromName("helperapps.open"),
@@ -103,17 +103,17 @@ var DownloadNotifications = {
}});
}
if (notification) {
notification.showOrUpdate();
}
},
- onDownloadRemoved: function (download) {
+ onDownloadRemoved: function(download) {
let notification = notifications.get(download);
if (!notification) {
Cu.reportError("Download doesn't have a notification.");
return;
}
notification.hide();
notifications.delete(download);
@@ -133,17 +133,17 @@ var DownloadNotifications = {
throw "Couldn't find download for " + cookie;
});
},
onCancel: function(cookie) {
// 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
window.BrowserApp.selectOrAddTab("about:downloads" + hash, null, { startsWith: true });
},
onClick: function(cookie) {
this._findDownloadForCookie(cookie).then((download) => {
@@ -186,17 +186,17 @@ function getCookieFromDownload(download)
function DownloadNotification(download) {
this.download = download;
this._fileName = OS.Path.basename(download.target.path);
this.id = null;
}
DownloadNotification.prototype = {
- _updateFromDownload: function () {
+ _updateFromDownload: function() {
this._downloading = !this.download.stopped;
this._paused = this.download.canceled && this.download.hasPartialData;
this._succeeded = this.download.succeeded;
this._show = this._downloading || this._paused || this._succeeded;
},
get options() {
@@ -224,31 +224,31 @@ DownloadNotification.prototype = {
} else if (this._succeeded) {
options.persistent = false;
this._updateOptionsForStatic(options, "alertDownloadsDone2");
}
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;
options.ongoing = true;
options.progress = this.download.progress;
options.persistent = true;
},
- showOrUpdate: function () {
+ showOrUpdate: function() {
this._updateFromDownload();
if (this._show) {
if (!this.id) {
this.id = Notifications.create(this.options);
} else if (!this.options.ongoing) {
// We need to explictly cancel ongoing notifications,
// since updating them to be non-ongoing doesn't seem
@@ -258,26 +258,26 @@ DownloadNotification.prototype = {
} else {
Notifications.update(this.id, this.options);
}
} else {
this.hide();
}
},
- hide: function () {
+ hide: function() {
if (this.id) {
Notifications.cancel(this.id);
this.id = null;
}
},
};
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");
if (Services.prompt.confirm(null, title, message)) {
download.cancel().catch(Cu.reportError);
download.removePartialData().catch(Cu.reportError);
}
--- a/mobile/android/modules/FxAccountsWebChannel.jsm
+++ b/mobile/android/modules/FxAccountsWebChannel.jsm
@@ -6,39 +6,39 @@
/**
* Firefox Accounts Web Channel.
*
* Use the WebChannel component to receive messages about account
* state changes.
*/
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");
const WEBCHANNEL_ID = "account_updates";
const COMMAND_LOADED = "fxaccounts:loaded";
const COMMAND_CAN_LINK_ACCOUNT = "fxaccounts:can_link_account";
const COMMAND_LOGIN = "fxaccounts:login";
const COMMAND_CHANGE_PASSWORD = "fxaccounts:change_password";
const COMMAND_DELETE_ACCOUNT = "fxaccounts:delete_account";
const COMMAND_PROFILE_CHANGE = "profile:change";
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");
XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry", "resource://gre/modules/UITelemetry.jsm");
this.FxAccountsWebChannelHelpers = function() {
};
--- a/mobile/android/modules/HelperApps.jsm
+++ b/mobile/android/modules/HelperApps.jsm
@@ -173,19 +173,19 @@ var HelperApps = {
_parseApps: function _parseApps(appInfo) {
// appInfo -> {apps: [app1Label, app1Default, app1PackageName, app1ActivityName, app2Label, app2Defaut, ...]}
// see GeckoAppShell.java getHandlersForIntent function for details
const numAttr = 4; // 4 elements per ResolveInfo: label, default, package name, activity name.
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;
},
_getMessage: function(type, uri, options = {}) {
let mimeType = options.mimeType;
if (uri && mimeType == undefined) {
--- a/mobile/android/modules/Home.jsm
+++ b/mobile/android/modules/Home.jsm
@@ -56,17 +56,17 @@ function BannerMessage(options) {
let weight = parseInt(options.weight, 10);
this.weight = weight > 0 ? weight : DEFAULT_WEIGHT;
}
// We need this object to have access to the HomeBanner
// 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;
// Functions used to handle messages sent from Java.
HomeBannerMessageHandlers = {
"HomeBanner:Get": function handleBannerGet(data) {
if (Object.keys(_messages).length > 0) {
_sendBannerData();
@@ -185,17 +185,17 @@ var HomeBanner = (function () {
}
});
})();
// We need this object to have access to the HomePanels
// 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 = {
"HomePanels:Get": function handlePanelsGet(data) {
let requestId = data.requestId;
let ids = data.ids || null;
let panels = [];
@@ -467,17 +467,17 @@ var HomePanels = (function () {
})();
// Public API
this.Home = Object.freeze({
banner: HomeBanner,
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) {
HomePanelsMessageHandlers[event](data);
} else {
Cu.reportError("Home.observe: message handler not found for event: " + event);
}
}
--- a/mobile/android/modules/JNI.jsm
+++ b/mobile/android/modules/JNI.jsm
@@ -804,28 +804,28 @@ var ensureSig = function(classname_or_si
// anything not a valid signature is a classname.
var m = sigRegex().exec(classname_or_signature);
return (m && m[0] === classname_or_signature) ? classname_or_signature :
'L' + classname_or_signature.replace(/\./g, '/') + ';';
};
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;
};
var ensureLoaded = function(jenv, classSig) {
if (!Object.hasOwnProperty.call(registry, classSig)) {
JNILoadClass(jenv, classSig);
}
@@ -868,17 +868,17 @@ var sig2prim = function(sig) { return si
// return the class object for a signature string.
// allocates 1 or 2 local refs
function JNIClassObj(jenv, classSig) {
var jenvpp = function() { return jenv.contents.contents; };
// Deal with funny calling convention of JNI FindClass method.
// 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);
};
switch (classSig.charAt(0)) {
case '[':
return jenvpp().FindClass(jenv, classSig);
case 'L':
@@ -896,17 +896,17 @@ function JNIClassSig(jenv, jcls) {
var jclscls = jenvpp().FindClass(jenv, "java/lang/Class");
var jmtd = jenvpp().GetMethodID(jenv, jclscls,
"getName", "()Ljava/lang/String;");
var name = jenvpp().CallObjectMethod(jenv, jcls, jmtd);
name = JNIReadString(jenv, name);
// 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';
case 'byte': return 'B';
case 'char': return 'C';
case 'short': return 'S';
case 'int': return 'I';
case 'long': return 'J';
@@ -918,17 +918,17 @@ function JNIClassSig(jenv, jcls) {
}
// create dispatch method
// we resolve overloaded methods only by # of arguments. If you need
// further resolution, use the 'long form' of the method name, ie:
// 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);
};
};
// Create appropriate wrapper fields/methods for a Java class.
function JNILoadClass(jenv, classSig, opt_props) {
var jenvpp = function() { return jenv.contents.contents; };
var props = opt_props || {};
@@ -947,93 +947,93 @@ function JNILoadClass(jenv, classSig, op
// get name of superclass
var jsuper = jenvpp().GetSuperclass(jenv, jcls);
if (jsuper.isNull()) {
jsuper = null;
} else {
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) {
return wrap(unwrap(obj), classSig);
};
// 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() {
return jenvpp().GetArrayLength(jenv, unwrap(this));
}
});
// add 'get' and 'set' methods, 'new' constructor
var elemSig = classSig.substring(1);
ensureLoaded(jenv, elemSig);
registry[elemSig].__array__ = r;
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) {
return wrap(jenvpp().GetObjectArrayElement(jenv, unwrap(this), idx),
elemSig);
};
rpp.set = function(idx, value) {
jenvpp().SetObjectArrayElement(jenv, unwrap(this), idx,
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),
classSig);
};
} 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) {
var j = jenvpp();
var buf = new (ctype.array())(len);
j[getter].call(j, jenv, unwrap(this), start, len, buf);
return buf;
};
@@ -1047,17 +1047,17 @@ function JNILoadClass(jenv, classSig, op
return wrap(j[constructor].call(j, jenv, length), classSig);
};
}
}
(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() {
var j = jenvpp();
return wrap(j[getter].call(j, jenv, jcls, jfld), nm);
},
set: function(newValue) {
var j = jenvpp();
@@ -1066,76 +1066,76 @@ function JNILoadClass(jenv, classSig, op
};
Object.defineProperty(r, fld.name, props);
// add static fields to object instances, too.
Object.defineProperty(rpp, fld.name, 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);
};
});
(props.constructors || []).forEach(function(mtd) {
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);
};
});
(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() {
var j = jenvpp();
return wrap(j[getter].call(j, jenv, unwrap(this), jfld), nm);
},
set: function(newValue) {
var j = jenvpp();
j[setter].call(j, jenv, unwrap(this), jfld, unwrap(newValue));
}
});
});
(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);
};
});
jenvpp().PopLocalFrame(jenv, null);
return r;
}
--- a/mobile/android/modules/LightweightThemeConsumer.jsm
+++ b/mobile/android/modules/LightweightThemeConsumer.jsm
@@ -17,30 +17,30 @@ function LightweightThemeConsumer(aDocum
this._doc = aDocument;
Services.obs.addObserver(this, "lightweight-theme-styling-update");
Services.obs.addObserver(this, "lightweight-theme-apply");
this._update(LightweightThemeManager.currentThemeForDisplay);
}
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: "" };
let active = !!aData.headerURL;
let msg = active ? { type: "LightweightTheme:Update", data: aData } :
{ type: "LightweightTheme:Disable" };
EventDispatcher.instance.sendRequest(msg);
--- a/mobile/android/modules/MediaPlayerApp.jsm
+++ b/mobile/android/modules/MediaPlayerApp.jsm
@@ -128,17 +128,17 @@ RemoteMedia.prototype = {
this._status = "started";
})
},
get status() {
return this._status;
},
- onEvent: function (event, message, callback) {
+ onEvent: function(event, message, callback) {
switch (event) {
case "MediaPlayer:Playing":
if (this._status !== "started") {
this._status = "started";
if ("onRemoteMediaStatus" in this._listener) {
this._listener.onRemoteMediaStatus(this);
}
}
--- a/mobile/android/modules/Notifications.jsm
+++ b/mobile/android/modules/Notifications.jsm
@@ -233,17 +233,17 @@ var Notifications = {
if (notification && notification._onCancel)
notification._onCancel(id, notification._cookie);
delete _notificationsMap[id]; // since the notification was dismissed, we no longer need to hold a reference.
break;
}
},
- QueryInterface: function (aIID) {
+ QueryInterface: function(aIID) {
if (!aIID.equals(Ci.nsISupports) &&
!aIID.equals(Ci.nsIObserver) &&
!aIID.equals(Ci.nsISupportsWeakReference))
throw Components.results.NS_ERROR_NO_INTERFACE;
return this;
}
};
--- a/mobile/android/modules/Sanitizer.jsm
+++ b/mobile/android/modules/Sanitizer.jsm
@@ -1,14 +1,14 @@
// -*- indent-tabs-mode: nil; js-indent-level: 4 -*-
/* 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/. */
-/*globals LoadContextInfo, FormHistory, Accounts */
+/* globals LoadContextInfo, FormHistory, Accounts */
var Cc = Components.classes;
var Ci = Components.interfaces;
var Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/LoadContextInfo.jsm");
@@ -28,33 +28,33 @@ XPCOMUtils.defineLazyModuleGetter(this,
function dump(a) {
Services.console.logStringMessage(a);
}
this.EXPORTED_SYMBOLS = ["Sanitizer"];
function Sanitizer() {}
Sanitizer.prototype = {
- clearItem: function (aItemName)
+ clearItem: function(aItemName)
{
let item = this.items[aItemName];
let canClear = item.canClear;
if (typeof canClear == "function") {
canClear(function clearCallback(aCanClear) {
if (aCanClear)
return item.clear();
});
} else if (canClear) {
return item.clear();
}
},
items: {
cache: {
- clear: function ()
+ clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_CACHE", refObj);
var cache = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
try {
cache.clear();
@@ -73,17 +73,17 @@ Sanitizer.prototype = {
get canClear()
{
return true;
}
},
cookies: {
- clear: function ()
+ clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_COOKIES_2", refObj);
Services.cookies.removeAll();
TelemetryStopwatch.finish("FX_SANITIZE_COOKIES_2", refObj);
@@ -133,17 +133,17 @@ Sanitizer.prototype = {
get canClear()
{
return true;
}
},
offlineApps: {
- clear: function ()
+ clear: function()
{
return new Promise(function(resolve, reject) {
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
var appCacheStorage = cacheService.appCacheStorage(LoadContextInfo.default, null);
try {
appCacheStorage.asyncEvictStorage(null);
} catch (er) {}
@@ -153,17 +153,17 @@ Sanitizer.prototype = {
get canClear()
{
return true;
}
},
history: {
- clear: function ()
+ clear: function()
{
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_HISTORY", refObj);
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearHistory" })
.catch(e => Cu.reportError("Java-side history clearing failed: " + e))
.then(function() {
TelemetryStopwatch.finish("FX_SANITIZE_HISTORY", refObj);
@@ -183,17 +183,17 @@ Sanitizer.prototype = {
{
// bug 347231: Always allow clearing history due to dependencies on
// the browser:purge-session-history notification. (like error console)
return true;
}
},
openTabs: {
- clear: function ()
+ clear: function()
{
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_OPENWINDOWS", refObj);
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:OpenTabs" })
.catch(e => Cu.reportError("Java-side tab clearing failed: " + e))
.then(function() {
try {
@@ -207,43 +207,43 @@ Sanitizer.prototype = {
get canClear()
{
return true;
}
},
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))
},
get canClear()
{
return true;
}
},
formdata: {
- clear: function ()
+ clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_FORMDATA", refObj);
FormHistory.update({ op: "remove" });
TelemetryStopwatch.finish("FX_SANITIZE_FORMDATA", refObj);
resolve();
});
},
- canClear: function (aCallback)
+ canClear: function(aCallback)
{
let count = 0;
let countDone = {
handleResult: function(aResult) { count = aResult; },
handleError: function(aError) { Cu.reportError(aError); },
handleCompletion: function(aReason) { aCallback(aReason == 0 && count > 0); }
};
FormHistory.count({}, countDone);
@@ -292,33 +292,33 @@ Sanitizer.prototype = {
get canClear()
{
return true;
}
},
passwords: {
- clear: function ()
+ clear: function()
{
return new Promise(function(resolve, reject) {
Services.logins.removeAllLogins();
resolve();
});
},
get canClear()
{
let count = Services.logins.countLogins("", "", ""); // count all logins
return (count > 0);
}
},
sessions: {
- clear: function ()
+ clear: function()
{
return new Promise(function(resolve, reject) {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_SESSIONS", refObj);
// clear all auth tokens
var sdr = Cc["@mozilla.org/security/sdr;1"].getService(Ci.nsISecretDecoderRing);
sdr.logoutAndTeardown();
@@ -333,17 +333,17 @@ Sanitizer.prototype = {
get canClear()
{
return true;
}
},
syncedTabs: {
- clear: function ()
+ clear: function()
{
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearSyncedTabs" })
.catch(e => Cu.reportError("Java-side synced tabs clearing failed: " + e));
},
canClear: function(aCallback)
{
Accounts.anySyncAccountsExist().then(aCallback)
--- a/mobile/android/modules/WebsiteMetadata.jsm
+++ b/mobile/android/modules/WebsiteMetadata.jsm
@@ -205,17 +205,17 @@ function forEach(fn, obj) {
fn(x);
}
}
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;
bestKeySoFar = key;
isFirst = false;
}
},
iterable);
@@ -256,17 +256,17 @@ function ruleset(...rules) {
rules);
return {
// Iterate over a DOM tree or subtree, building up a knowledgebase, a
// data structure holding scores and annotations for interesting
// 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
// things started:
const nonterminals = [[{tree}, 'dom']]; // [[node, flavor], [node, flavor], ...]
// While there are new facts, run the applicable rules over them to
// generate even newer facts. Repeat until everything's fully
@@ -349,37 +349,37 @@ function knowledgebase() {
// someCustomScore: 10},
// // This is an empty note:
// 'fluffy' -> undefined}}
const nodesByElement = new Map();
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,
score: 1,
flavors: new Map()}));
},
// 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, () => []);
}
};
}
// Apply a rule (as returned by a call to rule()) to a fact, and return the
// new facts that result.
--- a/mobile/android/modules/geckoview/Messaging.jsm
+++ b/mobile/android/modules/geckoview/Messaging.jsm
@@ -38,46 +38,46 @@ function DispatcherDelegate(aDispatcher,
DispatcherDelegate.prototype = {
/**
* Register a listener to be notified of event(s).
*
* @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");
}
this._dispatcher.registerListener(listener, events);
},
/**
* Unregister a previously-registered listener.
*
* @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");
}
this._dispatcher.unregisterListener(listener, events);
},
/**
* Dispatch an event to registered listeners for that event, and pass an
* optional data object and/or a optional callback interface to the
* listeners.
*
* @param event Name of event to dispatch.
* @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;
}
let mm = this._messageManager || Services.cpmm;
let forwardData = {
global: !this._messageManager,
@@ -108,29 +108,29 @@ DispatcherDelegate.prototype = {
* Implementations of Messaging APIs for backwards compatibility.
*/
/**
* Sends a request to Java.
*
* @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);
},
/**
* Sends a request to Java, returning a Promise that resolves to the response.
*
* @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;
this.dispatch(type, msg, {
onSuccess: resolve,
onError: reject,
});
@@ -162,34 +162,34 @@ DispatcherDelegate.prototype = {
* return { response: "bar" };
* };
* EventDispatcher.instance.addListener(listener, "Demo:Request");
*
* @param listener Listener callback taking a single data parameter
* (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);
}
if (typeof listener !== "function") {
throw new Error("Error in addListener: Listener must be a function for event " + event);
}
this._requestHandler.listeners[event] = listener;
this.registerListener(this._requestHandler, event);
},
/**
* Removes a listener for a given event.
*
* @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);
}
this._requestHandler.listeners[event] = undefined;
this.unregisterListener(this._requestHandler, event);
},
@@ -211,37 +211,37 @@ 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);
if (!view) {
let mm = aWindow && aWindow.messageManager;
if (!mm) {
throw new Error("window is not a GeckoView-connected window and does" +
" not have a message manager");
}
return this.forMessageManager(mm);
}
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) {
let reply = (type, response) => {
let mm = aMsg.data.global ? aMsg.target : aMsg.target.messageManager;
mm.sendAsyncMessage("GeckoView:MessagingReply", {
type: type,
response: response,
--- a/mobile/android/tests/browser/chrome/head.js
+++ b/mobile/android/tests/browser/chrome/head.js
@@ -73,17 +73,17 @@ function promiseLinkVisit(url) {
function makeObserver(observerId) {
let deferred = Promise.defer();
let ret = {
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,
data: data };
deferred.resolve(msg);
},
};
--- a/mobile/android/tests/browser/chrome/test_accounts.html
+++ b/mobile/android/tests/browser/chrome/test_accounts.html
@@ -23,18 +23,18 @@ Migrated from Robocop: https://bugzilla.
let anyExists = yield Accounts.anySyncAccountsExist();
info("Any accounts exist? " + anyExists + "\n");
// Only one account should exist.
ok(!syncExists || !firefoxExists, "at least one account does not exist");
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>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=917942">Mozilla Bug 917942</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1184186">Migrated from Robocop testAccounts</a>
--- a/mobile/android/tests/browser/chrome/test_android_log.html
+++ b/mobile/android/tests/browser/chrome/test_android_log.html
@@ -7,17 +7,17 @@ Migrated from Robocop: https://bugzilla.
<head>
<meta charset="utf-8">
<title>Test for Bug 1004825</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<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";
const VERBOSE_MESSAGE = "This is a verbose message.";
const DEBUG_MESSAGE = "This is a debug message.";
const INFO_MESSAGE = "This is an info message.";
const WARNING_MESSAGE = "This is a warning message.";
const ERROR_MESSAGE = "This is an error message.";
--- a/mobile/android/tests/browser/chrome/test_awsy_lite.html
+++ b/mobile/android/tests/browser/chrome/test_awsy_lite.html
@@ -85,24 +85,24 @@
var schedGC = Cu.schedulePreciseShrinkingGC;
if (!schedGC) {
schedGC = Cu.schedulePreciseGC;
}
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);
}
}
var j = 0;
minimizeInner();
@@ -206,17 +206,17 @@
function geomean(aProperty) {
// https://en.wikipedia.org/wiki/Geometric_mean#Relationship_with_arithmetic_mean_of_logarithms
var logsum = 0;
var i;
for (i = 0; i < gResults.length; i++) {
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() {
var i;
var perfherder = "PERFHERDER_DATA: ";
perfherder += "{\"framework\": {\"name\": \"awsy\"}, ";
perfherder += "\"suites\": [";
perfherder += "{\"name\": \"Resident Memory\", ";
@@ -224,17 +224,17 @@
for (i = 0; i < gResults.length; i++) {
var result = gResults[i];
if (i > 0) {
perfherder += ", ";
}
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
info(perfherder);
}
startup();
--- a/mobile/android/tests/browser/chrome/test_hidden_select_option.html
+++ b/mobile/android/tests/browser/chrome/test_hidden_select_option.html
@@ -21,34 +21,34 @@ https://bugzilla.mozilla.org/show_bug.cg
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
let sandbox = {};
Services.scriptloader.loadSubScript("chrome://browser/content/SelectHelper.js", sandbox);
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++) {
dummyList.push(i);
}
return {list: dummyList};
}
// 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");
// ##############################################
// ### Testing SelectHelper.getListForElement ###
// ##############################################
// Check that SelectHelper.getListForElement only includes visible options...
let listElements = SelectHelper.getListForElement(select);
--- a/mobile/android/tests/browser/chrome/test_home_provider.html
+++ b/mobile/android/tests/browser/chrome/test_home_provider.html
@@ -70,17 +70,17 @@ Migrated from Robocop: https://bugzilla.
// Peek in the DB to make sure we have the right data.
let db = yield Sqlite.openConnection({ path: DB_PATH });
// Make sure the items table was created.
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");
is(row.getResultByName("background_color"), TEST_BACKGROUND_COLOR, "expected background color");
});
// Use the HomeProvider API to delete the data.
yield storage.deleteAll();
--- a/mobile/android/tests/browser/chrome/test_resource_substitutions.html
+++ b/mobile/android/tests/browser/chrome/test_resource_substitutions.html
@@ -10,19 +10,19 @@ Migrated from Robocop: https://bugzilla.
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<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;
- 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();
let channel = NetUtil.newChannel({uri: url, loadUsingSystemPrincipal: true});
channel.contentType = "text/plain";
--- a/mobile/android/tests/browser/chrome/test_select_disabled.html
+++ b/mobile/android/tests/browser/chrome/test_select_disabled.html
@@ -19,17 +19,17 @@ https://bugzilla.mozilla.org/show_bug.cg
Cu.import("resource://gre/modules/Services.jsm");
let sandbox = {};
Services.scriptloader.loadSubScript("chrome://browser/content/SelectHelper.js", sandbox);
let SelectHelper = sandbox.SelectHelper;
// 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");
ok(!SelectHelper._isDisabledElement(isEnabled1), "input with name=\"disabled\" should not disable options (bug 1263589)");
ok(!SelectHelper._isDisabledElement(isEnabled2), "<form disabled> is not valid and will have no effect.");
// test options are disabled when expected...
let isNotEnabled1 = document.getElementById("is_not_enabled_1");
--- a/mobile/android/tests/browser/chrome/test_simple_discovery.html
+++ b/mobile/android/tests/browser/chrome/test_simple_discovery.html
@@ -9,17 +9,17 @@ Migrated from Robocop: https://bugzilla.
<title>Test for Bug 938571</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
"use strict";
- /*globals SimpleServiceDiscovery */
+ /* globals SimpleServiceDiscovery */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm");
function discovery_observer(subject, topic, data) {
dump("Observer: " + data);
--- a/mobile/android/tests/browser/chrome/test_video_discovery.html
+++ b/mobile/android/tests/browser/chrome/test_video_discovery.html
@@ -9,17 +9,17 @@ Migrated from Robocop: https://bugzilla.
<title>Test for Bug 953381</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
<script type="application/javascript">
"use strict";
- /*globals SimpleServiceDiscovery */
+ /* globals SimpleServiceDiscovery */
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/SimpleServiceDiscovery.jsm");
// The chrome window
let chromeWin;
--- a/mobile/android/tests/browser/chrome/test_web_channel.html
+++ b/mobile/android/tests/browser/chrome/test_web_channel.html
@@ -8,24 +8,24 @@ Migrated from Robocop: https://bugzilla.
<meta charset="utf-8">
<title>Test for Bug 1174458</title>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SpawnTask.js"></script>
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
<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";
const gChromeWin = Services.wm.getMostRecentWindow("navigator:browser");
let BrowserApp = gChromeWin.BrowserApp;
// TODO: consider if we want to run the original test in browser-chrome instead
@@ -35,17 +35,17 @@ Migrated from Robocop: https://bugzilla.
// tests on Android. Yet?)
let gTests = [
{
desc: "WebChannel generic message",
run: function* () {
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();
BrowserApp.closeTab(tab);
resolve();
});
tab = BrowserApp.addTab(HTTP_PATH + HTTP_ENDPOINT + "?generic");
@@ -54,17 +54,17 @@ Migrated from Robocop: https://bugzilla.
},
{
desc: "WebChannel two way communication",
run: function* () {
return new Promise(function(resolve, reject) {
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);
if (message.command === "one") {
channel.send({ data: { nested: true } }, sender);
}
if (message.command === "two") {
@@ -81,17 +81,17 @@ Migrated from Robocop: https://bugzilla.
},
{
desc: "WebChannel multichannel",
run: function* () {
return new Promise(function(resolve, reject) {
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();
});
tab = BrowserApp.addTab(HTTP_PATH + HTTP_ENDPOINT + "?multichannel");
});
}
--- a/mobile/android/tests/browser/robocop/reader_mode_pages/developer.mozilla.org/en/XULRunner/Build_Instructions.html
+++ b/mobile/android/tests/browser/robocop/reader_mode_pages/developer.mozilla.org/en/XULRunner/Build_Instructions.html
@@ -351,23 +351,23 @@ make -f client.mk build
<script src="../../en-US/jsi18n/build:f424781"></script>
<script src="../../../www.google.com/jsapi" type="text/javascript"></script>
<script src="../../../login.persona.org/include.js" type="text/javascript" async></script>
<script src="../../../www.mozilla.org/tabzilla/media/js/tabzilla.js" async></script>
<script src="../../media/js/mdn-min.js%3Fbuild=f424781"></script>
<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&WT.js=No&WT.tv=8.6.2"/></div>
</noscript>
</body>
</html>
--- a/mobile/android/tests/browser/robocop/robocop_head.js
+++ b/mobile/android/tests/browser/robocop/robocop_head.js
@@ -165,17 +165,17 @@ function _dump_exception_stack(stack) {
if (parts)
dump("JS frame :: " + parts[2] + " :: " + (parts[1] ? parts[1] : "anonymous")
+ " :: line " + parts[3] + "\n");
else /* Could be a -e (command line string) style location. */
dump("JS frame :: " + frame + "\n");
});
}
-/************** Functions to be used from the tests **************/
+/** ************ Functions to be used from the tests **************/
/**
* Prints a message to the output log.
*/
function do_print(msg) {
var caller_stack = Components.stack.caller;
_dump("TEST-INFO | " + caller_stack.filename + " | " + msg + "\n");
}
@@ -286,17 +286,17 @@ function _do_check_neq(left, right, stac
stack = Components.stack.caller;
var text = left + " != " + right;
if (left == right) {
if (!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) {
_dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
stack.lineNumber + "] " + text + "\n");
} else {
do_throw_todo(text, stack);
}
@@ -323,17 +323,17 @@ function do_report_result(passed, text,
do_throw_todo(text, stack);
} else {
_dump("TEST-PASS | " + stack.filename + " | [" + stack.name + " : " +
stack.lineNumber + "] " + text + "\n");
}
} else {
if (todo) {
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
- " : " + stack.lineNumber + "] " + text +"\n");
+ " : " + stack.lineNumber + "] " + text + "\n");
} else {
do_throw(text, stack);
}
}
}
/**
* Checks for a true condition, with a success message.
@@ -395,21 +395,21 @@ function do_check_false(condition, stack
function todo_check_false(condition, stack) {
if (!stack)
stack = Components.stack.caller;
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);
}
/**
* Check that |value| matches |pattern|.
*
* A |value| matches a pattern |pattern| if any one of the following is true:
*
@@ -470,32 +470,32 @@ function todo_check_null(condition, stac
* - We don't check for proxies or getters.
* - We don't check the prototype chain.
* However, if you know the values are, say, JSON, which is pretty
* well-behaved, and if you want to tolerate additional properties
* appearing on the JSON for backward-compatibility, then do_check_matches
* 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 = []
if (matcher(value, diagnosis)) {
do_report_result(true, "value matches pattern:\n" + text, stack, todo);
} else {
text = ("value doesn't match pattern:\n" +
text +
"DIAGNOSIS: " +
format_pattern_match_failure(diagnosis[0]) + "\n");
do_report_result(false, text, stack, todo);
}
}
-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);
}
// Return a pattern-matching function of one argument, |value|, that
// returns true if |value| matches |pattern|.
//
// If the pattern doesn't match, and the pattern-matching function was
// passed its optional |diagnosis| argument, the pattern-matching function
@@ -517,44 +517,44 @@ function pattern_matcher(pattern) {
matchers.push([p, pattern_matcher(pattern[p])]);
}
// Kludge: include 'length', if not enumerable. (If it is enumerable,
// we picked it up in the array comprehension, above.
ld = Object.getOwnPropertyDescriptor(pattern, 'length');
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");
}
for (let [p, m] of matchers) {
var element_diagnosis = [];
if (!(p in value && m(value[p], element_diagnosis))) {
return explain(diagnosis, { property: p,
diagnosis: element_diagnosis[0] });
}
}
return true;
};
} 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));
}
return true;
};
}
}
// 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.";
} else if (typeof diagnosis == "string") {
a = diagnosis;
} else if (diagnosis.property) {
a = "Property " + uneval(diagnosis.property) + " of object didn't match:\n";
a += format_pattern_match_failure(diagnosis.diagnosis, indent + " ");
@@ -780,27 +780,27 @@ function JavaBridge(obj) {
JavaBridge.prototype = {
_Services: Components.utils.import(
"resource://gre/modules/Services.jsm", {}).Services,
_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),
};
for (let i = 1; i < args.length; i++) {
out[i - 1] = args[i];
}
return out;
},
- _sendMessage: function (innerType, args) {
+ _sendMessage: function(innerType, args) {
this._EventDispatcher.dispatch(this._JAVA_EVENT_TYPE, {
innerType: innerType,
method: args[0],
args: this._getArgs(args),
});
},
onEvent: function(event, message, callback) {
@@ -823,36 +823,36 @@ JavaBridge.prototype = {
this._sendMessage("sync-reply", [message.method]);
}
},
/**
* 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;
// Need one more reply to answer the current sync call.
this._repliesNeeded++;
// Wait for the reply to arrive. Normally we would not want to
// spin the event loop, but here we're in a test and our API
// specifies a synchronous call, so we spin the loop to wait for
// the call to finish.
this._Services.tm.spinEventLoopUntil(() => this._repliesNeeded <= initialReplies);
},
/**
* 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);
},
};
--- a/mobile/android/tests/browser/robocop/robocop_login_01.html
+++ b/mobile/android/tests/browser/robocop/robocop_login_01.html
@@ -1,13 +1,13 @@
<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>
<head>
<title>Robocop Login</title>
<meta charset="utf-8">
</head>
<body onload="login()">
--- a/mobile/android/tests/browser/robocop/robocop_login_02.html
+++ b/mobile/android/tests/browser/robocop/robocop_login_02.html
@@ -1,13 +1,13 @@
<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>
<head>
<title>Robocop Login</title>
<meta charset="utf-8">
</head>
<body onload="login()">
--- a/mobile/android/tests/browser/robocop/robocop_testharness.js
+++ b/mobile/android/tests/browser/robocop/robocop_testharness.js
@@ -53,17 +53,17 @@ function testOneFile(uri) {
let testScope = SpecialPowers.Cu.Sandbox(principal);
// Populate test environment with test harness prerequisites.
testScope.Components = SpecialPowers.Components;
testScope._TEST_FILE = 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,
};
sendMessageToJava(message);
};
// Populate test environment with test harness. The symbols defined
--- a/mobile/android/tests/browser/robocop/roboextender/bootstrap.js
+++ b/mobile/android/tests/browser/robocop/roboextender/bootstrap.js
@@ -34,17 +34,17 @@ var windowListener = {
onWindowTitleChange: function(aWindow, aTitle) { }
};
function startup(aData, aReason) {
let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator);
// 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);
}, "Robocop:Quit");
}
function shutdown(aData, aReason) {
// When the application is shutting down we normally don't have to clean up any UI changes
--- a/mobile/android/tests/browser/robocop/testEventDispatcher.js
+++ b/mobile/android/tests/browser/robocop/testEventDispatcher.js
@@ -115,17 +115,17 @@ function check_response(key, response) {
if (expected !== null && typeof expected === "object") {
listener._checkObject(response);
} else {
do_check_eq(response, expected);
}
}
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);
do_check_eq(obj.booleanArray[1], true);
do_check_eq(obj.int, 1);
do_check_eq(obj.intArray.length, 2);
do_check_eq(obj.intArray[0], 2);
@@ -158,17 +158,17 @@ let listener = {
do_check_eq(obj.nullDoubleArray, null);
do_check_eq(obj.nullStringArray, null);
do_check_eq(obj.mixedArray.length, 2);
do_check_eq(obj.mixedArray[0], 1);
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++;
this._checkObject(data);
this._checkObject(data.object);
do_check_eq(data.nullObject, null);
@@ -181,17 +181,17 @@ let listener = {
do_check_eq(data.objectArrayOfNull[1], null);
do_check_eq(data.emptyObjectArray.length, 0);
do_check_eq(data.nullObjectArray, null);
}
};
let callbackListener = {
- onEvent: function (event, data, callback) {
+ onEvent: function(event, data, callback) {
do_check_eq(event, this._type);
this._callCount++;
if (data.mode == "success") {
callback.onSuccess(get_test_message()[data.key]);
} else if (data.mode == "error") {
callback.onError(get_test_message()[data.key]);
} else {
--- a/mobile/android/tests/browser/robocop/testHistoryService.js
+++ b/mobile/android/tests/browser/robocop/testHistoryService.js
@@ -12,25 +12,25 @@ Cu.import("resource://gre/modules/Servic
// Make the timer global so it doesn't get GC'd
var gTimer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
function sleep(wait) {
return new Promise((resolve, reject) => {
do_print("sleep start");
gTimer.initWithCallback({
- notify: function () {
+ notify: function() {
do_print("sleep end");
resolve();
},
}, wait, gTimer.TYPE_ONE_SHOT);
});
}
-function promiseLoadEvent(browser, url, eventType="load") {
+function promiseLoadEvent(browser, url, eventType = "load") {
return new Promise((resolve, reject) => {
do_print("Wait browser event: " + eventType);
function handle(event) {
// Since we'll be redirecting, don't make assumptions about the given URL and the loaded URL
if (event.target != browser.contentDocument || event.target.location.href == "about:blank") {
do_print("Skipping spurious '" + eventType + "' event" + " for " + event.target.location.href);
return;
--- a/mobile/android/tests/browser/robocop/testReadingListCache.js
+++ b/mobile/android/tests/browser/robocop/testReadingListCache.js
@@ -1,14 +1,14 @@
// -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
/* 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/. */
-/*globals ReaderMode */
+/* globals ReaderMode */
var { utils: Cu } = Components;
Cu.import("resource://gre/modules/ReaderMode.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Task.jsm");
var Reader = Services.wm.getMostRecentWindow("navigator:browser").Reader;
--- a/mobile/android/tests/browser/robocop/testSnackbarAPI.js
+++ b/mobile/android/tests/browser/robocop/testSnackbarAPI.js
@@ -9,17 +9,17 @@ Cu.import("resource://gre/modules/XPCOMU
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher", "resource://gre/modules/Messaging.jsm");
add_task(function* test_snackbar_api() {
Snackbars.show("This is a Snackbar", Snackbars.LENGTH_INDEFINITE, {
action: {
label: "Click me",
- callback: function () {}
+ callback: function() {}
}
});
yield EventDispatcher.instance.sendRequestForResult({
type: "Robocop:WaitOnUI"
});
});
--- a/mobile/android/tests/browser/robocop/testTrackingProtection.js
+++ b/mobile/android/tests/browser/robocop/testTrackingProtection.js
@@ -6,17 +6,17 @@
"use strict";
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
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);
function handle(event) {
if (event.target != browser.contentDocument || event.target.location.href == "about:blank" || (url && event.target.location.href != url)) {
do_print("Skipping spurious '" + eventType + "' event" + " for " + event.target.location.href);
return;
}
--- a/mobile/android/tests/browser/robocop/testUITelemetry.js
+++ b/mobile/android/tests/browser/robocop/testUITelemetry.js
@@ -87,38 +87,38 @@ add_test(function test_telemetry_events(
["session", SESSION_STOPPED_TWICE, REASON_TEST2],
["event", EVENT_TEST1, METHOD_NONE, [], undefined],
]);
let clearMeasurements = false;
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.
}
do_check_measurement_eq(expected[i], m);
});
- expected.forEach(function (m, i) {
+ expected.forEach(function(m, i) {
do_check_measurement_eq(m, measurements[i]);
});
run_next_test();
});
/**
* Converts the expected value arrays to objects,
* 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 {
type: type,
action: arr[1],
method: arr[2],
sessions: arr[3].sort(), // Sort, just in case it's not sorted by hand!
extras: arr[4],
@@ -130,25 +130,25 @@ function expectedArraysToObjs(expectedAr
name: arr[1],
reason: arr[2],
};
}
});
}
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") {
return measurement.name.startsWith("_test_session_");
}
return false;
});
}
function removeNonTestSessions(sessions) {
- return sessions.filter(function (sessionName) {
+ return sessions.filter(function(sessionName) {
return sessionName.startsWith("_test_session_");
});
}
run_next_test();
--- a/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js
+++ b/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js
@@ -10,38 +10,38 @@ do_test_pending();
var isClientIDSet;
var clientID;
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).
//
// Note that my brief attempts to get synchronous Promise resolution (via Task.jsm)
// 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);
});
}
function pollGetAsyncClientId() {
java.asyncCall('blockingFromJsResponseString', isClientIDSet, clientID);
}
function getAsyncReset() {
isResetDone = false;
- ClientID._reset().then(function () {
+ ClientID._reset().then(function() {
isResetDone = true;
});
}
function pollGetAsyncReset() {
java.asyncCall('blockingFromJsResponseString', isResetDone, '');
}