--- a/mobile/android/.eslintrc.js
+++ b/mobile/android/.eslintrc.js
@@ -3,24 +3,22 @@
module.exports = {
rules: {
// XXX Bug 1358949 - This should be reduced down - probably to 20 or to
// be removed & synced with the mozilla/recommended value.
"complexity": ["error", 31],
// Rules enabled in mozilla/recommended, and disabled for now, we should
// re-enable these over time.
- "brace-style": "off",
"consistent-return": "off",
"no-empty": "off",
"no-native-reassign": "off",
"no-nested-ternary": "off",
"no-new-object": "off",
"no-octal": "off",
"no-redeclare": "off",
"no-useless-call": "off",
"no-useless-concat": "off",
"no-undef": "off",
"no-unused-vars": "off",
"object-shorthand": "off",
- "quotes": "off", // [2, "double"]
}
};
--- a/mobile/android/chrome/content/ActionBarHandler.js
+++ b/mobile/android/chrome/content/ActionBarHandler.js
@@ -34,24 +34,24 @@ var ActionBarHandler = {
// Close an open ActionBar, if carets no longer logically visible.
if (this._selectionID && !e.caretVisible) {
this._uninit(false);
return;
}
if (!this._selectionID && e.collapsed) {
switch (e.reason) {
- case 'longpressonemptycontent':
- case 'taponcaret':
+ case "longpressonemptycontent":
+ case "taponcaret":
// Show ActionBar when long pressing on an empty input or single
// tapping on the caret.
this._init(e.boundingClientRect);
break;
- case 'updateposition':
+ case "updateposition":
// Do not show ActionBar when single tapping on an non-empty editable
// input.
break;
default:
break;
}
return;
@@ -62,24 +62,24 @@ var ActionBarHandler = {
this._init(e.boundingClientRect);
return;
}
// Else, update an open ActionBar.
if (this._selectionID) {
if (!this._selectionHasChanged()) {
// Still the same active selection.
- if (e.reason == 'presscaret' || e.reason == 'scroll') {
+ if (e.reason == "presscaret" || e.reason == "scroll") {
// boundingClientRect doesn't matter since we are hiding the floating
// toolbar.
this._updateVisibility();
} else {
// Selection changes update boundingClientRect.
this._boundingClientRect = e.boundingClientRect;
- let forceUpdate = e.reason == 'updateposition' || e.reason == 'releasecaret';
+ let forceUpdate = e.reason == "updateposition" || e.reason == "releasecaret";
this._sendActionBarActions(forceUpdate);
}
} else {
// We've started a new selection entirely.
this._uninit(false);
this._init(e.boundingClientRect);
}
}
--- a/mobile/android/chrome/content/FeedHandler.js
+++ b/mobile/android/chrome/content/FeedHandler.js
@@ -47,18 +47,17 @@ var FeedHandler = {
try {
let type = branch.getCharPref("type");
let uri = branch.getComplexValue("uri", Ci.nsIPrefLocalizedString).data;
let title = branch.getComplexValue("title", Ci.nsIPrefLocalizedString).data;
if (!(type in this._contentTypes))
this._contentTypes[type] = [];
this._contentTypes[type].push({ contentType: type, uri: uri, name: title });
- }
- catch (ex) {}
+ } catch (ex) {}
}
},
onEvent: function fh_onEvent(event, args, callback) {
if (event === "Feeds:Subscribe") {
let tab = BrowserApp.getTabForId(args.tabId);
if (!tab)
return;
--- a/mobile/android/chrome/content/InputWidgetHelper.js
+++ b/mobile/android/chrome/content/InputWidgetHelper.js
@@ -25,20 +25,20 @@ var InputWidgetHelper = {
return;
this._uiBusy = true;
this.show(aTarget);
this._uiBusy = false;
},
show: function(aElement) {
- let type = aElement.getAttribute('type');
+ let type = aElement.getAttribute("type");
let p = new Prompt({
window: aElement.ownerGlobal,
- title: this.strings().GetStringFromName("inputWidgetHelper." + aElement.getAttribute('type')),
+ title: this.strings().GetStringFromName("inputWidgetHelper." + aElement.getAttribute("type")),
buttons: [
this.strings().GetStringFromName("inputWidgetHelper.set"),
this.strings().GetStringFromName("inputWidgetHelper.clear"),
this.strings().GetStringFromName("inputWidgetHelper.cancel")
],
}).addDatePicker({
value: aElement.value,
type: type,
@@ -70,17 +70,17 @@ var InputWidgetHelper = {
});
},
hasInputWidget: function(aElement) {
let win = aElement.ownerGlobal;
if (!(aElement instanceof win.HTMLInputElement))
return false;
- let type = aElement.getAttribute('type');
+ let type = aElement.getAttribute("type");
if (type == "date" || type == "datetime" || type == "datetime-local" ||
type == "week" || type == "month" || type == "time") {
return true;
}
return false;
},
--- 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;
},
@@ -70,22 +70,22 @@ 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) {
- 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')
+ 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;
return NodeFilter.FILTER_REJECT;
}
let nodeWalker = aDoc.createTreeWalker(aDoc.body, NodeFilter.SHOW_TEXT, filterNode, false);
let parseNode = () => {
let node = nodeWalker.nextNode();
if (!node) {
--- a/mobile/android/chrome/content/RemoteDebugger.js
+++ b/mobile/android/chrome/content/RemoteDebugger.js
@@ -55,17 +55,17 @@ var RemoteDebugger = {
this._promptingForAllow = this._promptForTCP(session);
}
this._promptingForAllow.then(() => this._promptingForAllow = null);
return this._promptingForAllow;
},
_promptForUSB(session) {
- if (session.authentication !== 'PROMPT') {
+ if (session.authentication !== "PROMPT") {
// This dialog is not prepared for any other authentication method at
// this time.
return DebuggerServer.AuthenticationResult.DENY;
}
return new Promise(resolve => {
let title = Strings.browser.GetStringFromName("remoteIncomingPromptTitle");
let msg = Strings.browser.GetStringFromName("remoteIncomingPromptUSB");
@@ -89,17 +89,17 @@ var RemoteDebugger = {
} else {
resolve(DebuggerServer.AuthenticationResult.DENY);
}
});
});
},
_promptForTCP(session) {
- if (session.authentication !== 'OOB_CERT' || !session.client.cert) {
+ if (session.authentication !== "OOB_CERT" || !session.client.cert) {
// This dialog is not prepared for any other authentication method at
// this time.
return DebuggerServer.AuthenticationResult.DENY;
}
return new Promise(resolve => {
let title = Strings.browser.GetStringFromName("remoteIncomingPromptTitle");
let msg = Strings.browser.formatStringFromName("remoteIncomingPromptTCP", [
--- a/mobile/android/chrome/content/WebcompatReporter.js
+++ b/mobile/android/chrome/content/WebcompatReporter.js
@@ -82,17 +82,17 @@ var WebcompatReporter = {
let x = win.document.documentElement.scrollLeft;
let y = win.document.documentElement.scrollTop;
let w = win.innerWidth;
let h = win.innerHeight;
// Scale according to devicePixelRatio and coordinates
canvas.width = dpr * w;
canvas.height = dpr * h;
ctx.scale(dpr, dpr);
- ctx.drawWindow(win, x, y, w, h, '#ffffff');
+ ctx.drawWindow(win, x, y, w, h, "#ffffff");
let screenshot = canvas.toDataURL();
resolve({tab: tab, data: screenshot});
} catch (e) {
// drawWindow can fail depending on memory or surface size. Rather than reject here,
// we resolve the URL so the user can continue to file an issue without a screenshot.
Cu.reportError("WebCompatReporter: getting a screenshot failed: " + e);
resolve({tab: tab});
}
--- a/mobile/android/chrome/content/WebrtcUI.js
+++ b/mobile/android/chrome/content/WebrtcUI.js
@@ -37,17 +37,18 @@ var WebrtcUI = {
} else if (aTopic === "getUserMedia:request") {
RuntimePermissions
.checkPermissions(this._determineNeededRuntimePermissions(aSubject))
.then((permissionGranted) => {
if (permissionGranted) {
WebrtcUI.handleGumRequest(aSubject, aTopic, aData);
} else {
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aSubject.callID);
- } });
+ }
+});
} else if (aTopic === "PeerConnection:request") {
this.handlePCRequest(aSubject, aTopic, aData);
} else if (aTopic === "recording-device-events") {
switch (aData) {
case "shutdown":
case "starting":
this.notify();
break;
--- a/mobile/android/chrome/content/aboutAccounts.js
+++ b/mobile/android/chrome/content/aboutAccounts.js
@@ -42,45 +42,45 @@ XPCOMUtils.defineLazyServiceGetter(this,
// Shows the toplevel element with |id| to be shown - all other top-level
// elements are hidden.
// If |id| is 'spinner', then 'remote' is also shown, with opacity 0.
function show(id) {
let allTop = document.querySelectorAll(".toplevel");
for (let elt of allTop) {
if (elt.getAttribute("id") == id) {
- elt.style.display = 'block';
+ elt.style.display = "block";
} else {
- elt.style.display = 'none';
+ elt.style.display = "none";
}
}
- if (id == 'spinner') {
- document.getElementById('remote').style.display = 'block';
- document.getElementById('remote').style.opacity = 0;
+ if (id == "spinner") {
+ document.getElementById("remote").style.display = "block";
+ document.getElementById("remote").style.opacity = 0;
}
}
// Each time we try to load the remote <iframe>, loadedDeferred is replaced. It
// is resolved by a LOADED message, and rejected by a failure to load.
var loadedDeferred = null;
// We have a new load starting. Replace the existing promise with a new one,
// and queue up the transition to remote content.
function deferTransitionToRemoteAfterLoaded() {
- log.d('Waiting for LOADED message.');
+ log.d("Waiting for LOADED message.");
loadedDeferred = PromiseUtils.defer();
loadedDeferred.promise.then(() => {
- log.d('Got LOADED message!');
+ log.d("Got LOADED message!");
document.getElementById("remote").style.opacity = 0;
show("remote");
document.getElementById("remote").style.opacity = 1;
})
.catch((e) => {
- log.w('Did not get LOADED message: ' + e.toString());
+ log.w("Did not get LOADED message: " + e.toString());
});
}
function handleLoadedMessage(message) {
loadedDeferred.resolve();
}
var wrapper = {
@@ -177,18 +177,18 @@ function openPrefs() {
function getURLForAction(action, urlParams) {
let url = Services.urlFormatter.formatURLPref("identity.fxaccounts.remote.webchannel.uri");
url = url + (url.endsWith("/") ? "" : "/") + action;
const CONTEXT = "fx_fennec_v1";
// The only service managed by Fennec, to date, is Firefox Sync.
const SERVICE = "sync";
urlParams = urlParams || new URLSearchParams("");
- urlParams.set('service', SERVICE);
- urlParams.set('context', CONTEXT);
+ urlParams.set("service", SERVICE);
+ urlParams.set("context", CONTEXT);
// Ideally we'd just merge urlParams with new URL(url).searchParams, but our
// URLSearchParams implementation doesn't support iteration (bug 1085284).
let urlParamStr = urlParams.toString();
if (urlParamStr) {
url += (url.includes("?") ? "&" : "?") + urlParamStr;
}
return url;
}
@@ -293,21 +293,21 @@ function init() {
}
}).catch(e => {
log.e("Failed to get the signed in user: " + e.toString());
});
}
document.addEventListener("DOMContentLoaded", function() {
init();
- var buttonRetry = document.getElementById('buttonRetry');
- buttonRetry.addEventListener('click', retry);
+ var buttonRetry = document.getElementById("buttonRetry");
+ buttonRetry.addEventListener("click", retry);
- var buttonOpenPrefs = document.getElementById('buttonOpenPrefs');
- buttonOpenPrefs.addEventListener('click', openPrefs);
+ var buttonOpenPrefs = document.getElementById("buttonOpenPrefs");
+ buttonOpenPrefs.addEventListener("click", openPrefs);
}, {capture: true, once: true});
// This window is contained in a XUL <browser> element. Return the
// messageManager of that <browser> element, or null.
function getBrowserMessageManager() {
let browser = window
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
@@ -326,23 +326,23 @@ function getBrowserMessageManager() {
// Add a single listener for 'loaded' messages from the iframe in this
// <browser>. These 'loaded' messages are ferried from the WebChannel to just
// this <browser>.
var mm = getBrowserMessageManager();
if (mm) {
mm.addMessageListener(COMMAND_LOADED, handleLoadedMessage);
} else {
- log.e('No messageManager, not listening for LOADED message!');
+ log.e("No messageManager, not listening for LOADED message!");
}
window.addEventListener("unload", function(event) {
try {
let mm = getBrowserMessageManager();
if (mm) {
mm.removeMessageListener(COMMAND_LOADED, handleLoadedMessage);
}
} catch (e) {
// This could fail if the page is being torn down, the tab is being
// destroyed, etc.
- log.w('Not removing listener for LOADED message: ' + e.toString());
+ log.w("Not removing listener for LOADED message: " + e.toString());
}
});
--- a/mobile/android/chrome/content/aboutCertError.xhtml
+++ b/mobile/android/chrome/content/aboutCertError.xhtml
@@ -34,60 +34,57 @@
// about:certerror?e=error&u=url&d=desc
// Note that this file uses document.documentURI to get
// the URL (with the format from above). This is because
// document.location.href gets the current URI off the docshell,
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.
- function getCSSClass()
- {
+ function getCSSClass() {
var url = document.documentURI;
var matches = url.match(/s\=([^&]+)\&/);
// s is optional, if no match just return nothing
if (!matches || matches.length < 2)
return "";
// parenthetical match is the second entry
return decodeURIComponent(matches[1]);
}
- function getDescription()
- {
+ function getDescription() {
var url = document.documentURI;
var desc = url.search(/d\=/);
// desc == -1 if not found; if so, return an empty string
// instead of what would turn out to be portions of the URI
if (desc == -1)
return "";
return decodeURIComponent(url.slice(desc + 2));
}
- function initPage()
- {
+ function initPage() {
// Replace the "#1" string in the intro with the hostname. Trickier
// than it might seem since we want to preserve the <b> tags, but
// not allow for any injection by just using innerHTML. Instead,
// just find the right target text node.
- var intro = document.getElementById('introContentP1');
+ var intro = document.getElementById("introContentP1");
function replaceWithHost(node) {
if (node.textContent == "#1")
node.textContent = location.host;
else
for (var i = 0; i < node.childNodes.length; i++)
replaceWithHost(node.childNodes[i]);
}
replaceWithHost(intro);
if (getCSSClass() == "expertBadCert") {
- toggle('technicalContent');
- toggle('expertContent');
+ toggle("technicalContent");
+ toggle("expertContent");
}
// Disallow overrides if this is a Strict-Transport-Security
// host and the cert is bad (STS Spec section 7.3) or if the
// certerror is in a frame (bug 633691).
if (getCSSClass() == "badStsCert" || window != top)
document.getElementById("expertContent").setAttribute("hidden", "true");
@@ -144,17 +141,17 @@
}
createLink(sd, "errorCode", codeResult[1])
// Finally, append text for anything after the last closing </a>.
sd.appendChild(document.createTextNode(desc.slice(desc.lastIndexOf("</a>") + "</a>".length)));
}
// Then initialize the cert domain link.
- var link = document.getElementById('cert_domain_link');
+ var link = document.getElementById("cert_domain_link");
if (!link)
return;
var okHost = link.getAttribute("title");
var thisHost = document.location.hostname;
var proto = document.location.protocol;
// If okHost is a wildcard domain ("*.example.com") let's
--- a/mobile/android/chrome/content/aboutLogins.js
+++ b/mobile/android/chrome/content/aboutLogins.js
@@ -256,18 +256,17 @@ var Logins = {
domainField.value = login.hostname;
let img = document.getElementById("favicon");
this._loadFavicon(img, login.hostname);
let headerText = document.getElementById("edit-login-header-text");
if (login.hostname && (login.hostname != "")) {
headerText.textContent = login.hostname;
- }
- else {
+ } else {
headerText.textContent = gStringBundle.GetStringFromName("editLogin.fallbackTitle");
}
passwordField.addEventListener("input", (event) => {
let newPassword = passwordField.value;
let updateBtn = document.getElementById("update-btn");
if (newPassword === "") {
--- a/mobile/android/chrome/content/bindings/checkbox.xml
+++ b/mobile/android/chrome/content/bindings/checkbox.xml
@@ -49,18 +49,17 @@
<method name="setChecked">
<parameter name="aValue"/>
<body>
<![CDATA[
var change = (aValue != this.checked);
if (aValue) {
this.setAttribute("checked", "true");
this._group.selectedItem = this._on;
- }
- else {
+ } else {
this.removeAttribute("checked");
this._group.selectedItem = this._off;
}
if (change) {
var event = document.createEvent("Events");
event.initEvent("CheckboxStateChange", true, true);
this.dispatchEvent(event);
--- a/mobile/android/chrome/content/blockedSite.xhtml
+++ b/mobile/android/chrome/content/blockedSite.xhtml
@@ -27,26 +27,24 @@
// (o=1 when user overrides are allowed)
// Note that this file uses document.documentURI to get
// the URL (with the format from above). This is because
// document.location.href gets the current URI off the docshell,
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.
- function getErrorCode()
- {
+ function getErrorCode() {
var url = document.documentURI;
var error = url.search(/e\=/);
var duffUrl = url.search(/\&u\=/);
return decodeURIComponent(url.slice(error + 2, duffUrl));
}
- function getURL()
- {
+ function getURL() {
var url = document.documentURI;
var match = url.match(/&u=([^&]+)&/);
// match == null if not found; if so, return an empty string
// instead of what would turn out to be portions of the URI
if (!match)
return "";
@@ -57,38 +55,35 @@
url = url.slice(12);
return url;
}
/**
* Check whether this warning page should be overridable or whether
* the "ignore warning" button should be hidden.
*/
- function getOverride()
- {
+ function getOverride() {
var url = document.documentURI;
var match = url.match(/&o=1&/);
return !!match;
}
/**
* Attempt to get the hostname via document.location. Fail back
* to getURL so that we always return something meaningful.
*/
- function getHostString()
- {
+ function getHostString() {
try {
return document.location.hostname;
} catch (e) {
return getURL();
}
}
- function initPage()
- {
+ function initPage() {
var error = "";
switch (getErrorCode()) {
case "malwareBlocked" :
error = "malware";
break;
case "deceptiveBlocked" :
error = "phishing";
break;
--- a/mobile/android/chrome/content/config.js
+++ b/mobile/android/chrome/content/config.js
@@ -496,17 +496,17 @@ var AboutConfig = {
if (!anyWhere.length) {
document.location.reload();
}
},
// Quick context menu helpers for about:config
clipboardCopy: function AC_clipboardCopy(aField) {
let pref = this._getPrefForNode(this.contextMenuLINode);
- if (aField == 'name') {
+ if (aField == "name") {
gClipboardHelper.copyString(pref.name);
} else {
gClipboardHelper.copyString(pref.value);
}
}
}
--- a/mobile/android/chrome/content/netError.xhtml
+++ b/mobile/android/chrome/content/netError.xhtml
@@ -36,94 +36,86 @@
// moz-neterror:page?e=error&u=url&s=classname&d=desc
// Note that this file uses document.documentURI to get
// the URL (with the format from above). This is because
// document.location.href gets the current URI off the docshell,
// which is the URL displayed in the location bar, i.e.
// the URI that the user attempted to load.
- function getErrorCode()
- {
+ function getErrorCode() {
var url = document.documentURI;
var error = url.search(/e\=/);
var duffUrl = url.search(/\&u\=/);
return decodeURIComponent(url.slice(error + 2, duffUrl));
}
- function getCSSClass()
- {
+ function getCSSClass() {
var url = document.documentURI;
var matches = url.match(/s\=([^&]+)\&/);
// s is optional, if no match just return nothing
if (!matches || matches.length < 2)
return "";
// parenthetical match is the second entry
return decodeURIComponent(matches[1]);
}
- function getDescription()
- {
+ function getDescription() {
var url = document.documentURI;
var desc = url.search(/d\=/);
// desc == -1 if not found; if so, return an empty string
// instead of what would turn out to be portions of the URI
if (desc == -1)
return "";
return decodeURIComponent(url.slice(desc + 2));
}
- function retryThis(buttonEl)
- {
+ function retryThis(buttonEl) {
// Note: The application may wish to handle switching off "offline mode"
// before this event handler runs, but using a capturing event handler.
// Session history has the URL of the page that failed
// to load, not the one of the error page. So, just call
// reload(), which will also repost POST data correctly.
try {
location.reload();
} catch (e) {
// We probably tried to reload a URI that caused an exception to
// occur; e.g. a nonexistent file.
}
}
- function initPage()
- {
+ function initPage() {
var err = getErrorCode();
// if it's an unknown error or there's no title or description
// defined, get the generic message
var errTitle = document.getElementById("et_" + err);
var errDesc = document.getElementById("ed_" + err);
- if (!errTitle || !errDesc)
- {
+ if (!errTitle || !errDesc) {
errTitle = document.getElementById("et_generic");
errDesc = document.getElementById("ed_generic");
}
var title = document.getElementsByClassName("errorTitleText")[0];
- if (title)
- {
+ if (title) {
title.parentNode.replaceChild(errTitle, title);
// change id to the replaced child's id so styling works
errTitle.classList.add("errorTitleText");
}
var sd = document.getElementById("errorShortDescText");
if (sd)
sd.textContent = getDescription();
var ld = document.getElementById("errorLongDesc");
- if (ld)
- {
+ if (ld) {
ld.parentNode.replaceChild(errDesc, ld);
// change id to the replaced child's id so styling works
errDesc.id = "errorLongDesc";
}
// remove undisplayed errors to avoid bug 39098
var errContainer = document.getElementById("errorContainer");
errContainer.remove();
@@ -160,18 +152,17 @@
document.getElementById("errorTryAgain").style.display = "none";
}
if (err == "nssBadCert") {
// Remove the "Try again" button for security exceptions, since it's
// almost certainly useless.
document.getElementById("errorTryAgain").style.display = "none";
document.getElementById("errorPage").setAttribute("class", "certerror");
- }
- else {
+ } else {
// Remove the override block for non-certificate errors. CSS-hiding
// isn't good enough here, because of bug 39098
var secOverride = document.getElementById("securityOverrideDiv");
secOverride.remove();
}
if (err == "inadequateSecurityError") {
// Remove the "Try again" button for HTTP/2 inadequate security as it
@@ -184,18 +175,18 @@
}
}
addDomainErrorLinks();
}
function showSecuritySection() {
// Swap link out, content in
- document.getElementById('securityOverrideContent').style.display = '';
- document.getElementById('securityOverrideLink').style.display = 'none';
+ document.getElementById("securityOverrideContent").style.display = "";
+ document.getElementById("securityOverrideLink").style.display = "none";
}
/* Try to preserve the links contained in the error description, like
the error code.
Also, in the case of SSL error pages about domain mismatch, see if
we can hyperlink the user to the correct site. We don't want
to do this generically since it allows MitM attacks to redirect
@@ -238,17 +229,17 @@
}
createLink(sd, "errorCode", codeResult[1])
// Finally, append text for anything after the last closing </a>.
sd.appendChild(document.createTextNode(desc.slice(desc.lastIndexOf("</a>") + "</a>".length)));
}
// Initialize the cert domain link.
- var link = document.getElementById('cert_domain_link');
+ var link = document.getElementById("cert_domain_link");
if (!link)
return;
var okHost = link.getAttribute("title");
var thisHost = document.location.hostname;
var proto = document.location.protocol;
// If okHost is a wildcard domain ("*.example.com") let's
--- a/mobile/android/components/AddonUpdateService.js
+++ b/mobile/android/components/AddonUpdateService.js
@@ -21,18 +21,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
"resource://gre/modules/Messaging.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm");
function getPref(func, preference, defaultValue) {
try {
return Services.prefs[func](preference);
- }
- catch (e) {}
+ } catch (e) {}
return defaultValue;
}
// -----------------------------------------------------------------------
// Add-on auto-update management service
// -----------------------------------------------------------------------
const PREF_ADDON_UPDATE_ENABLED = "extensions.autoupdate.enabled";
--- a/mobile/android/components/DirectoryProvider.js
+++ b/mobile/android/components/DirectoryProvider.js
@@ -142,18 +142,17 @@ DirectoryProvider.prototype = {
if (prop != NS_APP_SEARCH_DIR_LIST &&
prop != NS_APP_DISTRIBUTION_SEARCH_DIR_LIST)
return null;
let result = [];
if (prop == NS_APP_DISTRIBUTION_SEARCH_DIR_LIST) {
this._appendDistroSearchDirs(result);
- }
- else {
+ } else {
/**
* We want to preserve the following order, since the search service
* loads engines in first-loaded-wins order.
* - distro search plugin locations (loaded separately by the search
* service)
* - user search plugin locations (profile)
* - app search plugin location (shipped engines)
*/
--- a/mobile/android/components/FilePicker.js
+++ b/mobile/android/components/FilePicker.js
@@ -6,17 +6,17 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cc = Components.classes;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/FileUtils.jsm");
Cu.import("resource://gre/modules/Messaging.jsm");
-Cu.importGlobalProperties(['File']);
+Cu.importGlobalProperties(["File"]);
function FilePicker() {
}
FilePicker.prototype = {
_mimeTypeFilter: 0,
_extensionsFilter: "",
_defaultString: "",
@@ -204,17 +204,17 @@ FilePicker.prototype = {
type: "FilePicker:Show",
guid: this.guid,
title: this._title,
};
// Knowing the window lets us destroy any temp files when the tab is closed
// Other consumers of the file picker may have to either wait for Android
// to clean up the temp dir (not guaranteed) or clean up after themselves.
- let win = Services.wm.getMostRecentWindow('navigator:browser');
+ let win = Services.wm.getMostRecentWindow("navigator:browser");
let tab = win && win.BrowserApp.getTabForWindow(this._domWin.top)
if (tab) {
msg.tabId = tab.id;
}
if (!this._extensionsFilter && !this._mimeTypeFilter) {
// If neither filters is set show anything we can.
msg.mode = "mimeType";
--- a/mobile/android/components/FxAccountsPush.js
+++ b/mobile/android/components/FxAccountsPush.js
@@ -64,18 +64,18 @@ FxAccountsPush.prototype = {
}
});
})
.then(subscription => {
EventDispatcher.instance.sendRequest({
type: "FxAccountsPush:Subscribe:Response",
subscription: {
pushCallback: subscription.endpoint,
- pushPublicKey: urlsafeBase64Encode(subscription.getKey('p256dh')),
- pushAuthKey: urlsafeBase64Encode(subscription.getKey('auth'))
+ pushPublicKey: urlsafeBase64Encode(subscription.getKey("p256dh")),
+ pushAuthKey: urlsafeBase64Encode(subscription.getKey("auth"))
}
});
})
.catch(err => {
Log.i("Error when registering FxA push endpoint " + err);
EventDispatcher.instance.sendRequest({
type: "FxAccountsPush:Subscribe:Response",
error: err.result.toString() // Convert to string because the GeckoBundle can't getLong();
--- a/mobile/android/components/HelperAppDialog.js
+++ b/mobile/android/components/HelperAppDialog.js
@@ -107,17 +107,17 @@ HelperAppLauncherDialog.prototype = {
return mimeType != OMA_DOWNLOAD_DESCRIPTOR_MIME_TYPE;
},
/**
* Returns true if `launcher`represents a download that should not be handled by Firefox
* or a third-party app and instead be forwarded to Android's download manager.
*/
_shouldForwardToAndroidDownloadManager: function(aLauncher) {
- let forwardDownload = Services.prefs.getBoolPref('browser.download.forward_oma_android_download_manager');
+ let forwardDownload = Services.prefs.getBoolPref("browser.download.forward_oma_android_download_manager");
if (!forwardDownload) {
return false;
}
let mimeType = aLauncher.MIMEInfo.MIMEType;
if (!mimeType) {
mimeType = ContentAreaUtils.getMIMETypeForURI(aLauncher.source) || "";
}
@@ -274,20 +274,20 @@ HelperAppLauncherDialog.prototype = {
_downloadWithAndroidDownloadManager(aLauncher) {
let mimeType = aLauncher.MIMEInfo.MIMEType;
if (!mimeType) {
mimeType = ContentAreaUtils.getMIMETypeForURI(aLauncher.source) || "";
}
EventDispatcher.instance.sendRequest({
- 'type': 'Download:AndroidDownloadManager',
- 'uri': aLauncher.source.spec,
- 'mimeType': mimeType,
- 'filename': aLauncher.suggestedFileName
+ "type": "Download:AndroidDownloadManager",
+ "uri": aLauncher.source.spec,
+ "mimeType": mimeType,
+ "filename": aLauncher.suggestedFileName
});
},
_getPrefName: function getPrefName(mimetype) {
return "browser.download.preferred." + mimetype.replace("\\", ".");
},
_getMimeTypeFromLauncher: function(launcher) {
@@ -369,25 +369,23 @@ HelperAppLauncherDialog.prototype = {
collisionCount++;
if (collisionCount == 1) {
// Append "(2)" before the last dot in (or at the end of) the filename
// 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 {
+ } else {
// replace the last (n) in the filename with (n+1)
aLocalFile.leafName = aLocalFile.leafName.replace(/^(.*\()\d+\)/, "$1" + (collisionCount + 1) + ")");
}
}
aLocalFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
- }
- catch (e) {
+ } catch (e) {
dump("*** exception in validateLeafName: " + e + "\n");
if (e.result == Cr.NS_ERROR_FILE_ACCESS_DENIED)
throw e;
if (aLocalFile.leafName == "" || aLocalFile.isDirectory()) {
aLocalFile.append("unnamed");
if (aLocalFile.exists())
--- a/mobile/android/components/NSSDialogService.js
+++ b/mobile/android/components/NSSDialogService.js
@@ -199,17 +199,17 @@ NSSDialogs.prototype = {
detailLines.push(this.formatString("clientAuthAsk.storedOn",
[cert.tokenName]));
return detailLines.join("<br/>");
},
viewCertDetails: function(details) {
let p = this.getPrompt(this.getString("clientAuthAsk.message3"),
- '',
+ "",
[ this.getString("nssdialogs.ok.label") ]);
p.addLabel({ label: details });
this.showPrompt(p);
},
chooseCertificate: function(ctx, hostname, port, organization, issuerOrg,
certList, selectedIndex) {
let rememberSetting =
--- a/mobile/android/components/PersistentNotificationHandler.js
+++ b/mobile/android/components/PersistentNotificationHandler.js
@@ -4,18 +4,18 @@
"use strict";
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Messaging.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, 'Services', // jshint ignore:line
- 'resource://gre/modules/Services.jsm');
+XPCOMUtils.defineLazyModuleGetter(this, "Services", // jshint ignore:line
+ "resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyServiceGetter(this, "notificationStorage",
"@mozilla.org/notificationStorage;1",
"nsINotificationStorage");
XPCOMUtils.defineLazyServiceGetter(this, "serviceWorkerManager",
"@mozilla.org/serviceworkers/manager;1",
"nsIServiceWorkerManager");
function PersistentNotificationHandler() {
@@ -26,17 +26,17 @@ PersistentNotificationHandler.prototype
classID: Components.ID("{75390fe7-f8a3-423a-b3b1-258d7eabed40}"),
observe(subject, topic, data) {
if (Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_DEFAULT) {
Cu.import("resource://gre/modules/NotificationDB.jsm");
}
const persistentInfo = JSON.parse(data);
- if (topic === 'persistent-notification-click') {
+ if (topic === "persistent-notification-click") {
notificationStorage.getByID(persistentInfo.origin, persistentInfo.id, {
handle(id, title, dir, lang, body, tag, icon, data, behavior, serviceWorkerRegistrationScope) {
serviceWorkerManager.sendNotificationClickEvent(
persistentInfo.originSuffix,
serviceWorkerRegistrationScope,
id,
title,
dir,
@@ -45,17 +45,17 @@ PersistentNotificationHandler.prototype
tag,
icon,
data,
behavior
);
notificationStorage.delete(persistentInfo.origin, persistentInfo.id);
}
});
- } else if (topic === 'persistent-notification-close') {
+ } else if (topic === "persistent-notification-close") {
notificationStorage.getByID(persistentInfo.origin, persistentInfo.id, {
handle(id, title, dir, lang, body, tag, icon, data, behavior, serviceWorkerRegistrationScope) {
serviceWorkerManager.sendNotificationCloseEvent(
persistentInfo.originSuffix,
serviceWorkerRegistrationScope,
id,
title,
dir,
--- a/mobile/android/components/PresentationDevicePrompt.js
+++ b/mobile/android/components/PresentationDevicePrompt.js
@@ -2,18 +2,18 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
-Cu.import('resource://gre/modules/Services.jsm');
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "Prompt",
"resource://gre/modules/Prompt.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITelemetry",
"resource://gre/modules/UITelemetry.jsm");
const kPRESENTATIONDEVICEPROMPT_CONTRACTID = "@mozilla.org/presentation-device/prompt;1";
--- a/mobile/android/modules/Accounts.jsm
+++ b/mobile/android/modules/Accounts.jsm
@@ -70,19 +70,19 @@ var Accounts = Object.freeze({
type: "Accounts:Create",
extras: extras
});
},
_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'
+ 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]);
}
return newData;
},
/**
--- a/mobile/android/modules/Home.jsm
+++ b/mobile/android/modules/Home.jsm
@@ -20,17 +20,17 @@ const PREFS_PANEL_AUTH_PREFIX = "home_pa
const DEFAULT_WEIGHT = 100;
// See bug 915424
function resolveGeckoURI(aURI) {
if (!aURI)
throw "Can't resolve an empty uri";
if (aURI.startsWith("chrome://")) {
- let registry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci.nsIChromeRegistry);
+ let registry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
return registry.convertChromeURL(Services.io.newURI(aURI)).spec;
} else if (aURI.startsWith("resource://")) {
let handler = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
return handler.resolveURI(Services.io.newURI(aURI));
}
return aURI;
}
--- a/mobile/android/modules/HomeProvider.jsm
+++ b/mobile/android/modules/HomeProvider.jsm
@@ -281,23 +281,23 @@ function getDatabaseConnection() {
/**
* Validates an item to be saved to the DB.
*
* @param item
* (object) item object to be validated.
*/
function validateItem(datasetId, item) {
if (!item.url) {
- throw new ValidationError('HomeStorage: All rows must have an URL: datasetId = ' +
+ throw new ValidationError("HomeStorage: All rows must have an URL: datasetId = " +
datasetId);
}
if (!item.image_url && !item.title && !item.description) {
- throw new ValidationError('HomeStorage: All rows must have at least an image URL, ' +
- 'or a title or a description: datasetId = ' + datasetId);
+ throw new ValidationError("HomeStorage: All rows must have at least an image URL, " +
+ "or a title or a description: datasetId = " + datasetId);
}
}
var gRefreshTimers = {};
/**
* Sends a message to Java to refresh the given dataset. Delays sending
* messages to avoid successive refreshes, which can result in flashing views.
--- a/mobile/android/modules/JNI.jsm
+++ b/mobile/android/modules/JNI.jsm
@@ -5,25 +5,25 @@
// NOTE: All changes to this file should first be pushed to the repo at:
// https://github.com/cscott/skeleton-addon-fxandroid/tree/jni
var EXPORTED_SYMBOLS = ["JNI", "android_log"];
Components.utils.import("resource://gre/modules/ctypes.jsm")
-var liblog = ctypes.open('liblog.so');
+var liblog = ctypes.open("liblog.so");
var android_log = liblog.declare("__android_log_write",
ctypes.default_abi,
ctypes.int32_t,
ctypes.int32_t,
ctypes.char.ptr,
ctypes.char.ptr);
-var libxul = ctypes.open('libxul.so');
+var libxul = ctypes.open("libxul.so");
var jenvptr = ctypes.voidptr_t;
var jclass = ctypes.voidptr_t;
var jobject = ctypes.voidptr_t;
var jvalue = ctypes.voidptr_t;
var jmethodid = ctypes.voidptr_t;
var jfieldid = ctypes.voidptr_t;
@@ -788,44 +788,44 @@ function JNIUnloadClasses(jenv) {
// The refs also get added to the 'classes' object, so we should purge it too.
// That object is a hierarchical data structure organized by class path parts,
// but deleting its own properties should be sufficient to break its refs.
Object.getOwnPropertyNames(classes).forEach(function(topLevelPart) {
delete classes[topLevelPart];
});
}
-var PREFIX = 'js#';
+var PREFIX = "js#";
// this regex matches one component of a type signature:
// any number of array modifiers, followed by either a
// primitive type character or L<classname>;
var sigRegex = () => /\[*([VZBCSIJFD]|L([^.\/;]+(\/[^.\/;]+)*);)/g;
var ensureSig = function(classname_or_signature) {
// convert a classname into a signature,
// leaving unchanged signatures. We assume that
// 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, '/') + ';';
+ "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);
}
@@ -843,27 +843,27 @@ function JNIReadString(jenv, jstring_val
if ((!val) || val.isNull()) { return null; }
var chars = jenv.contents.contents.GetStringUTFChars(jenv, val, null);
var result = chars.readString();
jenv.contents.contents.ReleaseStringUTFChars(jenv, val, chars);
return result;
}
var sigInfo = {
- 'V': { name: 'Void', longName: 'Void', ctype: ctypes.void_t },
- 'Z': { name: 'Boolean', longName: 'Boolean', ctype: jboolean },
- 'B': { name: 'Byte', longName: 'Byte', ctype: jbyte },
- 'C': { name: 'Char', longName: 'Char', ctype: jchar },
- 'S': { name: 'Short', longName: 'Short', ctype: jshort },
- 'I': { name: 'Int', longName: 'Integer', ctype: jint },
- 'J': { name: 'Long', longName: 'Long', ctype: jlong },
- 'F': { name: 'Float', longName: 'Float', ctype: jfloat },
- 'D': { name: 'Double', longName: 'Double', ctype: jdouble },
- 'L': { name: 'Object', longName: 'Object', ctype: jobject },
- '[': { name: 'Object', longName: 'Object', ctype: jarray }
+ "V": { name: "Void", longName: "Void", ctype: ctypes.void_t },
+ "Z": { name: "Boolean", longName: "Boolean", ctype: jboolean },
+ "B": { name: "Byte", longName: "Byte", ctype: jbyte },
+ "C": { name: "Char", longName: "Char", ctype: jchar },
+ "S": { name: "Short", longName: "Short", ctype: jshort },
+ "I": { name: "Int", longName: "Integer", ctype: jint },
+ "J": { name: "Long", longName: "Long", ctype: jlong },
+ "F": { name: "Float", longName: "Float", ctype: jfloat },
+ "D": { name: "Double", longName: "Double", ctype: jdouble },
+ "L": { name: "Object", longName: "Object", ctype: jobject },
+ "[": { name: "Object", longName: "Object", ctype: jarray }
};
var sig2type = function(sig) { return sigInfo[sig.charAt(0)].name; };
var sig2ctype = function(sig) { return sigInfo[sig.charAt(0)].ctype; };
var sig2prim = function(sig) { return sigInfo[sig.charAt(0)].longName; };
// return the class object for a signature string.
// allocates 1 or 2 local refs
@@ -874,61 +874,61 @@ function JNIClassObj(jenv, classSig) {
// have to be looked up via their wrapper type.
var prim = function(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 '[':
+ case "[":
return jenvpp().FindClass(jenv, classSig);
- case 'L':
- classSig = classSig.substring(1, classSig.indexOf(';'));
+ case "L":
+ classSig = classSig.substring(1, classSig.indexOf(";"));
return jenvpp().FindClass(jenv, classSig);
default:
return prim(sig2prim(classSig));
}
}
// return the signature string for a Class object.
// allocates 2 local refs
function JNIClassSig(jenv, jcls) {
var jenvpp = function() { return jenv.contents.contents; };
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, '/');
+ 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';
- case 'float': return 'F';
- case 'double': return 'D';
+ 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";
+ case "float": return "F";
+ case "double": return "D";
default:
- return 'L' + name + ';';
+ return "L" + name + ";";
}
}
// 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 || {};
@@ -948,65 +948,65 @@ function JNILoadClass(jenv, classSig, op
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][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') {
+ 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('/');
+ var parts = path.split("/");
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];
}
}
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', {
+ 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'))
+ 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,
@@ -1066,40 +1066,40 @@ 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";
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++) {
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 = overloadFunc("new");
+ 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++) {
args.push(unwrap(arguments[i], jenv, argctypes[i]));
}
return wrap(j.NewObject.apply(j, args), classSig);
};
});
@@ -1117,22 +1117,22 @@ function JNILoadClass(jenv, classSig, op
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";
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++) {
args.push(unwrap(arguments[i], jenv, argctypes[i]));
}
return wrap(j[call].apply(j, args), nm);
};
});
--- a/mobile/android/modules/PageActions.jsm
+++ b/mobile/android/modules/PageActions.jsm
@@ -17,17 +17,17 @@ this.EXPORTED_SYMBOLS = ["PageActions"];
// Copied from browser.js
// TODO: We should move this method to a common importable location
function resolveGeckoURI(aURI) {
if (!aURI)
throw "Can't resolve an empty uri";
if (aURI.startsWith("chrome://")) {
- let registry = Cc['@mozilla.org/chrome/chrome-registry;1'].getService(Ci.nsIChromeRegistry);
+ let registry = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(Ci.nsIChromeRegistry);
return registry.convertChromeURL(Services.io.newURI(aURI)).spec;
} else if (aURI.startsWith("resource://")) {
let handler = Services.io.getProtocolHandler("resource").QueryInterface(Ci.nsIResProtocolHandler);
return handler.resolveURI(Services.io.newURI(aURI));
}
return aURI;
}
--- a/mobile/android/modules/RuntimePermissions.jsm
+++ b/mobile/android/modules/RuntimePermissions.jsm
@@ -27,17 +27,17 @@ var RuntimePermissions = {
*
* @returns A promise resolving to true if all the permissions have been granted or false if any of the
* permissions have been denied.
*/
waitForPermissions: function(permission) {
let permissions = [].concat(permission);
let msg = {
- type: 'RuntimePermissions:Check',
+ type: "RuntimePermissions:Check",
permissions: permissions,
shouldPrompt: true
};
let window = Services.wm.getMostRecentWindow("navigator:browser");
return window.WindowEventDispatcher.sendRequestForResult(msg);
},
@@ -46,17 +46,17 @@ var RuntimePermissions = {
*
* @returns A promise resolving to true if all the permissions are already granted or false if any of the
* permissions are not granted.
*/
checkPermissions: function(permission) {
let permissions = [].concat(permission);
let msg = {
- type: 'RuntimePermissions:Check',
+ type: "RuntimePermissions:Check",
permissions: permissions,
shouldPrompt: false
};
let window = Services.wm.getMostRecentWindow("navigator:browser");
return window.WindowEventDispatcher.sendRequestForResult(msg);
}
};
--- a/mobile/android/modules/Sanitizer.jsm
+++ b/mobile/android/modules/Sanitizer.jsm
@@ -28,34 +28,32 @@ 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();
} catch (er) {}
@@ -66,38 +64,35 @@ Sanitizer.prototype = {
imageCache.clearCache(false); // true=chrome, false=content
} catch (er) {}
TelemetryStopwatch.finish("FX_SANITIZE_CACHE", refObj);
resolve();
});
},
- get canClear()
- {
+ 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);
resolve();
});
},
- get canClear()
- {
+ get canClear() {
return true;
}
},
siteSettings: {
clear: Task.async(function* () {
let refObj = {};
TelemetryStopwatch.start("FX_SANITIZE_SITESETTINGS", refObj);
@@ -126,125 +121,112 @@ Sanitizer.prototype = {
reject(new Error("Error clearing push subscriptions: " +
status));
}
});
});
TelemetryStopwatch.finish("FX_SANITIZE_SITESETTINGS", refObj);
}),
- get canClear()
- {
+ 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) {}
resolve();
});
},
- get canClear()
- {
+ 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);
try {
Services.obs.notifyObservers(null, "browser:purge-session-history");
- }
- catch (e) { }
+ } catch (e) { }
try {
var predictor = Cc["@mozilla.org/network/predictor;1"].getService(Ci.nsINetworkPredictor);
predictor.reset();
} catch (e) { }
});
},
- get canClear()
- {
+ get canClear() {
// 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 {
// clear "Recently Closed" tabs in Android App
Services.obs.notifyObservers(null, "browser:purge-session-tabs");
- }
- catch (e) { }
+ } catch (e) { }
TelemetryStopwatch.finish("FX_SANITIZE_OPENWINDOWS", refObj);
});
},
- get canClear()
- {
+ 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()
- {
+ 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);
}
@@ -285,72 +267,65 @@ Sanitizer.prototype = {
}
}
yield Promise.all(finalizePromises);
yield DownloadIntegration.forceSave();
TelemetryStopwatch.finish("FX_SANITIZE_DOWNLOADS", refObj);
}),
- get canClear()
- {
+ get canClear() {
return true;
}
},
passwords: {
- clear: function()
- {
+ clear: function() {
return new Promise(function(resolve, reject) {
Services.logins.removeAllLogins();
resolve();
});
},
- get canClear()
- {
+ 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();
// clear FTP and plain HTTP auth sessions
Services.obs.notifyObservers(null, "net:clear-active-logins");
TelemetryStopwatch.finish("FX_SANITIZE_SESSIONS", refObj);
resolve();
});
},
- get canClear()
- {
+ 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)
- {
+ canClear: function(aCallback) {
Accounts.anySyncAccountsExist().then(aCallback)
.catch(function(err) {
Cu.reportError("Java-side synced tabs clearing failed: " + err)
aCallback(false);
});
}
}
--- a/mobile/android/modules/Snackbars.jsm
+++ b/mobile/android/modules/Snackbars.jsm
@@ -24,17 +24,17 @@ var Snackbars = {
show: function(aMessage, aDuration, aOptions) {
// Takes care of the deprecated toast calls
if (typeof aDuration === "string") {
[aDuration, aOptions] = migrateToastIfNeeded(aDuration, aOptions);
}
let msg = {
- type: 'Snackbar:Show',
+ type: "Snackbar:Show",
message: aMessage,
duration: aDuration,
};
if (aOptions && aOptions.backgroundColor) {
msg.backgroundColor = aOptions.backgroundColor;
}
@@ -59,18 +59,17 @@ var Snackbars = {
}
}
};
function migrateToastIfNeeded(aDuration, aOptions) {
let duration;
if (aDuration === "long") {
duration = LENGTH_LONG;
- }
- else {
+ } else {
duration = LENGTH_SHORT;
}
let options = {};
if (aOptions && aOptions.button) {
options.action = {
label: aOptions.button.label,
callback: () => aOptions.button.callback(),
--- a/mobile/android/modules/WebsiteMetadata.jsm
+++ b/mobile/android/modules/WebsiteMetadata.jsm
@@ -1,13 +1,13 @@
/* 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';
+"use strict";
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
this.EXPORTED_SYMBOLS = ["WebsiteMetadata"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher", "resource://gre/modules/Messaging.jsm");
@@ -27,33 +27,33 @@ var WebsiteMetadata = {
});
// No metadata was extracted, so don't bother sending it.
if (Object.keys(metadata).length === 0) {
return;
}
let msg = {
- type: 'Website:Metadata',
+ type: "Website:Metadata",
location: doc.location.href,
hasImage: metadata.image_url && metadata.image_url !== "",
metadata: JSON.stringify(metadata),
};
EventDispatcher.instance.sendRequest(msg);
});
}
};
// #################################################################################################
// # Modified version of makeUrlAbsolute() to not import url parser library (and dependencies)
// #################################################################################################
function makeUrlAbsolute(context, relative) {
- var a = context.doc.createElement('a');
+ var a = context.doc.createElement("a");
a.href = relative;
return a.href;
}
// #################################################################################################
// # page-metadata-parser
// # https://github.com/mozilla/page-metadata-parser/
// # 61c58cbd0f0bf2153df832a388a79c66b288b98c
@@ -89,94 +89,94 @@ function buildRuleset(name, rules, proce
}
return value;
}
}
};
}
const descriptionRules = [
- ['meta[property="og:description"]', node => node.element.getAttribute('content')],
- ['meta[name="description"]', node => node.element.getAttribute('content')],
+ ['meta[property="og:description"]', node => node.element.getAttribute("content")],
+ ['meta[name="description"]', node => node.element.getAttribute("content")],
];
const metadataRules = {
description: {
rules: descriptionRules
},
description_length: {
rules: descriptionRules,
processors: [
(description) => description.length
]
},
icon_url: {
rules: [
- ['link[rel="apple-touch-icon"]', node => node.element.getAttribute('href')],
- ['link[rel="apple-touch-icon-precomposed"]', node => node.element.getAttribute('href')],
- ['link[rel="icon"]', node => node.element.getAttribute('href')],
- ['link[rel="fluid-icon"]', node => node.element.getAttribute('href')],
- ['link[rel="shortcut icon"]', node => node.element.getAttribute('href')],
- ['link[rel="Shortcut Icon"]', node => node.element.getAttribute('href')],
- ['link[rel="mask-icon"]', node => node.element.getAttribute('href')],
+ ['link[rel="apple-touch-icon"]', node => node.element.getAttribute("href")],
+ ['link[rel="apple-touch-icon-precomposed"]', node => node.element.getAttribute("href")],
+ ['link[rel="icon"]', node => node.element.getAttribute("href")],
+ ['link[rel="fluid-icon"]', node => node.element.getAttribute("href")],
+ ['link[rel="shortcut icon"]', node => node.element.getAttribute("href")],
+ ['link[rel="Shortcut Icon"]', node => node.element.getAttribute("href")],
+ ['link[rel="mask-icon"]', node => node.element.getAttribute("href")],
],
processors: [
(icon_url, context) => makeUrlAbsolute(context, icon_url)
]
},
image_url: {
rules: [
- ['meta[property="og:image:secure_url"]', node => node.element.getAttribute('content')],
- ['meta[property="og:image:url"]', node => node.element.getAttribute('content')],
- ['meta[property="og:image"]', node => node.element.getAttribute('content')],
- ['meta[property="twitter:image"]', node => node.element.getAttribute('content')],
- ['meta[name="thumbnail"]', node => node.element.getAttribute('content')],
+ ['meta[property="og:image:secure_url"]', node => node.element.getAttribute("content")],
+ ['meta[property="og:image:url"]', node => node.element.getAttribute("content")],
+ ['meta[property="og:image"]', node => node.element.getAttribute("content")],
+ ['meta[property="twitter:image"]', node => node.element.getAttribute("content")],
+ ['meta[name="thumbnail"]', node => node.element.getAttribute("content")],
],
processors: [
(image_url, context) => makeUrlAbsolute(context, image_url)
],
},
keywords: {
rules: [
- ['meta[name="keywords"]', node => node.element.getAttribute('content')],
+ ['meta[name="keywords"]', node => node.element.getAttribute("content")],
],
processors: [
- (keywords) => keywords.split(',').map((keyword) => keyword.trim()),
+ (keywords) => keywords.split(",").map((keyword) => keyword.trim()),
]
},
title: {
rules: [
- ['meta[property="og:title"]', node => node.element.getAttribute('content')],
- ['meta[property="twitter:title"]', node => node.element.getAttribute('content')],
- ['meta[name="hdl"]', node => node.element.getAttribute('content')],
- ['title', node => node.element.text],
+ ['meta[property="og:title"]', node => node.element.getAttribute("content")],
+ ['meta[property="twitter:title"]', node => node.element.getAttribute("content")],
+ ['meta[name="hdl"]', node => node.element.getAttribute("content")],
+ ["title", node => node.element.text],
],
},
type: {
rules: [
- ['meta[property="og:type"]', node => node.element.getAttribute('content')],
+ ['meta[property="og:type"]', node => node.element.getAttribute("content")],
],
},
url: {
rules: [
- ['meta[property="og:url"]', node => node.element.getAttribute('content')],
- ['link[rel="canonical"]', node => node.element.getAttribute('href')],
+ ['meta[property="og:url"]', node => node.element.getAttribute("content")],
+ ['link[rel="canonical"]', node => node.element.getAttribute("href")],
],
},
provider: {
rules: [
- ['meta[property="og:site_name"]', node => node.element.getAttribute('content')]
+ ['meta[property="og:site_name"]', node => node.element.getAttribute("content")]
]
},
};
function getMetadata(doc, url, rules) {
const metadata = {};
const context = {url, doc};
const ruleSet = rules || metadataRules;
@@ -215,17 +215,17 @@ function best(iterable, by, isBetter) {
if (isBetter(key, bestKeySoFar) || isFirst) {
bestSoFar = item;
bestKeySoFar = key;
isFirst = false;
}
},
iterable);
if (isFirst) {
- throw new Error('Tried to call best() on empty iterable');
+ throw new Error("Tried to call best() on empty iterable");
}
return bestSoFar;
}
// const {max} = require('./utils');
function max(iterable, by = identity) {
return best(iterable, by, (a, b) => a > b);
}
@@ -261,17 +261,17 @@ function ruleset(...rules) {
// elements. Return the knowledgebase.
//
// This is the "rank" portion of the rank-and-yank algorithm.
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], ...]
+ 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
// digested. Rules run in no particular guaranteed order.
while (nonterminals.length) {
const [inNode, inFlavor] = nonterminals.pop();
for (let rule of getDefault(rulesByInputFlavor, inFlavor, () => [])) {
const outFacts = resultsOf(rule, inNode, inFlavor, kb);
@@ -380,17 +380,17 @@ function knowledgebase() {
};
}
// Apply a rule (as returned by a call to rule()) to a fact, and return the
// new facts that result.
function resultsOf(rule, node, flavor, kb) {
// If more types of rule pop up someday, do fancier dispatching here.
- return rule.source.flavor === 'flavor' ? resultsOfFlavorRule(rule, node, flavor) : resultsOfDomRule(rule, node, kb);
+ return rule.source.flavor === "flavor" ? resultsOfFlavorRule(rule, node, flavor) : resultsOfDomRule(rule, node, kb);
}
// Pull the DOM tree off the special property of the root "dom" fact, and query
// against it.
function *resultsOfDomRule(rule, specialDomNode, kb) {
// Use the special "tree" property of the special starting node:
const matches = specialDomNode.tree.querySelectorAll(rule.source.selector);
@@ -398,17 +398,17 @@ function *resultsOfDomRule(rule, special
for (let i = 0; i < matches.length; i++) { // matches is a NodeList, which doesn't conform to iterator protocol
const element = matches[i];
const newFacts = explicitFacts(rule.ranker(kb.nodeForElement(element)));
for (let fact of newFacts) {
if (fact.element === undefined) {
fact.element = element;
}
if (fact.flavor === undefined) {
- throw new Error('Rankers of dom() rules must return a flavor in each fact. Otherwise, there is no way for that fact to be used later.');
+ throw new Error("Rankers of dom() rules must return a flavor in each fact. Otherwise, there is no way for that fact to be used later.");
}
yield fact;
}
}
}
function *resultsOfFlavorRule(rule, node, flavor) {
@@ -464,27 +464,27 @@ function *explicitFacts(rankerResult) {
// objects that the query engine can read. They don't actually do the query
// themselves. That way, the query planner can be smarter than them, figuring
// out which indices to use based on all of them. (We'll probably keep a heap
// by each dimension's score and a hash by flavor name, for starters.) Someday,
// fancy things like this may be possible: rule(and(tag('p'), klass('snork')),
// ...)
function dom(selector) {
return {
- flavor: 'dom',
- inputFlavor: 'dom',
+ flavor: "dom",
+ inputFlavor: "dom",
selector
};
}
// Return a condition that discriminates on nodes of the knowledgebase by flavor.
function flavor(inputFlavor) {
return {
- flavor: 'flavor',
+ flavor: "flavor",
inputFlavor
};
}
function rule(source, ranker) {
return {
source,
--- a/mobile/android/modules/dbg-browser-actors.js
+++ b/mobile/android/modules/dbg-browser-actors.js
@@ -19,18 +19,17 @@ const { BrowserTabList, BrowserAddonList
* - respects the factories registered with DebuggerServer.addGlobalActor,
* - uses a MobileTabList to supply tab actors,
* - sends all navigator:browser window documents a Debugger:Shutdown event
* when it exits.
*
* * @param aConnection DebuggerServerConnection
* The conection to the client.
*/
-function createRootActor(aConnection)
-{
+function createRootActor(aConnection) {
let parameters = {
tabList: new MobileTabList(aConnection),
addonList: new BrowserAddonList(aConnection),
globalActorFactories: DebuggerServer.globalActorFactories,
onShutdown: sendShutdownEvent
};
return new RootActor(aConnection, parameters);
}
@@ -46,18 +45,17 @@ function createRootActor(aConnection)
* list" interface.)
*
* @param aConnection DebuggerServerConnection
* The connection in which this list's tab actors may participate.
*
* @see BrowserTabList for more a extensive description of how tab list objects
* work.
*/
-function MobileTabList(aConnection)
-{
+function MobileTabList(aConnection) {
BrowserTabList.call(this, aConnection);
}
MobileTabList.prototype = Object.create(BrowserTabList.prototype);
MobileTabList.prototype.constructor = MobileTabList;
MobileTabList.prototype._getSelectedBrowser = function(aWindow) {
--- a/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewContentModule.jsm
@@ -3,17 +3,17 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
this.EXPORTED_SYMBOLS = ["GeckoViewContentModule"];
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-Cu.import('resource://gre/modules/XPCOMUtils.jsm');
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "EventDispatcher",
"resource://gre/modules/Messaging.jsm");
var dump = Cu.import("resource://gre/modules/AndroidLog.jsm", {})
.AndroidLog.d.bind(null, "ViewContentModule");
function debug(aMsg) {
--- a/mobile/android/modules/geckoview/GeckoViewSettings.jsm
+++ b/mobile/android/modules/geckoview/GeckoViewSettings.jsm
@@ -45,18 +45,18 @@ class GeckoViewSettings extends GeckoVie
}
set useTrackingProtection(aUse) {
if (aUse && !this._isSafeBrowsingInit) {
SafeBrowsing.init();
this._isSafeBrowsingInit = true;
}
if (aUse != this._useTrackingProtection) {
- this.messageManager.loadFrameScript('data:,' +
- 'docShell.useTrackingProtection = ' + aUse,
+ this.messageManager.loadFrameScript("data:," +
+ "docShell.useTrackingProtection = " + aUse,
true
);
this._useTrackingProtection = aUse;
}
}
get useMultiprocess() {
return this.browser.getAttribute("remote") == "true";
--- a/mobile/android/tests/browser/chrome/test_about_logins.html
+++ b/mobile/android/tests/browser/chrome/test_about_logins.html
@@ -55,17 +55,17 @@ Migrated from Robocop: https://bugzilla.
yield promiseBrowserEvent(browser, "load");
let logins_list_parent = browser.contentDocument.getElementById("logins-list").parentNode;
let waitForLoginToBeAdded = new Promise((resolve) => {
let observer = new MutationObserver((mutations) => {
for (let mutation of mutations) {
for (let node of mutation.addedNodes) {
- if (node.id == 'logins-list') {
+ if (node.id == "logins-list") {
info("Received mutation replacing 'logins-list'");
resolve();
return;
}
}
}
info("Skipping spurious mutation not replacing 'logins-list'");
});
--- a/mobile/android/tests/browser/robocop/robocop_head.js
+++ b/mobile/android/tests/browser/robocop/robocop_head.js
@@ -8,18 +8,18 @@
// and content mochitests (where the |Components| object is accessible only as
// SpecialPowers.Components). Expose Components if necessary here to make things
// work everywhere.
//
// Even if the real |Components| doesn't exist, we might shim in a simple JS
// placebo for compat. An easy way to differentiate this from the real thing
// is whether the property is read-only or not.
{
- let c = Object.getOwnPropertyDescriptor(this, 'Components');
- if ((!c.value || c.writable) && typeof SpecialPowers === 'object')
+ let c = Object.getOwnPropertyDescriptor(this, "Components");
+ if ((!c.value || c.writable) && typeof SpecialPowers === "object")
Components = SpecialPowers.wrap(SpecialPowers.Components);
}
/*
* This file contains common code that is loaded before each test file(s).
* See http://developer.mozilla.org/en/docs/Writing_xpcshell-based_unit_tests
* for more information.
*/
@@ -44,35 +44,33 @@ function _dump(str) {
}
// Determine if we're running on parent or child
var runningInParent = true;
try {
runningInParent = Components.classes["@mozilla.org/xre/runtime;1"].
getService(Components.interfaces.nsIXULRuntime).processType
== Components.interfaces.nsIXULRuntime.PROCESS_TYPE_DEFAULT;
-}
-catch (e) { }
+} catch (e) { }
try {
if (runningInParent) {
let prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
// disable necko IPC security checks for xpcshell, as they lack the
// docshells needed to pass them
prefs.setBoolPref("network.disable.ipc.security", true);
// Disable IPv6 lookups for 'localhost' on windows.
if ("@mozilla.org/windows-registry-key;1" in Components.classes) {
prefs.setCharPref("network.dns.ipv4OnlyDomains", "localhost");
}
}
-}
-catch (e) { }
+} catch (e) { }
// Enable crash reporting, if possible
// We rely on the Python harness to set MOZ_CRASHREPORTER_NO_REPORT
// and handle checking for minidumps.
// Note that if we're in a child process, we don't want to init the
// crashreporter component.
try { // nsIXULRuntime is not available in some configurations.
if (runningInParent &&
@@ -80,18 +78,17 @@ try { // nsIXULRuntime is not available
// Remember to update </toolkit/crashreporter/test/unit/test_crashreporter.js>
// too if you change this initial setting.
let crashReporter =
Components.classes["@mozilla.org/toolkit/crash-reporter;1"]
.getService(Components.interfaces.nsICrashReporter);
crashReporter.enabled = true;
crashReporter.minidumpPath = do_get_cwd();
}
-}
-catch (e) { }
+} catch (e) { }
/**
* Date.now() is not necessarily monotonically increasing (insert sob story
* about times not being the right tool to use for measuring intervals of time,
* robarnold can tell all), so be wary of error by erring by at least
* _timerFuzz ms.
*/
const _timerFuzz = 15;
@@ -209,24 +206,22 @@ function do_execute_soon(callback) {
// has already been logged so there is no need to log it again. It's
// possible that this will mask an NS_ERROR_ABORT that happens after a
// do_check failure though.
if (!_quit || e != Components.results.NS_ERROR_ABORT) {
_dump("TEST-UNEXPECTED-FAIL | (xpcshell/head.js) | " + e);
if (e.stack) {
dump(" - See following stack:\n");
_dump_exception_stack(e.stack);
- }
- else {
+ } else {
dump("\n");
}
_do_quit();
}
- }
- finally {
+ } finally {
do_test_finished();
}
}
});
}
function do_throw(text, stack) {
if (!stack)
@@ -509,19 +504,19 @@ function pattern_matcher(pattern) {
return pattern;
} else if (typeof pattern == "object" && pattern) {
var matchers = [];
for (let p in 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');
+ ld = Object.getOwnPropertyDescriptor(pattern, "length");
if (ld && !ld.enumerable) {
- matchers.push(['length', pattern_matcher(pattern.length)])
+ matchers.push(["length", pattern_matcher(pattern.length)])
}
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))) {
@@ -595,18 +590,17 @@ function do_get_file(path, allowNonexist
// Not using do_throw(): caller will continue.
var stack = Components.stack.caller;
_dump("TEST-UNEXPECTED-FAIL | " + stack.filename + " | [" +
stack.name + " : " + stack.lineNumber + "] " + lf.path +
" does not exist\n");
}
return lf;
- }
- catch (ex) {
+ } catch (ex) {
do_throw(ex.toString(), Components.stack.caller);
}
return null;
}
// do_get_cwd() isn't exactly self-explanatory, so provide a helper
function do_get_cwd() {
@@ -710,20 +704,18 @@ function add_task(func) {
_gTests.push([true, func]);
}
/**
* Runs the next test function from the list of async tests.
*/
var _gRunningTest = null;
var _gTestIndex = 0; // The index of the currently running test.
-function run_next_test()
-{
- function _run_next_test()
- {
+function run_next_test() {
+ function _run_next_test() {
if (_gTestIndex < _gTests.length) {
do_test_pending();
let _isTask;
[_isTask, _gRunningTest] = _gTests[_gTestIndex++];
_dump("TEST-INFO | " + _TEST_FILE + " | Starting " + _gRunningTest.name);
if (_isTask) {
_Task.spawn(_gRunningTest)
@@ -795,17 +787,17 @@ JavaBridge.prototype = {
this._EventDispatcher.dispatch(this._JAVA_EVENT_TYPE, {
innerType: innerType,
method: args[0],
args: this._getArgs(args),
});
},
onEvent: function(event, message, callback) {
- if (typeof SpecialPowers === 'object') {
+ if (typeof SpecialPowers === "object") {
message = SpecialPowers.wrap(message);
}
if (message.innerType === "sync-reply") {
// Reply to our Javascript-to-Java sync call
this._repliesNeeded--;
return;
}
// Call the corresponding method on the target
--- a/mobile/android/tests/browser/robocop/robocop_input.html
+++ b/mobile/android/tests/browser/robocop/robocop_input.html
@@ -28,23 +28,23 @@
// Spatial navigation interferes with design-mode key event tests.
SpecialPowers.setBoolPref("snav.enabled", false);
// Enable "selectionchange" events for input/textarea.
SpecialPowers.setBoolPref("dom.select_events.textcontrols.enabled", true);
// An input that resets the editor on every input by resetting the value property.
let resetting_input = document.getElementById("resetting-input");
- resetting_input.addEventListener('input', function() {
+ resetting_input.addEventListener("input", function() {
this.value = this.value;
});
// An input that hides on input.
let hiding_input = document.getElementById("hiding-input");
- hiding_input.addEventListener('keydown', function(e) {
+ hiding_input.addEventListener("keydown", function(e) {
if (e.key === "!") { // '!' key event as sent by testInputConnection.java.
this.value = "";
this.style.display = "none";
}
});
let getEditor, setValue, setSelection;
@@ -183,20 +183,20 @@
let target = get_event_target();
target.removeEventListener("compositionstart", log_event);
target.removeEventListener("compositionupdate", log_event);
target.removeEventListener("compositionend", log_event);
target.removeEventListener("selectionchange", log_event);
},
test_bug1123514: function() {
- document.activeElement.addEventListener('input', function() {
+ document.activeElement.addEventListener("input", function() {
// Only works on input and textarea.
- if (this.value === 'b') {
- this.value = 'abc';
+ if (this.value === "b") {
+ this.value = "abc";
}
}, {once: true});
},
focus_resetting_input: function(val) {
resetting_input.value = val;
resetting_input.focus();
},
--- a/mobile/android/tests/browser/robocop/robocop_login_01.html
+++ b/mobile/android/tests/browser/robocop/robocop_login_01.html
@@ -1,14 +1,14 @@
<html>
<script>
function login() {
document.login.username.value = "Test1";
document.login.password.value = "Test2";
-document.getElementById('submit').click();
+document.getElementById("submit").click();
}
</script>
<head>
<title>Robocop Login</title>
<meta charset="utf-8">
</head>
<body onload="login()">
<h2>User Login </h2>
--- a/mobile/android/tests/browser/robocop/robocop_login_02.html
+++ b/mobile/android/tests/browser/robocop/robocop_login_02.html
@@ -1,14 +1,14 @@
<html>
<script>
function login() {
document.login.username.value = "Test2";
document.login.password.value = "Test2";
-document.getElementById('submit').click();
+document.getElementById("submit").click();
}
</script>
<head>
<title>Robocop Login</title>
<meta charset="utf-8">
</head>
<body onload="login()">
<h2>User Login </h2>
--- a/mobile/android/tests/browser/robocop/robocop_testharness.js
+++ b/mobile/android/tests/browser/robocop/robocop_testharness.js
@@ -15,19 +15,19 @@ function _evalURI(uri, sandbox) {
let baseURI = SpecialPowers.Services.io
.newURI(window.document.baseURI, window.document.characterSet);
let theURI = SpecialPowers.Services.io
.newURI(uri, window.document.characterSet, baseURI);
// We append a random slug to avoid caching: see
// https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache.
- req.open('GET', theURI.spec + ((/\?/).test(theURI.spec) ? "&slug=" : "?slug=") + (new Date()).getTime(), false);
- req.setRequestHeader('Cache-Control', 'no-cache');
- req.setRequestHeader('Pragma', 'no-cache');
+ req.open("GET", theURI.spec + ((/\?/).test(theURI.spec) ? "&slug=" : "?slug=") + (new Date()).getTime(), false);
+ req.setRequestHeader("Cache-Control", "no-cache");
+ req.setRequestHeader("Pragma", "no-cache");
req.send();
return SpecialPowers.Cu.evalInSandbox(req.responseText, sandbox, "1.8", uri, 1);
}
/**
* Execute the Javascript file at `uri` in a testing sandbox populated
* with the Javascript test harness.
--- a/mobile/android/tests/browser/robocop/roboextender/bootstrap.js
+++ b/mobile/android/tests/browser/robocop/roboextender/bootstrap.js
@@ -15,17 +15,17 @@ function unloadFromWindow(window) {}
var windowListener = {
onOpenWindow: function(aWindow) {
// Wait for the window to finish loading
let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow);
domWindow.addEventListener("load", function() {
if (domWindow) {
domWindow.addEventListener("scroll", function(e) {
let message = {
- type: 'Robocop:Scroll',
+ type: "Robocop:Scroll",
y: XPCNativeWrapper.unwrap(e.target).documentElement.scrollTop,
height: XPCNativeWrapper.unwrap(e.target).documentElement.scrollHeight,
cheight: XPCNativeWrapper.unwrap(e.target).documentElement.clientHeight,
};
EventDispatcher.instance.sendRequest(message);
});
}
}, {once: true});
--- a/mobile/android/tests/browser/robocop/testAccessibleCarets.js
+++ b/mobile/android/tests/browser/robocop/testAccessibleCarets.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";
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Messaging.jsm");
-Cu.import('resource://gre/modules/Geometry.jsm');
+Cu.import("resource://gre/modules/Geometry.jsm");
const ACCESSIBLECARET_PREF = "layout.accessiblecaret.enabled";
const BASE_TEST_URL = "http://mochi.test:8888/tests/robocop/testAccessibleCarets.html";
const DESIGNMODE_TEST_URL = "http://mochi.test:8888/tests/robocop/testAccessibleCarets2.html";
// Ensures Tabs are completely loaded, viewport and zoom constraints updated, etc.
const TAB_CHANGE_EVENT = "testAccessibleCarets:TabChange";
const TAB_STOP_EVENT = "STOP";
--- a/mobile/android/tests/browser/robocop/testEventDispatcher.js
+++ b/mobile/android/tests/browser/robocop/testEventDispatcher.js
@@ -52,20 +52,20 @@ function get_test_message() {
function send_test_message(scope, type) {
let outerObject = get_test_message();
outerObject.type = type;
get_dispatcher(scope).sendRequest(outerObject);
}
function get_dispatcher(scope) {
- if (scope === 'global') {
+ if (scope === "global") {
return EventDispatcher.instance;
}
- if (scope === 'window') {
+ if (scope === "window") {
let win = Services.wm.getMostRecentWindow("navigator:browser");
return EventDispatcher.for(win);
}
ok(false, "Invalid scope argument: " + scope);
}
function dispatch_test_message(scope, type) {
let data = get_test_message();
--- a/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js
+++ b/mobile/android/tests/browser/robocop/testUnifiedTelemetryClientId.js
@@ -1,11 +1,11 @@
var { classes: Cc, interfaces: Ci, utils: Cu } = Components;
-Cu.import('resource://gre/modules/ClientID.jsm');
+Cu.import("resource://gre/modules/ClientID.jsm");
var java = new JavaBridge(this);
do_register_cleanup(() => {
java.disconnect();
});
do_test_pending();
var isClientIDSet;
@@ -21,30 +21,30 @@ function getAsyncClientId() {
//
// 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) {
// 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);
+ do_throw("Could not retrieve client ID: " + fail);
});
}
function pollGetAsyncClientId() {
- java.asyncCall('blockingFromJsResponseString', isClientIDSet, clientID);
+ java.asyncCall("blockingFromJsResponseString", isClientIDSet, clientID);
}
function getAsyncReset() {
isResetDone = false;
ClientID._reset().then(function() {
isResetDone = true;
});
}
function pollGetAsyncReset() {
- java.asyncCall('blockingFromJsResponseString', isResetDone, '');
+ java.asyncCall("blockingFromJsResponseString", isResetDone, "");
}
function endTest() {
do_test_finished();
}