зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1385815 - Enable more whitespace related ESLint rules for mobile/android. r=sebastian
MozReview-Commit-ID: FuM6Neob0mC --HG-- extra : rebase_source : 29a9fbbaf74b17f4b02a835a7ef88550413514a0
This commit is contained in:
Родитель
12a96894b3
Коммит
9a7db035d4
|
@ -28,9 +28,5 @@ module.exports = {
|
||||||
"no-unused-vars": "off",
|
"no-unused-vars": "off",
|
||||||
"object-shorthand": "off",
|
"object-shorthand": "off",
|
||||||
"quotes": "off", // [2, "double"]
|
"quotes": "off", // [2, "double"]
|
||||||
"space-before-blocks": "off",
|
|
||||||
"space-before-function-paren": "off",
|
|
||||||
"space-infix-ops": "off",
|
|
||||||
"spaced-comment": "off",
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -123,7 +123,7 @@ var CastingApps = {
|
||||||
return Services.prefs.getBoolPref("browser.casting.enabled");
|
return Services.prefs.getBoolPref("browser.casting.enabled");
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function (event, message, callback) {
|
onEvent: function(event, message, callback) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case "Casting:Play":
|
case "Casting:Play":
|
||||||
if (this.session && this.session.remoteMedia.status == "paused") {
|
if (this.session && this.session.remoteMedia.status == "paused") {
|
||||||
|
@ -143,7 +143,7 @@ var CastingApps = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
switch (aTopic) {
|
switch (aTopic) {
|
||||||
case "ssdp-service-found":
|
case "ssdp-service-found":
|
||||||
this.serviceAdded(SimpleServiceDiscovery.findServiceForID(aData));
|
this.serviceAdded(SimpleServiceDiscovery.findServiceForID(aData));
|
||||||
|
|
|
@ -13,7 +13,7 @@ XPCOMUtils.defineLazyModuleGetter(this, "ConsoleAPI",
|
||||||
var EmbedRT = {
|
var EmbedRT = {
|
||||||
_scopes: {},
|
_scopes: {},
|
||||||
|
|
||||||
onEvent: function (event, data, callback) {
|
onEvent: function(event, data, callback) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case "GeckoView:ImportScript":
|
case "GeckoView:ImportScript":
|
||||||
this.importScript(data.scriptURL);
|
this.importScript(data.scriptURL);
|
||||||
|
|
|
@ -15,7 +15,7 @@ Linkifier.prototype = {
|
||||||
let cleanedText = "";
|
let cleanedText = "";
|
||||||
for (let i = 0; i < aNumberText.length; i++) {
|
for (let i = 0; i < aNumberText.length; i++) {
|
||||||
let c = aNumberText.charAt(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;
|
cleanedText += c;
|
||||||
}
|
}
|
||||||
anchorNode.setAttribute("href", "tel:" + cleanedText);
|
anchorNode.setAttribute("href", "tel:" + cleanedText);
|
||||||
|
@ -48,7 +48,7 @@ Linkifier.prototype = {
|
||||||
if (!prevNode) // first time, need to replace the whole node with the first new one.
|
if (!prevNode) // first time, need to replace the whole node with the first new one.
|
||||||
parent.replaceChild(nodeToAdd, aNodeToProcess);
|
parent.replaceChild(nodeToAdd, aNodeToProcess);
|
||||||
else
|
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.
|
if (textExistsBeforeNumber) // if we added the text node before the anchor, we still need to add the anchor node.
|
||||||
parent.insertBefore(anchorNode, nodeToAdd.nextSibling);
|
parent.insertBefore(anchorNode, nodeToAdd.nextSibling);
|
||||||
|
@ -74,7 +74,7 @@ Linkifier.prototype = {
|
||||||
this._linkifyTimer = null;
|
this._linkifyTimer = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let filterNode = function (node) {
|
let filterNode = function(node) {
|
||||||
if (node.parentNode.tagName != 'A' &&
|
if (node.parentNode.tagName != 'A' &&
|
||||||
node.parentNode.tagName != 'SCRIPT' &&
|
node.parentNode.tagName != 'SCRIPT' &&
|
||||||
node.parentNode.tagName != 'NOSCRIPT' &&
|
node.parentNode.tagName != 'NOSCRIPT' &&
|
||||||
|
|
|
@ -120,7 +120,7 @@ var PluginHelper = {
|
||||||
},
|
},
|
||||||
|
|
||||||
// Copied from /browser/base/content/browser.js
|
// 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?
|
// Is the <object>'s size too small to hold what we want to show?
|
||||||
let pluginRect = plugin.getBoundingClientRect();
|
let pluginRect = plugin.getBoundingClientRect();
|
||||||
// XXX bug 446693. The text-shadow on the submitted-report text at
|
// XXX bug 446693. The text-shadow on the submitted-report text at
|
||||||
|
@ -131,7 +131,7 @@ var PluginHelper = {
|
||||||
return overflows;
|
return overflows;
|
||||||
},
|
},
|
||||||
|
|
||||||
getPluginMimeType: function (plugin) {
|
getPluginMimeType: function(plugin) {
|
||||||
var tagMimetype = plugin.actualType;
|
var tagMimetype = plugin.actualType;
|
||||||
|
|
||||||
if (tagMimetype == "") {
|
if (tagMimetype == "") {
|
||||||
|
@ -141,7 +141,7 @@ var PluginHelper = {
|
||||||
return tagMimetype;
|
return tagMimetype;
|
||||||
},
|
},
|
||||||
|
|
||||||
handlePluginBindingAttached: function (aTab, aEvent) {
|
handlePluginBindingAttached: function(aTab, aEvent) {
|
||||||
let plugin = aEvent.target;
|
let plugin = aEvent.target;
|
||||||
let doc = plugin.ownerDocument;
|
let doc = plugin.ownerDocument;
|
||||||
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
let overlay = doc.getAnonymousElementByAttribute(plugin, "anonid", "main");
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
|
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
|
||||||
|
|
||||||
var PrintHelper = {
|
var PrintHelper = {
|
||||||
onEvent: function (event, data, callback) {
|
onEvent: function(event, data, callback) {
|
||||||
let browser = BrowserApp.selectedBrowser;
|
let browser = BrowserApp.selectedBrowser;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
@ -58,10 +58,10 @@ var PrintHelper = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onProgressChange: function () {},
|
onProgressChange: function() {},
|
||||||
onLocationChange: function () {},
|
onLocationChange: function() {},
|
||||||
onStatusChange: function () {},
|
onStatusChange: function() {},
|
||||||
onSecurityChange: function () {},
|
onSecurityChange: function() {},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Snackbars", "resource://gre/modules/Snackbars.jsm");
|
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 = {
|
var Reader = {
|
||||||
// These values should match those defined in BrowserContract.java.
|
// These values should match those defined in BrowserContract.java.
|
||||||
|
@ -203,7 +203,7 @@ var Reader = {
|
||||||
|
|
||||||
_sendMmaEvent: function(event) {
|
_sendMmaEvent: function(event) {
|
||||||
WindowEventDispatcher.sendRequest({
|
WindowEventDispatcher.sendRequest({
|
||||||
type: "Mma:"+event,
|
type: "Mma:" + event,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -129,7 +129,7 @@ var WebrtcUI = {
|
||||||
|
|
||||||
contentWindow.navigator.mozGetUserMediaDevices(
|
contentWindow.navigator.mozGetUserMediaDevices(
|
||||||
constraints,
|
constraints,
|
||||||
function (devices) {
|
function(devices) {
|
||||||
if (!ParentalControls.isAllowed(ParentalControls.CAMERA_MICROPHONE)) {
|
if (!ParentalControls.isAllowed(ParentalControls.CAMERA_MICROPHONE)) {
|
||||||
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aSubject.callID);
|
Services.obs.notifyObservers(null, "getUserMedia:response:deny", aSubject.callID);
|
||||||
WebrtcUI.showBlockMessage(devices);
|
WebrtcUI.showBlockMessage(devices);
|
||||||
|
@ -139,7 +139,7 @@ var WebrtcUI = {
|
||||||
WebrtcUI.prompt(contentWindow, aSubject.callID, constraints.audio,
|
WebrtcUI.prompt(contentWindow, aSubject.callID, constraints.audio,
|
||||||
constraints.video, devices);
|
constraints.video, devices);
|
||||||
},
|
},
|
||||||
function (error) {
|
function(error) {
|
||||||
Cu.reportError(error);
|
Cu.reportError(error);
|
||||||
},
|
},
|
||||||
aSubject.innerWindowID,
|
aSubject.innerWindowID,
|
||||||
|
@ -214,7 +214,7 @@ var WebrtcUI = {
|
||||||
return Strings.browser.GetStringFromName("getUserMedia." + aType + "." + res[1] + "Camera");
|
return Strings.browser.GetStringFromName("getUserMedia." + aType + "." + res[1] + "Camera");
|
||||||
|
|
||||||
if (device.name.startsWith("&") && device.name.endsWith(";"))
|
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() == "") {
|
if (device.name.trim() == "") {
|
||||||
defaultCount++;
|
defaultCount++;
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
|
|
||||||
"use strict";
|
"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/Accounts.jsm"); /* global Accounts */
|
||||||
Cu.import("resource://gre/modules/PromiseUtils.jsm"); /*global PromiseUtils */
|
Cu.import("resource://gre/modules/PromiseUtils.jsm"); /* global PromiseUtils */
|
||||||
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
|
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /*global XPCOMUtils */
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
|
||||||
|
|
||||||
const ACTION_URL_PARAM = "action";
|
const ACTION_URL_PARAM = "action";
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ var wrapper = {
|
||||||
|
|
||||||
url: null,
|
url: null,
|
||||||
|
|
||||||
init: function (url) {
|
init: function(url) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
deferTransitionToRemoteAfterLoaded();
|
deferTransitionToRemoteAfterLoaded();
|
||||||
|
|
||||||
|
@ -107,7 +107,7 @@ var wrapper = {
|
||||||
webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
|
webNav.loadURI(url, Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_HISTORY, null, null, null);
|
||||||
},
|
},
|
||||||
|
|
||||||
retry: function () {
|
retry: function() {
|
||||||
deferTransitionToRemoteAfterLoaded();
|
deferTransitionToRemoteAfterLoaded();
|
||||||
|
|
||||||
let webNav = this.iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
|
let webNav = this.iframe.frameLoader.docShell.QueryInterface(Ci.nsIWebNavigation);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*globals gChromeWin */
|
/* globals gChromeWin */
|
||||||
|
|
||||||
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
|
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
|
||||||
|
|
||||||
|
@ -86,12 +86,12 @@ var ContextMenus = {
|
||||||
this.target = null;
|
this.target = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
disable: function (event) {
|
disable: function(event) {
|
||||||
Addons.setEnabled(false, this.target.addon);
|
Addons.setEnabled(false, this.target.addon);
|
||||||
this.target = null;
|
this.target = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
uninstall: function (event) {
|
uninstall: function(event) {
|
||||||
Addons.uninstall(this.target.addon);
|
Addons.uninstall(this.target.addon);
|
||||||
this.target = null;
|
this.target = null;
|
||||||
}
|
}
|
||||||
|
@ -284,7 +284,7 @@ var Addons = {
|
||||||
aAddons.sort(function(a, b) {
|
aAddons.sort(function(a, b) {
|
||||||
return a.name.localeCompare(b.name);
|
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.
|
// Don't create item for system add-ons.
|
||||||
if (aAddons[i].isSystem)
|
if (aAddons[i].isSystem)
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -31,7 +31,7 @@ var contextMenu = {
|
||||||
_items: [],
|
_items: [],
|
||||||
_targetDownload: null,
|
_targetDownload: null,
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
let element = document.getElementById("downloadmenu");
|
let element = document.getElementById("downloadmenu");
|
||||||
element.addEventListener("click",
|
element.addEventListener("click",
|
||||||
event => event.download = this._targetDownload,
|
event => event.download = this._targetDownload,
|
||||||
|
@ -72,11 +72,11 @@ var contextMenu = {
|
||||||
];
|
];
|
||||||
},
|
},
|
||||||
|
|
||||||
addContextMenuEventListener: function (element) {
|
addContextMenuEventListener: function(element) {
|
||||||
element.addEventListener("contextmenu", this.onContextMenu.bind(this));
|
element.addEventListener("contextmenu", this.onContextMenu.bind(this));
|
||||||
},
|
},
|
||||||
|
|
||||||
onContextMenu: function (event) {
|
onContextMenu: function(event) {
|
||||||
let target = event.target;
|
let target = event.target;
|
||||||
while (target && !target.download) {
|
while (target && !target.download) {
|
||||||
target = target.parentNode;
|
target = target.parentNode;
|
||||||
|
@ -103,7 +103,7 @@ function ContextMenuItem(name, isVisible, action) {
|
||||||
}
|
}
|
||||||
|
|
||||||
ContextMenuItem.prototype = {
|
ContextMenuItem.prototype = {
|
||||||
updateVisibility: function (download) {
|
updateVisibility: function(download) {
|
||||||
this.element.hidden = !this.isVisible(download);
|
this.element.hidden = !this.isVisible(download);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -137,7 +137,7 @@ DownloadListView.prototype = {
|
||||||
return finished;
|
return finished;
|
||||||
},
|
},
|
||||||
|
|
||||||
insertOrMoveItem: function (item) {
|
insertOrMoveItem: function(item) {
|
||||||
var compare = (a, b) => {
|
var compare = (a, b) => {
|
||||||
// active downloads always before stopped downloads
|
// active downloads always before stopped downloads
|
||||||
if (a.stopped != b.stopped) {
|
if (a.stopped != b.stopped) {
|
||||||
|
@ -154,13 +154,13 @@ DownloadListView.prototype = {
|
||||||
this.listElement.insertBefore(item.element, insertLocation);
|
this.listElement.insertBefore(item.element, insertLocation);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAdded: function (download) {
|
onDownloadAdded: function(download) {
|
||||||
let item = new DownloadItem(download);
|
let item = new DownloadItem(download);
|
||||||
this.items.set(download, item);
|
this.items.set(download, item);
|
||||||
this.insertOrMoveItem(item);
|
this.insertOrMoveItem(item);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadChanged: function (download) {
|
onDownloadChanged: function(download) {
|
||||||
let item = this.items.get(download);
|
let item = this.items.get(download);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
Cu.reportError("No DownloadItem found for download");
|
Cu.reportError("No DownloadItem found for download");
|
||||||
|
@ -174,7 +174,7 @@ DownloadListView.prototype = {
|
||||||
item.onDownloadChanged();
|
item.onDownloadChanged();
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadRemoved: function (download) {
|
onDownloadRemoved: function(download) {
|
||||||
let item = this.items.get(download);
|
let item = this.items.get(download);
|
||||||
if (!item) {
|
if (!item) {
|
||||||
Cu.reportError("No DownloadItem found for download");
|
Cu.reportError("No DownloadItem found for download");
|
||||||
|
@ -192,7 +192,7 @@ DownloadListView.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var downloadLists = {
|
var downloadLists = {
|
||||||
init: function () {
|
init: function() {
|
||||||
this.publicDownloads = new DownloadListView(Downloads.PUBLIC, "public-downloads-list");
|
this.publicDownloads = new DownloadListView(Downloads.PUBLIC, "public-downloads-list");
|
||||||
this.privateDownloads = new DownloadListView(Downloads.PRIVATE, "private-downloads-list");
|
this.privateDownloads = new DownloadListView(Downloads.PRIVATE, "private-downloads-list");
|
||||||
},
|
},
|
||||||
|
@ -201,7 +201,7 @@ var downloadLists = {
|
||||||
return this.publicDownloads.finished.concat(this.privateDownloads.finished);
|
return this.publicDownloads.finished.concat(this.privateDownloads.finished);
|
||||||
},
|
},
|
||||||
|
|
||||||
removeFinished: function () {
|
removeFinished: function() {
|
||||||
let finished = this.finished;
|
let finished = this.finished;
|
||||||
if (finished.length == 0) {
|
if (finished.length == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -244,7 +244,7 @@ const kDownloadStatePropertyNames = [
|
||||||
];
|
];
|
||||||
|
|
||||||
DownloadItem.prototype = {
|
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, "<");
|
s = s.replace(/</g, "<");
|
||||||
|
@ -253,7 +253,7 @@ DownloadItem.prototype = {
|
||||||
return s;
|
return s;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateFromDownload: function () {
|
_updateFromDownload: function() {
|
||||||
this._state = {};
|
this._state = {};
|
||||||
kDownloadStatePropertyNames.forEach(
|
kDownloadStatePropertyNames.forEach(
|
||||||
name => this._state[name] = this._download[name],
|
name => this._state[name] = this._download[name],
|
||||||
|
@ -295,7 +295,7 @@ DownloadItem.prototype = {
|
||||||
return element;
|
return element;
|
||||||
},
|
},
|
||||||
|
|
||||||
updateElement: function (element) {
|
updateElement: function(element) {
|
||||||
element.querySelector(".date").textContent = this.startDate;
|
element.querySelector(".date").textContent = this.startDate;
|
||||||
element.querySelector(".domain").textContent = this.domain;
|
element.querySelector(".domain").textContent = this.domain;
|
||||||
element.querySelector(".icon").src = this.iconUrl;
|
element.querySelector(".icon").src = this.iconUrl;
|
||||||
|
@ -304,13 +304,13 @@ DownloadItem.prototype = {
|
||||||
element.querySelector(".title").setAttribute("value", this.fileName);
|
element.querySelector(".title").setAttribute("value", this.fileName);
|
||||||
},
|
},
|
||||||
|
|
||||||
onClick: function (event) {
|
onClick: function(event) {
|
||||||
if (this.download.succeeded) {
|
if (this.download.succeeded) {
|
||||||
this.download.launch().catch(Cu.reportError);
|
this.download.launch().catch(Cu.reportError);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadChanged: function () {
|
onDownloadChanged: function() {
|
||||||
this._updateFromDownload();
|
this._updateFromDownload();
|
||||||
this.updateElement(this.element);
|
this.updateElement(this.element);
|
||||||
},
|
},
|
||||||
|
|
|
@ -32,7 +32,7 @@ const EVENT_HEALTH_RESPONSE = "HealthReport:Response";
|
||||||
var sharedPrefs = SharedPreferences.forApp();
|
var sharedPrefs = SharedPreferences.forApp();
|
||||||
|
|
||||||
var healthReportWrapper = {
|
var healthReportWrapper = {
|
||||||
init: function () {
|
init: function() {
|
||||||
let iframe = document.getElementById("remote-report");
|
let iframe = document.getElementById("remote-report");
|
||||||
iframe.addEventListener("load", healthReportWrapper.initRemotePage);
|
iframe.addEventListener("load", healthReportWrapper.initRemotePage);
|
||||||
let report = this._getReportURI();
|
let report = this._getReportURI();
|
||||||
|
@ -43,7 +43,7 @@ var healthReportWrapper = {
|
||||||
Services.obs.addObserver(this, EVENT_HEALTH_RESPONSE);
|
Services.obs.addObserver(this, EVENT_HEALTH_RESPONSE);
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (topic == PREF_UPLOAD_ENABLED) {
|
if (topic == PREF_UPLOAD_ENABLED) {
|
||||||
this.updatePrefState();
|
this.updatePrefState();
|
||||||
} else if (topic == EVENT_HEALTH_RESPONSE) {
|
} else if (topic == EVENT_HEALTH_RESPONSE) {
|
||||||
|
@ -51,12 +51,12 @@ var healthReportWrapper = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
sharedPrefs.removeObserver(PREF_UPLOAD_ENABLED, this);
|
sharedPrefs.removeObserver(PREF_UPLOAD_ENABLED, this);
|
||||||
Services.obs.removeObserver(this, EVENT_HEALTH_RESPONSE);
|
Services.obs.removeObserver(this, EVENT_HEALTH_RESPONSE);
|
||||||
},
|
},
|
||||||
|
|
||||||
_getReportURI: function () {
|
_getReportURI: function() {
|
||||||
let url = Services.urlFormatter.formatURLPref(PREF_REPORTURL);
|
let url = Services.urlFormatter.formatURLPref(PREF_REPORTURL);
|
||||||
// This handles URLs that already have query parameters.
|
// This handles URLs that already have query parameters.
|
||||||
let uri = Services.io.newURI(url).QueryInterface(Ci.nsIURL);
|
let uri = Services.io.newURI(url).QueryInterface(Ci.nsIURL);
|
||||||
|
@ -64,19 +64,19 @@ var healthReportWrapper = {
|
||||||
return uri;
|
return uri;
|
||||||
},
|
},
|
||||||
|
|
||||||
onOptIn: function () {
|
onOptIn: function() {
|
||||||
console.log("AboutHealthReport: page sent opt-in command.");
|
console.log("AboutHealthReport: page sent opt-in command.");
|
||||||
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, true);
|
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, true);
|
||||||
this.updatePrefState();
|
this.updatePrefState();
|
||||||
},
|
},
|
||||||
|
|
||||||
onOptOut: function () {
|
onOptOut: function() {
|
||||||
console.log("AboutHealthReport: page sent opt-out command.");
|
console.log("AboutHealthReport: page sent opt-out command.");
|
||||||
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, false);
|
sharedPrefs.setBoolPref(PREF_UPLOAD_ENABLED, false);
|
||||||
this.updatePrefState();
|
this.updatePrefState();
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePrefState: function () {
|
updatePrefState: function() {
|
||||||
console.log("AboutHealthReport: sending pref state to page.");
|
console.log("AboutHealthReport: sending pref state to page.");
|
||||||
try {
|
try {
|
||||||
let prefs = {
|
let prefs = {
|
||||||
|
@ -88,14 +88,14 @@ var healthReportWrapper = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
refreshPayload: function () {
|
refreshPayload: function() {
|
||||||
console.log("AboutHealthReport: page requested fresh payload.");
|
console.log("AboutHealthReport: page requested fresh payload.");
|
||||||
EventDispatcher.instance.sendRequest({
|
EventDispatcher.instance.sendRequest({
|
||||||
type: EVENT_HEALTH_REQUEST,
|
type: EVENT_HEALTH_REQUEST,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
updatePayload: function (data) {
|
updatePayload: function(data) {
|
||||||
healthReportWrapper.injectData("payload", data);
|
healthReportWrapper.injectData("payload", data);
|
||||||
// Data is supposed to be a string, so the length should be
|
// Data is supposed to be a string, so the length should be
|
||||||
// defined. Just in case, we do this after injecting the data.
|
// defined. Just in case, we do this after injecting the data.
|
||||||
|
@ -103,7 +103,7 @@ var healthReportWrapper = {
|
||||||
"(" + typeof(data) + " of length " + data.length + ").");
|
"(" + typeof(data) + " of length " + data.length + ").");
|
||||||
},
|
},
|
||||||
|
|
||||||
injectData: function (type, content) {
|
injectData: function(type, content) {
|
||||||
let report = this._getReportURI();
|
let report = this._getReportURI();
|
||||||
|
|
||||||
// file: URIs can't be used for targetOrigin, so we use "*" for
|
// file: URIs can't be used for targetOrigin, so we use "*" for
|
||||||
|
@ -120,7 +120,7 @@ var healthReportWrapper = {
|
||||||
iframe.contentWindow.postMessage(data, reportUrl);
|
iframe.contentWindow.postMessage(data, reportUrl);
|
||||||
},
|
},
|
||||||
|
|
||||||
showSettings: function () {
|
showSettings: function() {
|
||||||
console.log("AboutHealthReport: showing settings.");
|
console.log("AboutHealthReport: showing settings.");
|
||||||
EventDispatcher.instance.sendRequest({
|
EventDispatcher.instance.sendRequest({
|
||||||
type: "Settings:Show",
|
type: "Settings:Show",
|
||||||
|
@ -128,14 +128,14 @@ var healthReportWrapper = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
launchUpdater: function () {
|
launchUpdater: function() {
|
||||||
console.log("AboutHealthReport: launching updater.");
|
console.log("AboutHealthReport: launching updater.");
|
||||||
EventDispatcher.instance.sendRequest({
|
EventDispatcher.instance.sendRequest({
|
||||||
type: "Updater:Launch",
|
type: "Updater:Launch",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
handleRemoteCommand: function (evt) {
|
handleRemoteCommand: function(evt) {
|
||||||
switch (evt.detail.command) {
|
switch (evt.detail.command) {
|
||||||
case "DisableDataSubmission":
|
case "DisableDataSubmission":
|
||||||
this.onOptOut();
|
this.onOptOut();
|
||||||
|
@ -162,7 +162,7 @@ var healthReportWrapper = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
initRemotePage: function () {
|
initRemotePage: function() {
|
||||||
let iframe = document.getElementById("remote-report").contentDocument;
|
let iframe = document.getElementById("remote-report").contentDocument;
|
||||||
iframe.addEventListener("RemoteHealthReportCommand",
|
iframe.addEventListener("RemoteHealthReportCommand",
|
||||||
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); });
|
function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); });
|
||||||
|
@ -174,18 +174,18 @@ var healthReportWrapper = {
|
||||||
ERROR_PAYLOAD_FAILED: 2,
|
ERROR_PAYLOAD_FAILED: 2,
|
||||||
ERROR_PREFS_FAILED: 3,
|
ERROR_PREFS_FAILED: 3,
|
||||||
|
|
||||||
reportFailure: function (error) {
|
reportFailure: function(error) {
|
||||||
let details = {
|
let details = {
|
||||||
errorType: error,
|
errorType: error,
|
||||||
};
|
};
|
||||||
healthReportWrapper.injectData("error", details);
|
healthReportWrapper.injectData("error", details);
|
||||||
},
|
},
|
||||||
|
|
||||||
handleInitFailure: function () {
|
handleInitFailure: function() {
|
||||||
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
|
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
|
||||||
},
|
},
|
||||||
|
|
||||||
handlePayloadFailure: function () {
|
handlePayloadFailure: function() {
|
||||||
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
|
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
var Ci = Components.interfaces, Cc = Components.classes, Cu = Components.utils;
|
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/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
|
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
|
||||||
|
@ -151,7 +151,7 @@ var Logins = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
window.addEventListener("popstate", this);
|
window.addEventListener("popstate", this);
|
||||||
|
|
||||||
Services.obs.addObserver(this, "passwordmgr-storage-changed");
|
Services.obs.addObserver(this, "passwordmgr-storage-changed");
|
||||||
|
@ -202,12 +202,12 @@ var Logins = {
|
||||||
this._reloadList();
|
this._reloadList();
|
||||||
},
|
},
|
||||||
|
|
||||||
uninit: function () {
|
uninit: function() {
|
||||||
Services.obs.removeObserver(this, "passwordmgr-storage-changed");
|
Services.obs.removeObserver(this, "passwordmgr-storage-changed");
|
||||||
window.removeEventListener("popstate", this);
|
window.removeEventListener("popstate", this);
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadList: function (logins) {
|
_loadList: function(logins) {
|
||||||
let list = document.getElementById("logins-list");
|
let list = document.getElementById("logins-list");
|
||||||
let newList = list.cloneNode(false);
|
let newList = list.cloneNode(false);
|
||||||
|
|
||||||
|
@ -219,7 +219,7 @@ var Logins = {
|
||||||
list.parentNode.replaceChild(newList, list);
|
list.parentNode.replaceChild(newList, list);
|
||||||
},
|
},
|
||||||
|
|
||||||
_showList: function () {
|
_showList: function() {
|
||||||
let loginsListPage = document.getElementById("logins-list-page");
|
let loginsListPage = document.getElementById("logins-list-page");
|
||||||
loginsListPage.classList.remove("hidden");
|
loginsListPage.classList.remove("hidden");
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ var Logins = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPopState: function (event) {
|
_onPopState: function(event) {
|
||||||
// Called when back/forward is used to change the state of the page
|
// Called when back/forward is used to change the state of the page
|
||||||
if (event.state) {
|
if (event.state) {
|
||||||
this._showEditLoginDialog(event.state.id);
|
this._showEditLoginDialog(event.state.id);
|
||||||
|
@ -241,7 +241,7 @@ var Logins = {
|
||||||
this._showList();
|
this._showList();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
_showEditLoginDialog: function (login) {
|
_showEditLoginDialog: function(login) {
|
||||||
let listPage = document.getElementById("logins-list-page");
|
let listPage = document.getElementById("logins-list-page");
|
||||||
listPage.classList.add("hidden");
|
listPage.classList.add("hidden");
|
||||||
|
|
||||||
|
@ -318,11 +318,11 @@ var Logins = {
|
||||||
this._showList();
|
this._showList();
|
||||||
},
|
},
|
||||||
|
|
||||||
_onPasswordBtn: function () {
|
_onPasswordBtn: function() {
|
||||||
this._updatePasswordBtn(this._isPasswordBtnInHideMode());
|
this._updatePasswordBtn(this._isPasswordBtnInHideMode());
|
||||||
},
|
},
|
||||||
|
|
||||||
_updatePasswordBtn: function (aShouldShow) {
|
_updatePasswordBtn: function(aShouldShow) {
|
||||||
let passwordField = document.getElementById("password");
|
let passwordField = document.getElementById("password");
|
||||||
let button = document.getElementById("password-btn");
|
let button = document.getElementById("password-btn");
|
||||||
let show = gStringBundle.GetStringFromName("password-btn.show");
|
let show = gStringBundle.GetStringFromName("password-btn.show");
|
||||||
|
@ -333,12 +333,12 @@ var Logins = {
|
||||||
button.classList.remove("password-btn-hide");
|
button.classList.remove("password-btn-hide");
|
||||||
} else {
|
} else {
|
||||||
passwordField.type = "text";
|
passwordField.type = "text";
|
||||||
button.textContent= hide;
|
button.textContent = hide;
|
||||||
button.classList.add("password-btn-hide");
|
button.classList.add("password-btn-hide");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
_isPasswordBtnInHideMode: function () {
|
_isPasswordBtnInHideMode: function() {
|
||||||
let button = document.getElementById("password-btn");
|
let button = document.getElementById("password-btn");
|
||||||
return button.classList.contains("password-btn-hide");
|
return button.classList.contains("password-btn-hide");
|
||||||
},
|
},
|
||||||
|
@ -359,7 +359,7 @@ var Logins = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_onLoginClick: function (event) {
|
_onLoginClick: function(event) {
|
||||||
let loginItem = event.currentTarget;
|
let loginItem = event.currentTarget;
|
||||||
let login = loginItem.login;
|
let login = loginItem.login;
|
||||||
if (!login) {
|
if (!login) {
|
||||||
|
@ -415,14 +415,14 @@ var Logins = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_loadFavicon: function (aImg, aHostname) {
|
_loadFavicon: function(aImg, aHostname) {
|
||||||
// Load favicon from cache.
|
// Load favicon from cache.
|
||||||
EventDispatcher.instance.sendRequestForResult({
|
EventDispatcher.instance.sendRequestForResult({
|
||||||
type: "Favicon:Request",
|
type: "Favicon:Request",
|
||||||
url: aHostname,
|
url: aHostname,
|
||||||
skipNetwork: true
|
skipNetwork: true
|
||||||
}).then(function(faviconUrl) {
|
}).then(function(faviconUrl) {
|
||||||
aImg.style.backgroundImage= "url('" + faviconUrl + "')";
|
aImg.style.backgroundImage = "url('" + faviconUrl + "')";
|
||||||
aImg.style.visibility = "visible";
|
aImg.style.visibility = "visible";
|
||||||
}, function(data) {
|
}, function(data) {
|
||||||
debug("Favicon cache failure : " + data);
|
debug("Favicon cache failure : " + data);
|
||||||
|
@ -430,7 +430,7 @@ var Logins = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_createItemForLogin: function (login) {
|
_createItemForLogin: function(login) {
|
||||||
let loginItem = document.createElement("div");
|
let loginItem = document.createElement("div");
|
||||||
|
|
||||||
loginItem.setAttribute("loginID", login.guid);
|
loginItem.setAttribute("loginID", login.guid);
|
||||||
|
@ -473,7 +473,7 @@ var Logins = {
|
||||||
return loginItem;
|
return loginItem;
|
||||||
},
|
},
|
||||||
|
|
||||||
handleEvent: function (event) {
|
handleEvent: function(event) {
|
||||||
switch (event.type) {
|
switch (event.type) {
|
||||||
case "popstate": {
|
case "popstate": {
|
||||||
this._onPopState(event);
|
this._onPopState(event);
|
||||||
|
@ -486,7 +486,7 @@ var Logins = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case "passwordmgr-storage-changed": {
|
case "passwordmgr-storage-changed": {
|
||||||
this._reloadList();
|
this._reloadList();
|
||||||
|
|
|
@ -90,7 +90,7 @@ AboutRedirector.prototype = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAboutModule]),
|
||||||
classID: Components.ID("{322ba47e-7047-4f71-aebf-cb7d69325cd9}"),
|
classID: Components.ID("{322ba47e-7047-4f71-aebf-cb7d69325cd9}"),
|
||||||
|
|
||||||
_getModuleInfo: function (aURI) {
|
_getModuleInfo: function(aURI) {
|
||||||
let moduleName = aURI.pathQueryRef.replace(/[?#].*/, "").toLowerCase();
|
let moduleName = aURI.pathQueryRef.replace(/[?#].*/, "").toLowerCase();
|
||||||
return modules[moduleName];
|
return modules[moduleName];
|
||||||
},
|
},
|
||||||
|
|
|
@ -17,7 +17,7 @@ BrowserCLH.prototype = {
|
||||||
*
|
*
|
||||||
* Consumers can access Android assets using resource://android/assets/FILENAME.
|
* 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);
|
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
|
// 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;
|
let url = registry.convertChromeURL(Services.io.newURI("chrome://browser/content/aboutHome.xhtml")).spec;
|
||||||
|
@ -28,7 +28,7 @@ BrowserCLH.prototype = {
|
||||||
protocolHandler.setSubstitution("android", Services.io.newURI(url));
|
protocolHandler.setSubstitution("android", Services.io.newURI(url));
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case "app-startup":
|
case "app-startup":
|
||||||
this.setResourceSubstitutions();
|
this.setResourceSubstitutions();
|
||||||
|
|
|
@ -161,5 +161,5 @@ ContentPermissionPrompt.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
//module initialization
|
// module initialization
|
||||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);
|
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([ContentPermissionPrompt]);
|
||||||
|
|
|
@ -29,7 +29,7 @@ function FxAccountsPush() {
|
||||||
}
|
}
|
||||||
|
|
||||||
FxAccountsPush.prototype = {
|
FxAccountsPush.prototype = {
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
switch (topic) {
|
switch (topic) {
|
||||||
case "android-push-service":
|
case "android-push-service":
|
||||||
if (data === "android-fxa-subscribe") {
|
if (data === "android-fxa-subscribe") {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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 { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ HelperAppLauncherDialog.prototype = {
|
||||||
*
|
*
|
||||||
* Returns true otherwise.
|
* Returns true otherwise.
|
||||||
*/
|
*/
|
||||||
_canDownload: function (url, alreadyResolved=false) {
|
_canDownload: function(url, alreadyResolved = false) {
|
||||||
// The common case.
|
// The common case.
|
||||||
if (url.schemeIs("http") ||
|
if (url.schemeIs("http") ||
|
||||||
url.schemeIs("https") ||
|
url.schemeIs("https") ||
|
||||||
|
@ -89,7 +89,7 @@ HelperAppLauncherDialog.prototype = {
|
||||||
* Returns true if `launcher` represents a download for which we wish
|
* Returns true if `launcher` represents a download for which we wish
|
||||||
* to prompt.
|
* to prompt.
|
||||||
*/
|
*/
|
||||||
_shouldPrompt: function (launcher) {
|
_shouldPrompt: function(launcher) {
|
||||||
let mimeType = this._getMimeTypeFromLauncher(launcher);
|
let mimeType = this._getMimeTypeFromLauncher(launcher);
|
||||||
|
|
||||||
// Straight equality: nsIMIMEInfo normalizes.
|
// Straight equality: nsIMIMEInfo normalizes.
|
||||||
|
@ -290,7 +290,7 @@ HelperAppLauncherDialog.prototype = {
|
||||||
return "browser.download.preferred." + mimetype.replace("\\", ".");
|
return "browser.download.preferred." + mimetype.replace("\\", ".");
|
||||||
},
|
},
|
||||||
|
|
||||||
_getMimeTypeFromLauncher: function (launcher) {
|
_getMimeTypeFromLauncher: function(launcher) {
|
||||||
let mime = launcher.MIMEInfo.MIMEType;
|
let mime = launcher.MIMEInfo.MIMEType;
|
||||||
if (!mime)
|
if (!mime)
|
||||||
mime = ContentAreaUtils.getMIMETypeForURI(launcher.source) || "";
|
mime = ContentAreaUtils.getMIMETypeForURI(launcher.source) || "";
|
||||||
|
@ -321,7 +321,7 @@ HelperAppLauncherDialog.prototype = {
|
||||||
Services.prefs.clearUserPref(this._getPrefName(mime));
|
Services.prefs.clearUserPref(this._getPrefName(mime));
|
||||||
},
|
},
|
||||||
|
|
||||||
promptForSaveToFileAsync: function (aLauncher, aContext, aDefaultFile,
|
promptForSaveToFileAsync: function(aLauncher, aContext, aDefaultFile,
|
||||||
aSuggestedFileExt, aForcePrompt) {
|
aSuggestedFileExt, aForcePrompt) {
|
||||||
Task.spawn(function* () {
|
Task.spawn(function* () {
|
||||||
let file = null;
|
let file = null;
|
||||||
|
@ -377,7 +377,7 @@ HelperAppLauncherDialog.prototype = {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// replace the last (n) in the filename with (n+1)
|
// 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);
|
aLocalFile.create(Ci.nsIFile.NORMAL_FILE_TYPE, 0o600);
|
||||||
|
|
|
@ -8,21 +8,21 @@ Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Timer.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";
|
const PLACEHOLDER_IMG = "chrome://browser/skin/images/placeholder_image.svg";
|
||||||
|
|
||||||
//// Telemetry
|
// // Telemetry
|
||||||
const TELEMETRY_TAP_TO_LOAD_ENABLED = "TAP_TO_LOAD_ENABLED";
|
const TELEMETRY_TAP_TO_LOAD_ENABLED = "TAP_TO_LOAD_ENABLED";
|
||||||
const TELEMETRY_SHOW_IMAGE_SIZE = "TAP_TO_LOAD_IMAGE_SIZE";
|
const TELEMETRY_SHOW_IMAGE_SIZE = "TAP_TO_LOAD_IMAGE_SIZE";
|
||||||
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
|
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
|
||||||
|
|
||||||
//// Gecko preference
|
// // Gecko preference
|
||||||
const PREF_IMAGEBLOCKING = "browser.image_blocking";
|
const PREF_IMAGEBLOCKING = "browser.image_blocking";
|
||||||
|
|
||||||
//// Enabled options
|
// // Enabled options
|
||||||
const OPTION_NEVER = 0;
|
const OPTION_NEVER = 0;
|
||||||
const OPTION_ALWAYS = 1;
|
const OPTION_ALWAYS = 1;
|
||||||
const OPTION_WIFI_ONLY = 2;
|
const OPTION_WIFI_ONLY = 2;
|
||||||
|
@ -95,7 +95,7 @@ ImageBlockingPolicy.prototype = {
|
||||||
return Services.prefs.getIntPref(PREF_IMAGEBLOCKING);
|
return Services.prefs.getIntPref(PREF_IMAGEBLOCKING);
|
||||||
},
|
},
|
||||||
|
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
if (topic == TOPIC_GATHER_TELEMETRY) {
|
if (topic == TOPIC_GATHER_TELEMETRY) {
|
||||||
Services.telemetry.getHistogramById(TELEMETRY_TAP_TO_LOAD_ENABLED).add(this._enabled());
|
Services.telemetry.getHistogramById(TELEMETRY_TAP_TO_LOAD_ENABLED).add(this._enabled());
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ ImageBlockingPolicy.prototype = {
|
||||||
function sendImageSizeTelemetry(imageURL) {
|
function sendImageSizeTelemetry(imageURL) {
|
||||||
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
|
let xhr = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"].createInstance(Ci.nsIXMLHttpRequest);
|
||||||
xhr.open("HEAD", imageURL, true);
|
xhr.open("HEAD", imageURL, true);
|
||||||
xhr.onreadystatechange = function (e) {
|
xhr.onreadystatechange = function(e) {
|
||||||
if (xhr.readyState != 4) {
|
if (xhr.readyState != 4) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,7 +90,7 @@ LoginManagerPrompter.prototype = {
|
||||||
*
|
*
|
||||||
* Internal function for logging debug messages to the Error Console window.
|
* Internal function for logging debug messages to the Error Console window.
|
||||||
*/
|
*/
|
||||||
log: function (message) {
|
log: function(message) {
|
||||||
if (!this._debug)
|
if (!this._debug)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* init
|
* init
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
init: function (aWindow, aFactory) {
|
init: function(aWindow, aFactory) {
|
||||||
this._chromeWindow = this._getChromeWindow(aWindow).wrappedJSObject;
|
this._chromeWindow = this._getChromeWindow(aWindow).wrappedJSObject;
|
||||||
this._factory = aFactory || null;
|
this._factory = aFactory || null;
|
||||||
this._browser = null;
|
this._browser = null;
|
||||||
|
@ -126,7 +126,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* promptToSavePassword
|
* promptToSavePassword
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
promptToSavePassword: function (aLogin) {
|
promptToSavePassword: function(aLogin) {
|
||||||
this._showSaveLoginNotification(aLogin);
|
this._showSaveLoginNotification(aLogin);
|
||||||
Services.telemetry.getHistogramById("PWMGR_PROMPT_REMEMBER_ACTION").add(PROMPT_DISPLAYED);
|
Services.telemetry.getHistogramById("PWMGR_PROMPT_REMEMBER_ACTION").add(PROMPT_DISPLAYED);
|
||||||
Services.obs.notifyObservers(aLogin, "passwordmgr-prompt-save");
|
Services.obs.notifyObservers(aLogin, "passwordmgr-prompt-save");
|
||||||
|
@ -145,7 +145,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* @param aPassword
|
* @param aPassword
|
||||||
* Password string used in creating a doorhanger action
|
* 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 tabID = this._chromeWindow.BrowserApp.getTabForBrowser(this._browser).id;
|
||||||
|
|
||||||
let actionText = {
|
let actionText = {
|
||||||
|
@ -181,7 +181,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* their login, and only save a login which they know worked.
|
* 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 brandShortName = this._strBundle.brand.GetStringFromName("brandShortName");
|
||||||
let notificationText = this._getLocalizedString("saveLogin", [brandShortName]);
|
let notificationText = this._getLocalizedString("saveLogin", [brandShortName]);
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* fields.
|
* fields.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
promptToChangePassword: function (aOldLogin, aNewLogin) {
|
promptToChangePassword: function(aOldLogin, aNewLogin) {
|
||||||
this._showChangeLoginNotification(aOldLogin, aNewLogin.password);
|
this._showChangeLoginNotification(aOldLogin, aNewLogin.password);
|
||||||
Services.telemetry.getHistogramById("PWMGR_PROMPT_UPDATE_ACTION").add(PROMPT_DISPLAYED);
|
Services.telemetry.getHistogramById("PWMGR_PROMPT_UPDATE_ACTION").add(PROMPT_DISPLAYED);
|
||||||
let oldGUID = aOldLogin.QueryInterface(Ci.nsILoginMetaInfo).guid;
|
let oldGUID = aOldLogin.QueryInterface(Ci.nsILoginMetaInfo).guid;
|
||||||
|
@ -239,7 +239,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* Shows the Change Password notification doorhanger.
|
* Shows the Change Password notification doorhanger.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
_showChangeLoginNotification: function (aOldLogin, aNewPassword) {
|
_showChangeLoginNotification: function(aOldLogin, aNewPassword) {
|
||||||
var notificationText;
|
var notificationText;
|
||||||
if (aOldLogin.username) {
|
if (aOldLogin.username) {
|
||||||
let displayUser = this._sanitizeUsername(aOldLogin.username);
|
let displayUser = this._sanitizeUsername(aOldLogin.username);
|
||||||
|
@ -290,7 +290,7 @@ LoginManagerPrompter.prototype = {
|
||||||
*
|
*
|
||||||
* Note; XPCOM stupidity: |count| is just |logins.length|.
|
* 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;
|
const buttonFlags = Ci.nsIPrompt.STD_YES_NO_BUTTONS;
|
||||||
|
|
||||||
var usernames = logins.map(l => l.username);
|
var usernames = logins.map(l => l.username);
|
||||||
|
@ -317,7 +317,7 @@ LoginManagerPrompter.prototype = {
|
||||||
/*
|
/*
|
||||||
* _updateLogin
|
* _updateLogin
|
||||||
*/
|
*/
|
||||||
_updateLogin: function (login, newPassword) {
|
_updateLogin: function(login, newPassword) {
|
||||||
var now = Date.now();
|
var now = Date.now();
|
||||||
var propBag = Cc["@mozilla.org/hash-property-bag;1"].
|
var propBag = Cc["@mozilla.org/hash-property-bag;1"].
|
||||||
createInstance(Ci.nsIWritablePropertyBag);
|
createInstance(Ci.nsIWritablePropertyBag);
|
||||||
|
@ -338,7 +338,7 @@ LoginManagerPrompter.prototype = {
|
||||||
*
|
*
|
||||||
* Given a content DOM window, returns the chrome window it's in.
|
* Given a content DOM window, returns the chrome window it's in.
|
||||||
*/
|
*/
|
||||||
_getChromeWindow: function (aWindow) {
|
_getChromeWindow: function(aWindow) {
|
||||||
if (aWindow instanceof Ci.nsIDOMChromeWindow)
|
if (aWindow instanceof Ci.nsIDOMChromeWindow)
|
||||||
return aWindow;
|
return aWindow;
|
||||||
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
|
@ -354,7 +354,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* Returns the NativeWindow to this prompter, or null if there isn't
|
* Returns the NativeWindow to this prompter, or null if there isn't
|
||||||
* a NativeWindow available (w/ error sent to logcat).
|
* a NativeWindow available (w/ error sent to logcat).
|
||||||
*/
|
*/
|
||||||
_getNativeWindow: function () {
|
_getNativeWindow: function() {
|
||||||
let nativeWindow = null;
|
let nativeWindow = null;
|
||||||
try {
|
try {
|
||||||
let chromeWin = this._chromeWindow;
|
let chromeWin = this._chromeWindow;
|
||||||
|
@ -384,7 +384,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* formatted if required.
|
* formatted if required.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
_getLocalizedString: function (key, formatArgs) {
|
_getLocalizedString: function(key, formatArgs) {
|
||||||
if (formatArgs)
|
if (formatArgs)
|
||||||
return this._strBundle.pwmgr.formatStringFromName(
|
return this._strBundle.pwmgr.formatStringFromName(
|
||||||
key, formatArgs, formatArgs.length);
|
key, formatArgs, formatArgs.length);
|
||||||
|
@ -399,7 +399,7 @@ LoginManagerPrompter.prototype = {
|
||||||
* it's too long. This helps prevent an evil site from messing with the
|
* it's too long. This helps prevent an evil site from messing with the
|
||||||
* "save password?" prompt too much.
|
* "save password?" prompt too much.
|
||||||
*/
|
*/
|
||||||
_sanitizeUsername: function (username) {
|
_sanitizeUsername: function(username) {
|
||||||
if (username.length > 30) {
|
if (username.length > 30) {
|
||||||
username = username.substring(0, 30);
|
username = username.substring(0, 30);
|
||||||
username += this._ellipsis;
|
username += this._ellipsis;
|
||||||
|
|
|
@ -391,7 +391,7 @@ InternalPrompt.prototype = {
|
||||||
|
|
||||||
/* ---------- nsIAuthPrompt ---------- */
|
/* ---------- 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
|
// TODO: Port functions from nsLoginManagerPrompter.js to here
|
||||||
if (defaultText)
|
if (defaultText)
|
||||||
result.value = defaultText;
|
result.value = defaultText;
|
||||||
|
@ -538,7 +538,7 @@ InternalPrompt.prototype = {
|
||||||
// If the user submits a login but it fails, we need to remove the
|
// If the user submits a login but it fails, we need to remove the
|
||||||
// notification bar that was displayed. Conveniently, the user will
|
// notification bar that was displayed. Conveniently, the user will
|
||||||
// be prompted for authentication again, which brings us here.
|
// be prompted for authentication again, which brings us here.
|
||||||
//this._removeLoginNotifications();
|
// this._removeLoginNotifications();
|
||||||
|
|
||||||
cancelable = {
|
cancelable = {
|
||||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
|
QueryInterface: XPCOMUtils.generateQI([Ci.nsICancelable]),
|
||||||
|
@ -811,7 +811,7 @@ var PromptUtils = {
|
||||||
return [username, password];
|
return [username, password];
|
||||||
},
|
},
|
||||||
|
|
||||||
setAuthInfo: function (aAuthInfo, username, password) {
|
setAuthInfo: function(aAuthInfo, username, password) {
|
||||||
var flags = aAuthInfo.flags;
|
var flags = aAuthInfo.flags;
|
||||||
if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
|
if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
|
||||||
// Domain is separated from username by a backslash
|
// Domain is separated from username by a backslash
|
||||||
|
@ -820,7 +820,7 @@ var PromptUtils = {
|
||||||
aAuthInfo.username = username;
|
aAuthInfo.username = username;
|
||||||
} else {
|
} else {
|
||||||
aAuthInfo.domain = username.substring(0, idx);
|
aAuthInfo.domain = username.substring(0, idx);
|
||||||
aAuthInfo.username = username.substring(idx+1);
|
aAuthInfo.username = username.substring(idx + 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
aAuthInfo.username = username;
|
aAuthInfo.username = username;
|
||||||
|
@ -850,11 +850,11 @@ var PromptUtils = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(PromptUtils, "passwdBundle", function () {
|
XPCOMUtils.defineLazyGetter(PromptUtils, "passwdBundle", function() {
|
||||||
return Services.strings.createBundle("chrome://passwordmgr/locale/passwordmgr.properties");
|
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");
|
return Services.strings.createBundle("chrome://global/locale/commonDialogs.properties");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1480,7 +1480,7 @@ SessionStore.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the tab data is in the closedTabs array, remove it.
|
// If the tab data is in the closedTabs array, remove it.
|
||||||
closedTabs.find(function (tabData, i) {
|
closedTabs.find(function(tabData, i) {
|
||||||
if (tabData == aCloseTabData) {
|
if (tabData == aCloseTabData) {
|
||||||
closedTabs.splice(i, 1);
|
closedTabs.splice(i, 1);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1554,7 +1554,7 @@ SessionStore.prototype = {
|
||||||
|
|
||||||
let tabs = closedTabs
|
let tabs = closedTabs
|
||||||
.filter(tab => tab.isPrivate == isPrivate)
|
.filter(tab => tab.isPrivate == isPrivate)
|
||||||
.map(function (tab) {
|
.map(function(tab) {
|
||||||
// Get the url and title for the current entry in the session history.
|
// Get the url and title for the current entry in the session history.
|
||||||
let entry = tab.entries[tab.index - 1];
|
let entry = tab.entries[tab.index - 1];
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -24,7 +24,7 @@ let clearCookies = async function(options) {
|
||||||
|
|
||||||
if (options.since) {
|
if (options.since) {
|
||||||
// Convert it to microseconds
|
// 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.
|
// Iterate through the cookies and delete any created after our cutoff.
|
||||||
let cookiesEnum = cookieMgr.enumerator;
|
let cookiesEnum = cookieMgr.enumerator;
|
||||||
while (cookiesEnum.hasMoreElements()) {
|
while (cookiesEnum.hasMoreElements()) {
|
||||||
|
@ -66,7 +66,7 @@ this.browsingData = class extends ExtensionAPI {
|
||||||
for (let item of PREF_LIST) {
|
for (let item of PREF_LIST) {
|
||||||
// The property formData needs a different case than the
|
// The property formData needs a different case than the
|
||||||
// formdata preference.
|
// formdata preference.
|
||||||
switch (item){
|
switch (item) {
|
||||||
case "formdata":
|
case "formdata":
|
||||||
name = "formData";
|
name = "formData";
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -26,11 +26,11 @@ function checkPrefs(key, actualValue, prefs, prefSuffix) {
|
||||||
is(actualValue, prefValue, `${key} property of dataToRemove matches the expected pref.`);
|
is(actualValue, prefValue, `${key} property of dataToRemove matches the expected pref.`);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testSettingsPreferences(dataToRemove){
|
function testSettingsPreferences(dataToRemove) {
|
||||||
let prefs = SharedPreferences.forProfile().getSetPref(PREF_DOMAIN);
|
let prefs = SharedPreferences.forProfile().getSetPref(PREF_DOMAIN);
|
||||||
|
|
||||||
for (let key of Object.keys(dataToRemove)) {
|
for (let key of Object.keys(dataToRemove)) {
|
||||||
switch (key){
|
switch (key) {
|
||||||
case "formData":
|
case "formData":
|
||||||
checkPrefs(key, dataToRemove[key], prefs, "formdata");
|
checkPrefs(key, dataToRemove[key], prefs, "formdata");
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -8,10 +8,10 @@ this.EXPORTED_SYMBOLS = ["Accounts"];
|
||||||
|
|
||||||
const { utils: Cu } = Components;
|
const { utils: Cu } = Components;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Deprecated.jsm"); /*global Deprecated */
|
Cu.import("resource://gre/modules/Deprecated.jsm"); /* global Deprecated */
|
||||||
Cu.import("resource://gre/modules/Messaging.jsm"); /*global Messaging */
|
Cu.import("resource://gre/modules/Messaging.jsm"); /* global Messaging */
|
||||||
Cu.import("resource://gre/modules/Promise.jsm"); /*global Promise */
|
Cu.import("resource://gre/modules/Promise.jsm"); /* global Promise */
|
||||||
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
|
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A promise-based API for querying the existence of Sync accounts,
|
* A promise-based API for querying the existence of Sync accounts,
|
||||||
|
@ -33,25 +33,25 @@ Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
|
||||||
* );
|
* );
|
||||||
*/
|
*/
|
||||||
var Accounts = Object.freeze({
|
var Accounts = Object.freeze({
|
||||||
_accountsExist: function (kind) {
|
_accountsExist: function(kind) {
|
||||||
return EventDispatcher.instance.sendRequestForResult({
|
return EventDispatcher.instance.sendRequestForResult({
|
||||||
type: "Accounts:Exist",
|
type: "Accounts:Exist",
|
||||||
kind: kind
|
kind: kind
|
||||||
}).then(data => data.exists);
|
}).then(data => data.exists);
|
||||||
},
|
},
|
||||||
|
|
||||||
firefoxAccountsExist: function () {
|
firefoxAccountsExist: function() {
|
||||||
return this._accountsExist("fxa");
|
return this._accountsExist("fxa");
|
||||||
},
|
},
|
||||||
|
|
||||||
syncAccountsExist: function () {
|
syncAccountsExist: function() {
|
||||||
Deprecated.warning("The legacy Sync account type has been removed from Firefox for Android. " +
|
Deprecated.warning("The legacy Sync account type has been removed from Firefox for Android. " +
|
||||||
"Please use `firefoxAccountsExist` instead.",
|
"Please use `firefoxAccountsExist` instead.",
|
||||||
"https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/Accounts.jsm");
|
"https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/Accounts.jsm");
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
},
|
},
|
||||||
|
|
||||||
anySyncAccountsExist: function () {
|
anySyncAccountsExist: function() {
|
||||||
return this._accountsExist("any");
|
return this._accountsExist("any");
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -65,14 +65,14 @@ var Accounts = Object.freeze({
|
||||||
*
|
*
|
||||||
* There is no return value from this method.
|
* There is no return value from this method.
|
||||||
*/
|
*/
|
||||||
launchSetup: function (extras) {
|
launchSetup: function(extras) {
|
||||||
EventDispatcher.instance.sendRequest({
|
EventDispatcher.instance.sendRequest({
|
||||||
type: "Accounts:Create",
|
type: "Accounts:Create",
|
||||||
extras: extras
|
extras: extras
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
_addDefaultEndpoints: function (json) {
|
_addDefaultEndpoints: function(json) {
|
||||||
let newData = Cu.cloneInto(json, {}, { cloneFunctions: false });
|
let newData = Cu.cloneInto(json, {}, { cloneFunctions: false });
|
||||||
let associations = {
|
let associations = {
|
||||||
authServerEndpoint: 'identity.fxaccounts.auth.uri',
|
authServerEndpoint: 'identity.fxaccounts.auth.uri',
|
||||||
|
@ -94,7 +94,7 @@ var Accounts = Object.freeze({
|
||||||
*
|
*
|
||||||
* Returns a Promise that resolves to a boolean indicating success.
|
* Returns a Promise that resolves to a boolean indicating success.
|
||||||
*/
|
*/
|
||||||
createFirefoxAccountFromJSON: function (json) {
|
createFirefoxAccountFromJSON: function(json) {
|
||||||
return EventDispatcher.instance.sendRequestForResult({
|
return EventDispatcher.instance.sendRequestForResult({
|
||||||
type: "Accounts:CreateFirefoxAccountFromJSON",
|
type: "Accounts:CreateFirefoxAccountFromJSON",
|
||||||
json: this._addDefaultEndpoints(json)
|
json: this._addDefaultEndpoints(json)
|
||||||
|
@ -111,7 +111,7 @@ var Accounts = Object.freeze({
|
||||||
*
|
*
|
||||||
* Returns a Promise that resolves to a boolean indicating success.
|
* Returns a Promise that resolves to a boolean indicating success.
|
||||||
*/
|
*/
|
||||||
updateFirefoxAccountFromJSON: function (json) {
|
updateFirefoxAccountFromJSON: function(json) {
|
||||||
return EventDispatcher.instance.sendRequestForResult({
|
return EventDispatcher.instance.sendRequestForResult({
|
||||||
type: "Accounts:UpdateFirefoxAccountFromJSON",
|
type: "Accounts:UpdateFirefoxAccountFromJSON",
|
||||||
json: this._addDefaultEndpoints(json)
|
json: this._addDefaultEndpoints(json)
|
||||||
|
@ -126,7 +126,7 @@ var Accounts = Object.freeze({
|
||||||
*
|
*
|
||||||
* There is no return value from this method.
|
* There is no return value from this method.
|
||||||
*/
|
*/
|
||||||
notifyFirefoxAccountProfileChanged: function () {
|
notifyFirefoxAccountProfileChanged: function() {
|
||||||
EventDispatcher.instance.sendRequest({
|
EventDispatcher.instance.sendRequest({
|
||||||
type: "Accounts:ProfileUpdated",
|
type: "Accounts:ProfileUpdated",
|
||||||
});
|
});
|
||||||
|
@ -138,7 +138,7 @@ var Accounts = Object.freeze({
|
||||||
* Returns a Promise that resolves to null if no 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.
|
* exists, or an object including at least a string-valued 'email' key.
|
||||||
*/
|
*/
|
||||||
getFirefoxAccount: function () {
|
getFirefoxAccount: function() {
|
||||||
return EventDispatcher.instance.sendRequestForResult({
|
return EventDispatcher.instance.sendRequestForResult({
|
||||||
type: "Accounts:Exist",
|
type: "Accounts:Exist",
|
||||||
kind: "fxa",
|
kind: "fxa",
|
||||||
|
@ -158,13 +158,13 @@ var Accounts = Object.freeze({
|
||||||
*
|
*
|
||||||
* Returns a Promise that resolves to a boolean indicating success.
|
* Returns a Promise that resolves to a boolean indicating success.
|
||||||
*/
|
*/
|
||||||
deleteFirefoxAccount: function () {
|
deleteFirefoxAccount: function() {
|
||||||
return EventDispatcher.instance.sendRequestForResult({
|
return EventDispatcher.instance.sendRequestForResult({
|
||||||
type: "Accounts:DeleteFirefoxAccount",
|
type: "Accounts:DeleteFirefoxAccount",
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
showSyncPreferences: function () {
|
showSyncPreferences: function() {
|
||||||
// Only show Sync preferences of an existing Android Account.
|
// Only show Sync preferences of an existing Android Account.
|
||||||
return Accounts.getFirefoxAccount().then(account => {
|
return Accounts.getFirefoxAccount().then(account => {
|
||||||
if (!account) {
|
if (!account) {
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
"use strict"
|
"use strict"
|
||||||
|
|
||||||
/*globals MessageLoop */
|
/* globals MessageLoop */
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ XPCOMUtils.defineLazyServiceGetter(this, "MessageLoop",
|
||||||
* InitLater(() => Bar.init(), this, "Bar");
|
* InitLater(() => Bar.init(), this, "Bar");
|
||||||
*/
|
*/
|
||||||
var DelayedInit = {
|
var DelayedInit = {
|
||||||
schedule: function (fn, object, name, maxWait) {
|
schedule: function(fn, object, name, maxWait) {
|
||||||
return Impl.scheduleInit(fn, object, name, maxWait);
|
return Impl.scheduleInit(fn, object, name, maxWait);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -61,7 +61,7 @@ const MAX_IDLE_RUN_MS = 50;
|
||||||
var Impl = {
|
var Impl = {
|
||||||
pendingInits: [],
|
pendingInits: [],
|
||||||
|
|
||||||
onIdle: function () {
|
onIdle: function() {
|
||||||
let startTime = Cu.now();
|
let startTime = Cu.now();
|
||||||
let time = startTime;
|
let time = startTime;
|
||||||
let nextDue;
|
let nextDue;
|
||||||
|
@ -92,12 +92,12 @@ var Impl = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
addPendingInit: function (fn, wait) {
|
addPendingInit: function(fn, wait) {
|
||||||
let init = {
|
let init = {
|
||||||
fn: fn,
|
fn: fn,
|
||||||
due: Cu.now() + wait,
|
due: Cu.now() + wait,
|
||||||
complete: false,
|
complete: false,
|
||||||
maybeInit: function () {
|
maybeInit: function() {
|
||||||
if (this.complete) {
|
if (this.complete) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -116,7 +116,7 @@ var Impl = {
|
||||||
return init;
|
return init;
|
||||||
},
|
},
|
||||||
|
|
||||||
scheduleInit: function (fn, object, name, wait) {
|
scheduleInit: function(fn, object, name, wait) {
|
||||||
let init = this.addPendingInit(fn, wait);
|
let init = this.addPendingInit(fn, wait);
|
||||||
|
|
||||||
if (!object || !name) {
|
if (!object || !name) {
|
||||||
|
@ -156,7 +156,7 @@ var Impl = {
|
||||||
}
|
}
|
||||||
return prop.value;
|
return prop.value;
|
||||||
},
|
},
|
||||||
set: function (newVal) {
|
set: function(newVal) {
|
||||||
init.maybeInit();
|
init.maybeInit();
|
||||||
|
|
||||||
// Since our initializer already ran,
|
// Since our initializer already ran,
|
||||||
|
|
|
@ -46,7 +46,7 @@ var notifications = new Map();
|
||||||
var DownloadNotifications = {
|
var DownloadNotifications = {
|
||||||
_notificationKey: "downloads",
|
_notificationKey: "downloads",
|
||||||
|
|
||||||
init: function () {
|
init: function() {
|
||||||
Downloads.getList(Downloads.ALL)
|
Downloads.getList(Downloads.ALL)
|
||||||
.then(list => list.addView(this))
|
.then(list => list.addView(this))
|
||||||
.then(() => this._viewAdded = true, Cu.reportError);
|
.then(() => this._viewAdded = true, Cu.reportError);
|
||||||
|
@ -55,7 +55,7 @@ var DownloadNotifications = {
|
||||||
Notifications.registerHandler(this._notificationKey, this);
|
Notifications.registerHandler(this._notificationKey, this);
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadAdded: function (download) {
|
onDownloadAdded: function(download) {
|
||||||
// Don't create notifications for pre-existing succeeded downloads.
|
// Don't create notifications for pre-existing succeeded downloads.
|
||||||
// We still add notifications for canceled downloads in case the
|
// We still add notifications for canceled downloads in case the
|
||||||
// user decides to retry the download.
|
// user decides to retry the download.
|
||||||
|
@ -80,7 +80,7 @@ var DownloadNotifications = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadChanged: function (download) {
|
onDownloadChanged: function(download) {
|
||||||
let notification = notifications.get(download);
|
let notification = notifications.get(download);
|
||||||
|
|
||||||
if (download.succeeded) {
|
if (download.succeeded) {
|
||||||
|
@ -108,7 +108,7 @@ var DownloadNotifications = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onDownloadRemoved: function (download) {
|
onDownloadRemoved: function(download) {
|
||||||
let notification = notifications.get(download);
|
let notification = notifications.get(download);
|
||||||
if (!notification) {
|
if (!notification) {
|
||||||
Cu.reportError("Download doesn't have a notification.");
|
Cu.reportError("Download doesn't have a notification.");
|
||||||
|
@ -138,7 +138,7 @@ var DownloadNotifications = {
|
||||||
// TODO: I'm not sure what we do here...
|
// TODO: I'm not sure what we do here...
|
||||||
},
|
},
|
||||||
|
|
||||||
showInAboutDownloads: function (download) {
|
showInAboutDownloads: function(download) {
|
||||||
let hash = "#" + window.encodeURIComponent(download.target.path);
|
let hash = "#" + window.encodeURIComponent(download.target.path);
|
||||||
|
|
||||||
// Force using string equality to find a tab
|
// Force using string equality to find a tab
|
||||||
|
@ -191,7 +191,7 @@ function DownloadNotification(download) {
|
||||||
}
|
}
|
||||||
|
|
||||||
DownloadNotification.prototype = {
|
DownloadNotification.prototype = {
|
||||||
_updateFromDownload: function () {
|
_updateFromDownload: function() {
|
||||||
this._downloading = !this.download.stopped;
|
this._downloading = !this.download.stopped;
|
||||||
this._paused = this.download.canceled && this.download.hasPartialData;
|
this._paused = this.download.canceled && this.download.hasPartialData;
|
||||||
this._succeeded = this.download.succeeded;
|
this._succeeded = this.download.succeeded;
|
||||||
|
@ -229,12 +229,12 @@ DownloadNotification.prototype = {
|
||||||
return options;
|
return options;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOptionsForStatic: function (options, titleName) {
|
_updateOptionsForStatic: function(options, titleName) {
|
||||||
options.title = strings.GetStringFromName(titleName);
|
options.title = strings.GetStringFromName(titleName);
|
||||||
options.message = this._fileName;
|
options.message = this._fileName;
|
||||||
},
|
},
|
||||||
|
|
||||||
_updateOptionsForOngoing: function (options, buttons) {
|
_updateOptionsForOngoing: function(options, buttons) {
|
||||||
options.title = this._fileName;
|
options.title = this._fileName;
|
||||||
options.message = this.download.progress + "%";
|
options.message = this.download.progress + "%";
|
||||||
options.buttons = buttons;
|
options.buttons = buttons;
|
||||||
|
@ -243,7 +243,7 @@ DownloadNotification.prototype = {
|
||||||
options.persistent = true;
|
options.persistent = true;
|
||||||
},
|
},
|
||||||
|
|
||||||
showOrUpdate: function () {
|
showOrUpdate: function() {
|
||||||
this._updateFromDownload();
|
this._updateFromDownload();
|
||||||
|
|
||||||
if (this._show) {
|
if (this._show) {
|
||||||
|
@ -263,7 +263,7 @@ DownloadNotification.prototype = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function () {
|
hide: function() {
|
||||||
if (this.id) {
|
if (this.id) {
|
||||||
Notifications.cancel(this.id);
|
Notifications.cancel(this.id);
|
||||||
this.id = null;
|
this.id = null;
|
||||||
|
@ -272,7 +272,7 @@ DownloadNotification.prototype = {
|
||||||
};
|
};
|
||||||
|
|
||||||
var ConfirmCancelPrompt = {
|
var ConfirmCancelPrompt = {
|
||||||
show: function (download) {
|
show: function(download) {
|
||||||
// Open a prompt that offers a choice to cancel the download
|
// Open a prompt that offers a choice to cancel the download
|
||||||
let title = strings.GetStringFromName("downloadCancelPromptTitle1");
|
let title = strings.GetStringFromName("downloadCancelPromptTitle1");
|
||||||
let message = strings.GetStringFromName("downloadCancelPromptMessage1");
|
let message = strings.GetStringFromName("downloadCancelPromptMessage1");
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
*/
|
*/
|
||||||
this.EXPORTED_SYMBOLS = ["EnsureFxAccountsWebChannel"];
|
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/Accounts.jsm"); /* global Accounts */
|
||||||
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
|
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
|
||||||
Cu.import("resource://gre/modules/WebChannel.jsm"); /*global WebChannel */
|
Cu.import("resource://gre/modules/WebChannel.jsm"); /* global WebChannel */
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /*global XPCOMUtils */
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
|
||||||
|
|
||||||
const log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccounts");
|
const log = Cu.import("resource://gre/modules/AndroidLog.jsm", {}).AndroidLog.bind("FxAccounts");
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ const COMMAND_SYNC_PREFERENCES = "fxaccounts:sync_preferences";
|
||||||
const PREF_LAST_FXA_USER = "identity.fxaccounts.lastSignedInUserHash";
|
const PREF_LAST_FXA_USER = "identity.fxaccounts.lastSignedInUserHash";
|
||||||
|
|
||||||
XPCOMUtils.defineLazyGetter(this, "strings",
|
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, "Snackbars", "resource://gre/modules/Snackbars.jsm");
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "Prompt", "resource://gre/modules/Prompt.jsm");
|
XPCOMUtils.defineLazyModuleGetter(this, "Prompt", "resource://gre/modules/Prompt.jsm");
|
||||||
|
|
|
@ -178,9 +178,9 @@ var HelperApps = {
|
||||||
let apps = [];
|
let apps = [];
|
||||||
for (let i = 0; i < appInfo.length; i += numAttr) {
|
for (let i = 0; i < appInfo.length; i += numAttr) {
|
||||||
apps.push(new App({"name": appInfo[i],
|
apps.push(new App({"name": appInfo[i],
|
||||||
"isDefault": appInfo[i+1],
|
"isDefault": appInfo[i + 1],
|
||||||
"packageName": appInfo[i+2],
|
"packageName": appInfo[i + 2],
|
||||||
"activityName": appInfo[i+3]}));
|
"activityName": appInfo[i + 3]}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return apps;
|
return apps;
|
||||||
|
|
|
@ -61,7 +61,7 @@ function BannerMessage(options) {
|
||||||
// private members without leaking it outside Home.jsm.
|
// private members without leaking it outside Home.jsm.
|
||||||
var HomeBannerMessageHandlers;
|
var HomeBannerMessageHandlers;
|
||||||
|
|
||||||
var HomeBanner = (function () {
|
var HomeBanner = (function() {
|
||||||
// Whether there is a "HomeBanner:Get" request we couldn't fulfill.
|
// Whether there is a "HomeBanner:Get" request we couldn't fulfill.
|
||||||
let _pendingRequest = false;
|
let _pendingRequest = false;
|
||||||
|
|
||||||
|
@ -190,7 +190,7 @@ var HomeBanner = (function () {
|
||||||
// private members without leaking it outside Home.jsm.
|
// private members without leaking it outside Home.jsm.
|
||||||
var HomePanelsMessageHandlers;
|
var HomePanelsMessageHandlers;
|
||||||
|
|
||||||
var HomePanels = (function () {
|
var HomePanels = (function() {
|
||||||
// Functions used to handle messages sent from Java.
|
// Functions used to handle messages sent from Java.
|
||||||
HomePanelsMessageHandlers = {
|
HomePanelsMessageHandlers = {
|
||||||
|
|
||||||
|
@ -472,7 +472,7 @@ this.Home = Object.freeze({
|
||||||
panels: HomePanels,
|
panels: HomePanels,
|
||||||
|
|
||||||
// Lazy notification observer registered in browser.js
|
// Lazy notification observer registered in browser.js
|
||||||
onEvent: function (event, data, callback) {
|
onEvent: function(event, data, callback) {
|
||||||
if (event in HomeBannerMessageHandlers) {
|
if (event in HomeBannerMessageHandlers) {
|
||||||
HomeBannerMessageHandlers[event](data);
|
HomeBannerMessageHandlers[event](data);
|
||||||
} else if (event in HomePanelsMessageHandlers) {
|
} else if (event in HomePanelsMessageHandlers) {
|
||||||
|
|
|
@ -809,18 +809,18 @@ var ensureSig = function(classname_or_signature) {
|
||||||
var wrap = function(obj, classSig) {
|
var wrap = function(obj, classSig) {
|
||||||
if (!classSig) { return obj; }
|
if (!classSig) { return obj; }
|
||||||
// don't wrap primitive types.
|
// don't wrap primitive types.
|
||||||
if (classSig.charAt(0)!=='L' &&
|
if (classSig.charAt(0) !== 'L' &&
|
||||||
classSig.charAt(0)!=='[') { return obj; }
|
classSig.charAt(0) !== '[') { return obj; }
|
||||||
var proto = registry[classSig][PREFIX+'proto'];
|
var proto = registry[classSig][PREFIX + 'proto'];
|
||||||
return new proto(obj);
|
return new proto(obj);
|
||||||
};
|
};
|
||||||
var unwrap = function(obj, opt_jenv, opt_ctype) {
|
var unwrap = function(obj, opt_jenv, opt_ctype) {
|
||||||
if (obj && typeof(obj)==='object' && (PREFIX+'obj') in obj) {
|
if (obj && typeof(obj) === 'object' && (PREFIX + 'obj') in obj) {
|
||||||
return obj[PREFIX+'obj'];
|
return obj[PREFIX + 'obj'];
|
||||||
} else if (opt_jenv && opt_ctype) {
|
} else if (opt_jenv && opt_ctype) {
|
||||||
if (opt_ctype !== jobject)
|
if (opt_ctype !== jobject)
|
||||||
return opt_ctype(obj); // cast to given primitive ctype
|
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 unwrap(JNINewString(opt_jenv, obj)); // create Java String
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
|
@ -873,7 +873,7 @@ function JNIClassObj(jenv, classSig) {
|
||||||
// Classes get the leading & trailing chars stripped; primitives
|
// Classes get the leading & trailing chars stripped; primitives
|
||||||
// have to be looked up via their wrapper type.
|
// have to be looked up via their wrapper type.
|
||||||
var prim = function(ty) {
|
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",
|
var jfld = jenvpp().GetStaticFieldID(jenv, jcls, "TYPE",
|
||||||
"Ljava/lang/Class;");
|
"Ljava/lang/Class;");
|
||||||
return jenvpp().GetStaticObjectField(jenv, jcls, jfld);
|
return jenvpp().GetStaticObjectField(jenv, jcls, jfld);
|
||||||
|
@ -901,7 +901,7 @@ function JNIClassSig(jenv, jcls) {
|
||||||
// API is weird. Make sure we're using slashes not dots
|
// API is weird. Make sure we're using slashes not dots
|
||||||
name = name.replace(/\./g, '/');
|
name = name.replace(/\./g, '/');
|
||||||
// special case primitives, arrays
|
// special case primitives, arrays
|
||||||
if (name.charAt(0)==='[') return name;
|
if (name.charAt(0) === '[') return name;
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'void': return 'V';
|
case 'void': return 'V';
|
||||||
case 'boolean': return 'Z';
|
case 'boolean': return 'Z';
|
||||||
|
@ -923,7 +923,7 @@ function JNIClassSig(jenv, jcls) {
|
||||||
// obj['toString()Ljava/lang/String'].call(obj);
|
// obj['toString()Ljava/lang/String'].call(obj);
|
||||||
var overloadFunc = function(basename) {
|
var overloadFunc = function(basename) {
|
||||||
return function() {
|
return function() {
|
||||||
return this[basename+'('+arguments.length+')'].apply(this, arguments);
|
return this[basename + '(' + arguments.length + ')'].apply(this, arguments);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -952,13 +952,13 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
jsuper = JNIClassSig(jenv, jsuper);
|
jsuper = JNIClassSig(jenv, jsuper);
|
||||||
}
|
}
|
||||||
|
|
||||||
registry[classSig] = Object.create(jsuper?ensureLoaded(jenv, jsuper):null);
|
registry[classSig] = Object.create(jsuper ? ensureLoaded(jenv, jsuper) : null);
|
||||||
registry[classSig][PREFIX+'obj'] = jcls; // global ref, persistent.
|
registry[classSig][PREFIX + 'obj'] = jcls; // global ref, persistent.
|
||||||
registry[classSig][PREFIX+'proto'] =
|
registry[classSig][PREFIX + 'proto'] =
|
||||||
function(o) { this[PREFIX+'obj'] = o; };
|
function(o) { this[PREFIX + 'obj'] = o; };
|
||||||
registry[classSig][PREFIX+'proto'].prototype =
|
registry[classSig][PREFIX + 'proto'].prototype =
|
||||||
Object.create(jsuper ?
|
Object.create(jsuper ?
|
||||||
ensureLoaded(jenv, jsuper)[PREFIX+'proto'].prototype :
|
ensureLoaded(jenv, jsuper)[PREFIX + 'proto'].prototype :
|
||||||
null);
|
null);
|
||||||
// Add a __cast__ method to the wrapper corresponding to the class
|
// Add a __cast__ method to the wrapper corresponding to the class
|
||||||
registry[classSig].__cast__ = function(obj) {
|
registry[classSig].__cast__ = function(obj) {
|
||||||
|
@ -967,26 +967,26 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
|
|
||||||
// make wrapper accessible via the classes object.
|
// make wrapper accessible via the classes object.
|
||||||
var path = sig2type(classSig).toLowerCase();
|
var path = sig2type(classSig).toLowerCase();
|
||||||
if (classSig.charAt(0)==='L') {
|
if (classSig.charAt(0) === 'L') {
|
||||||
path = classSig.substring(1, classSig.length-1);
|
path = classSig.substring(1, classSig.length - 1);
|
||||||
}
|
}
|
||||||
if (classSig.charAt(0)!=='[') {
|
if (classSig.charAt(0) !== '[') {
|
||||||
var root = classes, i;
|
var root = classes, i;
|
||||||
var parts = path.split('/');
|
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])) {
|
if (!Object.hasOwnProperty.call(root, parts[i])) {
|
||||||
root[parts[i]] = Object.create(null);
|
root[parts[i]] = Object.create(null);
|
||||||
}
|
}
|
||||||
root = root[parts[i]];
|
root = root[parts[i]];
|
||||||
}
|
}
|
||||||
root[parts[parts.length-1]] = registry[classSig];
|
root[parts[parts.length - 1]] = registry[classSig];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var r = 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
|
// add 'length' field for arrays
|
||||||
Object.defineProperty(rpp, 'length', {
|
Object.defineProperty(rpp, 'length', {
|
||||||
get: function() {
|
get: function() {
|
||||||
|
@ -1001,7 +1001,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
if (!Object.hasOwnProperty.call(registry[elemSig], 'array'))
|
if (!Object.hasOwnProperty.call(registry[elemSig], 'array'))
|
||||||
registry[elemSig].array = r;
|
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]);
|
var elemClass = unwrap(registry[elemSig]);
|
||||||
|
|
||||||
rpp.get = function(idx) {
|
rpp.get = function(idx) {
|
||||||
|
@ -1013,12 +1013,12 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
unwrap(value, jenv, jobject));
|
unwrap(value, jenv, jobject));
|
||||||
};
|
};
|
||||||
rpp.getElements = function(start, len) {
|
rpp.getElements = function(start, len) {
|
||||||
var i, r=[];
|
var i, r = [];
|
||||||
for (i=0; i<len; i++) { r.push(this.get(start+i)); }
|
for (i = 0; i < len; i++) { r.push(this.get(start + i)); }
|
||||||
return r;
|
return r;
|
||||||
};
|
};
|
||||||
rpp.setElements = function(start, vals) {
|
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) {
|
r.new = function(length) {
|
||||||
return wrap(jenvpp().NewObjectArray(jenv, length, elemClass, null),
|
return wrap(jenvpp().NewObjectArray(jenv, length, elemClass, null),
|
||||||
|
@ -1026,9 +1026,9 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
var ty = sig2type(elemSig), ctype = sig2ctype(elemSig);
|
var ty = sig2type(elemSig), ctype = sig2ctype(elemSig);
|
||||||
var constructor = "New"+ty+"Array";
|
var constructor = "New" + ty + "Array";
|
||||||
var getter = "Get"+ty+"ArrayRegion";
|
var getter = "Get" + ty + "ArrayRegion";
|
||||||
var setter = "Set"+ty+"ArrayRegion";
|
var setter = "Set" + ty + "ArrayRegion";
|
||||||
rpp.get = function(idx) { return this.getElements(idx, 1)[0]; };
|
rpp.get = function(idx) { return this.getElements(idx, 1)[0]; };
|
||||||
rpp.set = function(idx, val) { this.setElements(idx, [val]); };
|
rpp.set = function(idx, val) { this.setElements(idx, [val]); };
|
||||||
rpp.getElements = function(start, len) {
|
rpp.getElements = function(start, len) {
|
||||||
|
@ -1052,7 +1052,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
(props.static_fields || []).forEach(function(fld) {
|
(props.static_fields || []).forEach(function(fld) {
|
||||||
var jfld = jenvpp().GetStaticFieldID(jenv, jcls, fld.name, fld.sig);
|
var jfld = jenvpp().GetStaticFieldID(jenv, jcls, fld.name, fld.sig);
|
||||||
var ty = sig2type(fld.sig), nm = 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);
|
ensureLoaded(jenv, nm);
|
||||||
var props = {
|
var props = {
|
||||||
get: function() {
|
get: function() {
|
||||||
|
@ -1071,17 +1071,17 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
(props.static_methods || []).forEach(function(mtd) {
|
(props.static_methods || []).forEach(function(mtd) {
|
||||||
var jmtd = jenvpp().GetStaticMethodID(jenv, jcls, mtd.name, mtd.sig);
|
var jmtd = jenvpp().GetStaticMethodID(jenv, jcls, mtd.name, mtd.sig);
|
||||||
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
|
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 ty = sig2type(returnSig), nm = returnSig;
|
||||||
var call = "CallStatic"+ty+"Method";
|
var call = "CallStatic" + ty + "Method";
|
||||||
ensureLoaded(jenv, nm);
|
ensureLoaded(jenv, nm);
|
||||||
r[mtd.name] = rpp[mtd.name] = overloadFunc(mtd.name);
|
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.
|
// 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 i, j = jenvpp();
|
||||||
var args = [jenv, jcls, jmtd];
|
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]));
|
args.push(unwrap(arguments[i], jenv, argctypes[i]));
|
||||||
}
|
}
|
||||||
return wrap(j[call].apply(j, args), nm);
|
return wrap(j[call].apply(j, args), nm);
|
||||||
|
@ -1091,13 +1091,13 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
mtd.name = "<init>";
|
mtd.name = "<init>";
|
||||||
var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig);
|
var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig);
|
||||||
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
|
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 = 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 i, j = jenvpp();
|
||||||
var args = [jenv, jcls, jmtd];
|
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]));
|
args.push(unwrap(arguments[i], jenv, argctypes[i]));
|
||||||
}
|
}
|
||||||
return wrap(j.NewObject.apply(j, args), classSig);
|
return wrap(j.NewObject.apply(j, args), classSig);
|
||||||
|
@ -1106,7 +1106,7 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
(props.fields || []).forEach(function(fld) {
|
(props.fields || []).forEach(function(fld) {
|
||||||
var jfld = jenvpp().GetFieldID(jenv, jcls, fld.name, fld.sig);
|
var jfld = jenvpp().GetFieldID(jenv, jcls, fld.name, fld.sig);
|
||||||
var ty = sig2type(fld.sig), nm = 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);
|
ensureLoaded(jenv, nm);
|
||||||
Object.defineProperty(rpp, fld.name, {
|
Object.defineProperty(rpp, fld.name, {
|
||||||
get: function() {
|
get: function() {
|
||||||
|
@ -1122,15 +1122,15 @@ function JNILoadClass(jenv, classSig, opt_props) {
|
||||||
(props.methods || []).forEach(function(mtd) {
|
(props.methods || []).forEach(function(mtd) {
|
||||||
var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig);
|
var jmtd = jenvpp().GetMethodID(jenv, jcls, mtd.name, mtd.sig);
|
||||||
var argctypes = mtd.sig.match(sigRegex()).map(s => sig2ctype(s));
|
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 ty = sig2type(returnSig), nm = returnSig;
|
||||||
var call = "Call"+ty+"Method";
|
var call = "Call" + ty + "Method";
|
||||||
ensureLoaded(jenv, nm);
|
ensureLoaded(jenv, nm);
|
||||||
rpp[mtd.name] = overloadFunc(mtd.name);
|
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 i, j = jenvpp();
|
||||||
var args = [jenv, unwrap(this), jmtd];
|
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]));
|
args.push(unwrap(arguments[i], jenv, argctypes[i]));
|
||||||
}
|
}
|
||||||
return wrap(j[call].apply(j, args), nm);
|
return wrap(j[call].apply(j, args), nm);
|
||||||
|
|
|
@ -22,20 +22,20 @@ function LightweightThemeConsumer(aDocument) {
|
||||||
}
|
}
|
||||||
|
|
||||||
LightweightThemeConsumer.prototype = {
|
LightweightThemeConsumer.prototype = {
|
||||||
observe: function (aSubject, aTopic, aData) {
|
observe: function(aSubject, aTopic, aData) {
|
||||||
if (aTopic == "lightweight-theme-styling-update")
|
if (aTopic == "lightweight-theme-styling-update")
|
||||||
this._update(JSON.parse(aData));
|
this._update(JSON.parse(aData));
|
||||||
else if (aTopic == "lightweight-theme-apply")
|
else if (aTopic == "lightweight-theme-apply")
|
||||||
this._update(LightweightThemeManager.currentThemeForDisplay);
|
this._update(LightweightThemeManager.currentThemeForDisplay);
|
||||||
},
|
},
|
||||||
|
|
||||||
destroy: function () {
|
destroy: function() {
|
||||||
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
|
Services.obs.removeObserver(this, "lightweight-theme-styling-update");
|
||||||
Services.obs.removeObserver(this, "lightweight-theme-apply");
|
Services.obs.removeObserver(this, "lightweight-theme-apply");
|
||||||
this._doc = null;
|
this._doc = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
_update: function (aData) {
|
_update: function(aData) {
|
||||||
if (!aData)
|
if (!aData)
|
||||||
aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };
|
aData = { headerURL: "", footerURL: "", textcolor: "", accentcolor: "" };
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ RemoteMedia.prototype = {
|
||||||
return this._status;
|
return this._status;
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function (event, message, callback) {
|
onEvent: function(event, message, callback) {
|
||||||
switch (event) {
|
switch (event) {
|
||||||
case "MediaPlayer:Playing":
|
case "MediaPlayer:Playing":
|
||||||
if (this._status !== "started") {
|
if (this._status !== "started") {
|
||||||
|
|
|
@ -238,7 +238,7 @@ var Notifications = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
QueryInterface: function (aIID) {
|
QueryInterface: function(aIID) {
|
||||||
if (!aIID.equals(Ci.nsISupports) &&
|
if (!aIID.equals(Ci.nsISupports) &&
|
||||||
!aIID.equals(Ci.nsIObserver) &&
|
!aIID.equals(Ci.nsIObserver) &&
|
||||||
!aIID.equals(Ci.nsISupportsWeakReference))
|
!aIID.equals(Ci.nsISupportsWeakReference))
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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 Cc = Components.classes;
|
||||||
var Ci = Components.interfaces;
|
var Ci = Components.interfaces;
|
||||||
|
@ -33,7 +33,7 @@ this.EXPORTED_SYMBOLS = ["Sanitizer"];
|
||||||
|
|
||||||
function Sanitizer() {}
|
function Sanitizer() {}
|
||||||
Sanitizer.prototype = {
|
Sanitizer.prototype = {
|
||||||
clearItem: function (aItemName)
|
clearItem: function(aItemName)
|
||||||
{
|
{
|
||||||
let item = this.items[aItemName];
|
let item = this.items[aItemName];
|
||||||
let canClear = item.canClear;
|
let canClear = item.canClear;
|
||||||
|
@ -49,7 +49,7 @@ Sanitizer.prototype = {
|
||||||
|
|
||||||
items: {
|
items: {
|
||||||
cache: {
|
cache: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
|
@ -78,7 +78,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
cookies: {
|
cookies: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
|
@ -138,7 +138,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
offlineApps: {
|
offlineApps: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
|
var cacheService = Cc["@mozilla.org/netwerk/cache-storage-service;1"].getService(Ci.nsICacheStorageService);
|
||||||
|
@ -158,7 +158,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
history: {
|
history: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
TelemetryStopwatch.start("FX_SANITIZE_HISTORY", refObj);
|
TelemetryStopwatch.start("FX_SANITIZE_HISTORY", refObj);
|
||||||
|
@ -188,7 +188,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
openTabs: {
|
openTabs: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
TelemetryStopwatch.start("FX_SANITIZE_OPENWINDOWS", refObj);
|
TelemetryStopwatch.start("FX_SANITIZE_OPENWINDOWS", refObj);
|
||||||
|
@ -212,7 +212,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
searchHistory: {
|
searchHistory: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearHistory", clearSearchHistory: true })
|
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearHistory", clearSearchHistory: true })
|
||||||
.catch(e => Cu.reportError("Java-side search history clearing failed: " + e))
|
.catch(e => Cu.reportError("Java-side search history clearing failed: " + e))
|
||||||
|
@ -225,7 +225,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
formdata: {
|
formdata: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
|
@ -238,7 +238,7 @@ Sanitizer.prototype = {
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
canClear: function (aCallback)
|
canClear: function(aCallback)
|
||||||
{
|
{
|
||||||
let count = 0;
|
let count = 0;
|
||||||
let countDone = {
|
let countDone = {
|
||||||
|
@ -297,7 +297,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
passwords: {
|
passwords: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
Services.logins.removeAllLogins();
|
Services.logins.removeAllLogins();
|
||||||
|
@ -313,7 +313,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
sessions: {
|
sessions: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let refObj = {};
|
let refObj = {};
|
||||||
|
@ -338,7 +338,7 @@ Sanitizer.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
syncedTabs: {
|
syncedTabs: {
|
||||||
clear: function ()
|
clear: function()
|
||||||
{
|
{
|
||||||
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearSyncedTabs" })
|
return EventDispatcher.instance.sendRequestForResult({ type: "Sanitize:ClearSyncedTabs" })
|
||||||
.catch(e => Cu.reportError("Java-side synced tabs clearing failed: " + e));
|
.catch(e => Cu.reportError("Java-side synced tabs clearing failed: " + e));
|
||||||
|
|
|
@ -210,7 +210,7 @@ function best(iterable, by, isBetter) {
|
||||||
let bestSoFar, bestKeySoFar;
|
let bestSoFar, bestKeySoFar;
|
||||||
let isFirst = true;
|
let isFirst = true;
|
||||||
forEach(
|
forEach(
|
||||||
function (item) {
|
function(item) {
|
||||||
const key = by(item);
|
const key = by(item);
|
||||||
if (isBetter(key, bestKeySoFar) || isFirst) {
|
if (isBetter(key, bestKeySoFar) || isFirst) {
|
||||||
bestSoFar = item;
|
bestSoFar = item;
|
||||||
|
@ -261,7 +261,7 @@ function ruleset(...rules) {
|
||||||
// elements. Return the knowledgebase.
|
// elements. Return the knowledgebase.
|
||||||
//
|
//
|
||||||
// This is the "rank" portion of the rank-and-yank algorithm.
|
// This is the "rank" portion of the rank-and-yank algorithm.
|
||||||
score: function (tree) {
|
score: function(tree) {
|
||||||
const kb = knowledgebase();
|
const kb = knowledgebase();
|
||||||
|
|
||||||
// Introduce the whole DOM into the KB as flavor 'dom' to get
|
// Introduce the whole DOM into the KB as flavor 'dom' to get
|
||||||
|
@ -354,7 +354,7 @@ function knowledgebase() {
|
||||||
return {
|
return {
|
||||||
// Return the "node" (our own data structure that we control) that
|
// Return the "node" (our own data structure that we control) that
|
||||||
// corresponds to a given DOM element, creating one if necessary.
|
// corresponds to a given DOM element, creating one if necessary.
|
||||||
nodeForElement: function (element) {
|
nodeForElement: function(element) {
|
||||||
return getDefault(nodesByElement,
|
return getDefault(nodesByElement,
|
||||||
element,
|
element,
|
||||||
() => ({element,
|
() => ({element,
|
||||||
|
@ -364,17 +364,17 @@ function knowledgebase() {
|
||||||
|
|
||||||
// Return the highest-scored node of the given flavor, undefined if
|
// Return the highest-scored node of the given flavor, undefined if
|
||||||
// there is none.
|
// there is none.
|
||||||
max: function (flavor) {
|
max: function(flavor) {
|
||||||
const nodes = nodesByFlavor.get(flavor);
|
const nodes = nodesByFlavor.get(flavor);
|
||||||
return nodes === undefined ? undefined : max(nodes, node => node.score);
|
return nodes === undefined ? undefined : max(nodes, node => node.score);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Let the KB know that a new flavor has been added to an element.
|
// 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);
|
getDefault(nodesByFlavor, flavor, () => []).push(node);
|
||||||
},
|
},
|
||||||
|
|
||||||
nodesOfFlavor: function (flavor) {
|
nodesOfFlavor: function(flavor) {
|
||||||
return getDefault(nodesByFlavor, flavor, () => []);
|
return getDefault(nodesByFlavor, flavor, () => []);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -43,7 +43,7 @@ DispatcherDelegate.prototype = {
|
||||||
* @param listener Target listener implementing nsIAndroidEventListener.
|
* @param listener Target listener implementing nsIAndroidEventListener.
|
||||||
* @param events String or array of strings of events to listen to.
|
* @param events String or array of strings of events to listen to.
|
||||||
*/
|
*/
|
||||||
registerListener: function (listener, events) {
|
registerListener: function(listener, events) {
|
||||||
if (!this._dispatcher) {
|
if (!this._dispatcher) {
|
||||||
throw new Error("Can only listen in parent process");
|
throw new Error("Can only listen in parent process");
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ DispatcherDelegate.prototype = {
|
||||||
* @param listener Registered listener implementing nsIAndroidEventListener.
|
* @param listener Registered listener implementing nsIAndroidEventListener.
|
||||||
* @param events String or array of strings of events to stop listening to.
|
* @param events String or array of strings of events to stop listening to.
|
||||||
*/
|
*/
|
||||||
unregisterListener: function (listener, events) {
|
unregisterListener: function(listener, events) {
|
||||||
if (!this._dispatcher) {
|
if (!this._dispatcher) {
|
||||||
throw new Error("Can only listen in parent process");
|
throw new Error("Can only listen in parent process");
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,7 @@ DispatcherDelegate.prototype = {
|
||||||
* @param data Optional object containing data for the event.
|
* @param data Optional object containing data for the event.
|
||||||
* @param callback Optional callback implementing nsIAndroidEventCallback.
|
* @param callback Optional callback implementing nsIAndroidEventCallback.
|
||||||
*/
|
*/
|
||||||
dispatch: function (event, data, callback) {
|
dispatch: function(event, data, callback) {
|
||||||
if (this._dispatcher) {
|
if (this._dispatcher) {
|
||||||
this._dispatcher.dispatch(event, data, callback);
|
this._dispatcher.dispatch(event, data, callback);
|
||||||
return;
|
return;
|
||||||
|
@ -113,7 +113,7 @@ DispatcherDelegate.prototype = {
|
||||||
*
|
*
|
||||||
* @param msg Message to send; must be an object with a "type" property
|
* @param msg Message to send; must be an object with a "type" property
|
||||||
*/
|
*/
|
||||||
sendRequest: function (msg) {
|
sendRequest: function(msg) {
|
||||||
let type = msg.type;
|
let type = msg.type;
|
||||||
msg.type = undefined;
|
msg.type = undefined;
|
||||||
this.dispatch(type, msg);
|
this.dispatch(type, msg);
|
||||||
|
@ -125,7 +125,7 @@ DispatcherDelegate.prototype = {
|
||||||
* @param msg Message to send; must be an object with a "type" property
|
* @param msg Message to send; must be an object with a "type" property
|
||||||
* @returns A Promise resolving to the response
|
* @returns A Promise resolving to the response
|
||||||
*/
|
*/
|
||||||
sendRequestForResult: function (msg) {
|
sendRequestForResult: function(msg) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let type = msg.type;
|
let type = msg.type;
|
||||||
msg.type = undefined;
|
msg.type = undefined;
|
||||||
|
@ -167,7 +167,7 @@ DispatcherDelegate.prototype = {
|
||||||
* (see example usage above).
|
* (see example usage above).
|
||||||
* @param event Event name that this listener should observe.
|
* @param event Event name that this listener should observe.
|
||||||
*/
|
*/
|
||||||
addListener: function (listener, event) {
|
addListener: function(listener, event) {
|
||||||
if (this._requestHandler.listeners[event]) {
|
if (this._requestHandler.listeners[event]) {
|
||||||
throw new Error("Error in addListener: A listener already exists for event " + event);
|
throw new Error("Error in addListener: A listener already exists for event " + event);
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ DispatcherDelegate.prototype = {
|
||||||
*
|
*
|
||||||
* @param event The event to stop listening for.
|
* @param event The event to stop listening for.
|
||||||
*/
|
*/
|
||||||
removeListener: function (event) {
|
removeListener: function(event) {
|
||||||
if (!this._requestHandler.listeners[event]) {
|
if (!this._requestHandler.listeners[event]) {
|
||||||
throw new Error("Error in removeListener: There is no listener for event " + event);
|
throw new Error("Error in removeListener: There is no listener for event " + event);
|
||||||
}
|
}
|
||||||
|
@ -216,7 +216,7 @@ DispatcherDelegate.prototype = {
|
||||||
var EventDispatcher = {
|
var EventDispatcher = {
|
||||||
instance: new DispatcherDelegate(IS_PARENT_PROCESS ? Services.androidBridge : undefined),
|
instance: new DispatcherDelegate(IS_PARENT_PROCESS ? Services.androidBridge : undefined),
|
||||||
|
|
||||||
for: function (aWindow) {
|
for: function(aWindow) {
|
||||||
let view = aWindow && aWindow.arguments && aWindow.arguments[0] &&
|
let view = aWindow && aWindow.arguments && aWindow.arguments[0] &&
|
||||||
aWindow.arguments[0].QueryInterface(Ci.nsIAndroidView);
|
aWindow.arguments[0].QueryInterface(Ci.nsIAndroidView);
|
||||||
|
|
||||||
|
@ -232,11 +232,11 @@ var EventDispatcher = {
|
||||||
return new DispatcherDelegate(view);
|
return new DispatcherDelegate(view);
|
||||||
},
|
},
|
||||||
|
|
||||||
forMessageManager: function (aMessageManager) {
|
forMessageManager: function(aMessageManager) {
|
||||||
return new DispatcherDelegate(null, aMessageManager);
|
return new DispatcherDelegate(null, aMessageManager);
|
||||||
},
|
},
|
||||||
|
|
||||||
receiveMessage: function (aMsg) {
|
receiveMessage: function(aMsg) {
|
||||||
// aMsg.data includes keys: global, event, data, uuid
|
// aMsg.data includes keys: global, event, data, uuid
|
||||||
let callback;
|
let callback;
|
||||||
if (aMsg.data.uuid) {
|
if (aMsg.data.uuid) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ function makeObserver(observerId) {
|
||||||
id: observerId,
|
id: observerId,
|
||||||
count: 0,
|
count: 0,
|
||||||
promise: deferred.promise,
|
promise: deferred.promise,
|
||||||
observe: function (subject, topic, data) {
|
observe: function(subject, topic, data) {
|
||||||
ret.count += 1;
|
ret.count += 1;
|
||||||
let msg = { subject: subject,
|
let msg = { subject: subject,
|
||||||
topic: topic,
|
topic: topic,
|
||||||
|
|
|
@ -28,8 +28,8 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
is(anyExists, firefoxExists || syncExists, "sync/firefox account existence consistent with any existence");
|
is(anyExists, firefoxExists || syncExists, "sync/firefox account existence consistent with any existence");
|
||||||
|
|
||||||
// TODO: How can this be cleaned up?
|
// TODO: How can this be cleaned up?
|
||||||
//info("Launching setup.\n");
|
// info("Launching setup.\n");
|
||||||
//Accounts.launchSetup();
|
// Accounts.launchSetup();
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -12,7 +12,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||||
<script type="application/javascript">
|
<script type="application/javascript">
|
||||||
|
|
||||||
/*globals AndroidLog */
|
/* globals AndroidLog */
|
||||||
|
|
||||||
const TAG = "AndroidLogTest";
|
const TAG = "AndroidLogTest";
|
||||||
|
|
||||||
|
|
|
@ -90,14 +90,14 @@
|
||||||
Services.obs.notifyObservers(null, "child-gc-request");
|
Services.obs.notifyObservers(null, "child-gc-request");
|
||||||
|
|
||||||
if (schedGC) {
|
if (schedGC) {
|
||||||
schedGC.call(Cu, { callback: function () {
|
schedGC.call(Cu, { callback: function() {
|
||||||
runSoon(function () { cc(); runSoon(minimizeInner); });
|
runSoon(function() { cc(); runSoon(minimizeInner); });
|
||||||
} });
|
} });
|
||||||
} else {
|
} else {
|
||||||
if (domWindowUtils.garbageCollect) {
|
if (domWindowUtils.garbageCollect) {
|
||||||
domWindowUtils.garbageCollect();
|
domWindowUtils.garbageCollect();
|
||||||
}
|
}
|
||||||
runSoon(function () { cc(); runSoon(minimizeInner); });
|
runSoon(function() { cc(); runSoon(minimizeInner); });
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
runSoon(aCallback);
|
runSoon(aCallback);
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
var result = gResults[i];
|
var result = gResults[i];
|
||||||
logsum += Math.log(result[aProperty]);
|
logsum += Math.log(result[aProperty]);
|
||||||
}
|
}
|
||||||
return Math.round(Math.exp(logsum/gResults.length));
|
return Math.round(Math.exp(logsum / gResults.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
function finalReport() {
|
function finalReport() {
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
perfherder += `{\"name\": \"${result.name}\", \"value\": ${result.resident}}`;
|
perfherder += `{\"name\": \"${result.name}\", \"value\": ${result.resident}}`;
|
||||||
}
|
}
|
||||||
perfherder += "], "; // end subtests
|
perfherder += "], "; // end subtests
|
||||||
perfherder += "\"value\": "+geomean("resident");
|
perfherder += "\"value\": " + geomean("resident");
|
||||||
perfherder += "}"; // end Resident Memory suite
|
perfherder += "}"; // end Resident Memory suite
|
||||||
perfherder += "]"; // end suites
|
perfherder += "]"; // end suites
|
||||||
perfherder += "}"; // end PERFHERDER_DATA
|
perfherder += "}"; // end PERFHERDER_DATA
|
||||||
|
|
|
@ -26,13 +26,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1178722
|
||||||
let SelectHelper = sandbox.SelectHelper;
|
let SelectHelper = sandbox.SelectHelper;
|
||||||
|
|
||||||
// Returns whether an element should be visible according to its text content.
|
// Returns whether an element should be visible according to its text content.
|
||||||
function shouldBeVisible(e){
|
function shouldBeVisible(e) {
|
||||||
return e.label.indexOf("visible") > 0;
|
return e.label.indexOf("visible") > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns an object for the callback method that would normally be created by Prompt.java's
|
// Returns an object for the callback method that would normally be created by Prompt.java's
|
||||||
// addListResult(..) method.
|
// addListResult(..) method.
|
||||||
function createCallBackDummyData(select){
|
function createCallBackDummyData(select) {
|
||||||
var dummyList = [];
|
var dummyList = [];
|
||||||
let listElements = SelectHelper.getListForElement(select);
|
let listElements = SelectHelper.getListForElement(select);
|
||||||
for (var i = 0; i < listElements.length; i++) {
|
for (var i = 0; i < listElements.length; i++) {
|
||||||
|
@ -43,7 +43,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1178722
|
||||||
|
|
||||||
// Wait until the page has loaded so that we can access the DOM.
|
// Wait until the page has loaded so that we can access the DOM.
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
window.onload = function () {
|
window.onload = function() {
|
||||||
let select = document.getElementById("sample-select");
|
let select = document.getElementById("sample-select");
|
||||||
|
|
||||||
// ##############################################
|
// ##############################################
|
||||||
|
|
|
@ -75,7 +75,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
ok((yield db.tableExists("items")), "items table exists");
|
ok((yield db.tableExists("items")), "items table exists");
|
||||||
|
|
||||||
// Make sure the correct values for the item ended up in there.
|
// 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("dataset_id"), TEST_DATASET_ID, "expected dataset ID");
|
||||||
is(row.getResultByName("url"), TEST_URL, "expected test url");
|
is(row.getResultByName("url"), TEST_URL, "expected test url");
|
||||||
is(row.getResultByName("background_url"), TEST_BACKGROUND_URL, "expected background url");
|
is(row.getResultByName("background_url"), TEST_BACKGROUND_URL, "expected background url");
|
||||||
|
|
|
@ -15,9 +15,9 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
|
||||||
Cu.import("resource://gre/modules/Promise.jsm"); /*global Promise */
|
Cu.import("resource://gre/modules/Promise.jsm"); /* global Promise */
|
||||||
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
|
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
|
||||||
Cu.import("resource://gre/modules/NetUtil.jsm"); /*global NetUtil */
|
Cu.import("resource://gre/modules/NetUtil.jsm"); /* global NetUtil */
|
||||||
|
|
||||||
function readChannel(url) {
|
function readChannel(url) {
|
||||||
let deferred = Promise.defer();
|
let deferred = Promise.defer();
|
||||||
|
|
|
@ -24,7 +24,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1263589
|
||||||
|
|
||||||
// Wait until the page has loaded so that we can access the DOM.
|
// Wait until the page has loaded so that we can access the DOM.
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
window.onload = function () {
|
window.onload = function() {
|
||||||
// test options are not incorrectly disabled...
|
// test options are not incorrectly disabled...
|
||||||
let isEnabled1 = document.getElementById("is_enabled_1");
|
let isEnabled1 = document.getElementById("is_enabled_1");
|
||||||
let isEnabled2 = document.getElementById("is_enabled_2");
|
let isEnabled2 = document.getElementById("is_enabled_2");
|
||||||
|
|
|
@ -14,7 +14,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*globals SimpleServiceDiscovery */
|
/* globals SimpleServiceDiscovery */
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
|
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
/*globals SimpleServiceDiscovery */
|
/* globals SimpleServiceDiscovery */
|
||||||
|
|
||||||
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
|
||||||
|
|
||||||
|
|
|
@ -13,14 +13,14 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||||
<script type="application/javascript">
|
<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/Promise.jsm"); /* global Promise */
|
||||||
Cu.import("resource://gre/modules/Services.jsm"); /*global Services */
|
Cu.import("resource://gre/modules/Services.jsm"); /* global Services */
|
||||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /*global XPCOMUtils */
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm"); /* global XPCOMUtils */
|
||||||
Cu.import("resource://gre/modules/Task.jsm"); /*global Task */
|
Cu.import("resource://gre/modules/Task.jsm"); /* global Task */
|
||||||
XPCOMUtils.defineLazyModuleGetter(this, "WebChannel",
|
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_PATH = "http://mochi.test:8888";
|
||||||
const HTTP_ENDPOINT = "/chrome/mobile/android/tests/browser/chrome/web_channel.html";
|
const HTTP_ENDPOINT = "/chrome/mobile/android/tests/browser/chrome/web_channel.html";
|
||||||
|
@ -40,7 +40,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
let tab;
|
let tab;
|
||||||
let channel = new WebChannel("generic", Services.io.newURI(HTTP_PATH));
|
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(id, "generic");
|
||||||
is(message.something.nested, "hello");
|
is(message.something.nested, "hello");
|
||||||
channel.stopListening();
|
channel.stopListening();
|
||||||
|
@ -59,7 +59,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
let tab;
|
let tab;
|
||||||
let channel = new WebChannel("twoway", Services.io.newURI(HTTP_PATH));
|
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");
|
is(id, "twoway");
|
||||||
ok(message.command);
|
ok(message.command);
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ Migrated from Robocop: https://bugzilla.mozilla.org/show_bug.cgi?id=1184186
|
||||||
let tab;
|
let tab;
|
||||||
let channel = new WebChannel("multichannel", Services.io.newURI(HTTP_PATH));
|
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");
|
is(id, "multichannel");
|
||||||
BrowserApp.closeTab(tab);
|
BrowserApp.closeTab(tab);
|
||||||
resolve();
|
resolve();
|
||||||
|
|
|
@ -356,15 +356,15 @@ make -f client.mk build
|
||||||
<script src="../../media/js/wiki-min.js%3Fbuild=f424781"></script>
|
<script src="../../media/js/wiki-min.js%3Fbuild=f424781"></script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
// <![CDATA[
|
||||||
var _tag=new WebTrends();
|
var _tag = new WebTrends();
|
||||||
_tag.dcsGetId();
|
_tag.dcsGetId();
|
||||||
//]]>>
|
// ]]>>
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
//<![CDATA[
|
// <![CDATA[
|
||||||
_tag.dcsCollect();
|
_tag.dcsCollect();
|
||||||
//]]>>
|
// ]]>>
|
||||||
</script>
|
</script>
|
||||||
<noscript>
|
<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>
|
<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>
|
||||||
|
|
|
@ -170,7 +170,7 @@ function _dump_exception_stack(stack) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/************** Functions to be used from the tests **************/
|
/** ************ Functions to be used from the tests **************/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prints a message to the output log.
|
* Prints a message to the output log.
|
||||||
|
@ -291,7 +291,7 @@ function _do_check_neq(left, right, stack, todo) {
|
||||||
do_throw(text, stack);
|
do_throw(text, stack);
|
||||||
} else {
|
} else {
|
||||||
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
|
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
|
||||||
" : " + stack.lineNumber + "] " + text +"\n");
|
" : " + stack.lineNumber + "] " + text + "\n");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!todo) {
|
if (!todo) {
|
||||||
|
@ -328,7 +328,7 @@ function do_report_result(passed, text, stack, todo) {
|
||||||
} else {
|
} else {
|
||||||
if (todo) {
|
if (todo) {
|
||||||
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
|
_dump("TEST-KNOWN-FAIL | " + stack.filename + " | [" + stack.name +
|
||||||
" : " + stack.lineNumber + "] " + text +"\n");
|
" : " + stack.lineNumber + "] " + text + "\n");
|
||||||
} else {
|
} else {
|
||||||
do_throw(text, stack);
|
do_throw(text, stack);
|
||||||
}
|
}
|
||||||
|
@ -400,11 +400,11 @@ function todo_check_false(condition, stack) {
|
||||||
todo_check_eq(condition, false, stack);
|
todo_check_eq(condition, false, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_check_null(condition, stack=Components.stack.caller) {
|
function do_check_null(condition, stack = Components.stack.caller) {
|
||||||
do_check_eq(condition, null, stack);
|
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);
|
todo_check_eq(condition, null, stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ function todo_check_null(condition, stack=Components.stack.caller) {
|
||||||
* is ideal. If you do want to be more careful, you can use function
|
* is ideal. If you do want to be more careful, you can use function
|
||||||
* patterns to implement more stringent checks.
|
* 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 matcher = pattern_matcher(pattern);
|
||||||
var text = "VALUE: " + uneval(value) + "\nPATTERN: " + uneval(pattern) + "\n";
|
var text = "VALUE: " + uneval(value) + "\nPATTERN: " + uneval(pattern) + "\n";
|
||||||
var diagnosis = []
|
var diagnosis = []
|
||||||
|
@ -490,7 +490,7 @@ function do_check_matches(pattern, value, stack=Components.stack.caller, todo=fa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function todo_check_matches(pattern, value, stack=Components.stack.caller) {
|
function todo_check_matches(pattern, value, stack = Components.stack.caller) {
|
||||||
do_check_matches(pattern, value, stack, true);
|
do_check_matches(pattern, value, stack, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -522,7 +522,7 @@ function pattern_matcher(pattern) {
|
||||||
if (ld && !ld.enumerable) {
|
if (ld && !ld.enumerable) {
|
||||||
matchers.push(['length', pattern_matcher(pattern.length)])
|
matchers.push(['length', pattern_matcher(pattern.length)])
|
||||||
}
|
}
|
||||||
return function (value, diagnosis) {
|
return function(value, diagnosis) {
|
||||||
if (!(value && typeof value == "object")) {
|
if (!(value && typeof value == "object")) {
|
||||||
return explain(diagnosis, "value not object");
|
return explain(diagnosis, "value not object");
|
||||||
}
|
}
|
||||||
|
@ -538,7 +538,7 @@ function pattern_matcher(pattern) {
|
||||||
} else if (pattern === undefined) {
|
} else if (pattern === undefined) {
|
||||||
return function(value) { return true; };
|
return function(value) { return true; };
|
||||||
} else {
|
} else {
|
||||||
return function (value, diagnosis) {
|
return function(value, diagnosis) {
|
||||||
if (value !== pattern) {
|
if (value !== pattern) {
|
||||||
return explain(diagnosis, "pattern " + uneval(pattern) + " not === to value " + uneval(value));
|
return explain(diagnosis, "pattern " + uneval(pattern) + " not === to value " + uneval(value));
|
||||||
}
|
}
|
||||||
|
@ -549,7 +549,7 @@ function pattern_matcher(pattern) {
|
||||||
|
|
||||||
// Format an explanation for a pattern match failure, as stored in the
|
// Format an explanation for a pattern match failure, as stored in the
|
||||||
// second argument to a matching function.
|
// second argument to a matching function.
|
||||||
function format_pattern_match_failure(diagnosis, indent="") {
|
function format_pattern_match_failure(diagnosis, indent = "") {
|
||||||
var a;
|
var a;
|
||||||
if (!diagnosis) {
|
if (!diagnosis) {
|
||||||
a = "Matcher did not explain reason for mismatch.";
|
a = "Matcher did not explain reason for mismatch.";
|
||||||
|
@ -785,7 +785,7 @@ JavaBridge.prototype = {
|
||||||
_EventDispatcher: Components.utils.import(
|
_EventDispatcher: Components.utils.import(
|
||||||
"resource://gre/modules/Messaging.jsm", {}).EventDispatcher.instance,
|
"resource://gre/modules/Messaging.jsm", {}).EventDispatcher.instance,
|
||||||
|
|
||||||
_getArgs: function (args) {
|
_getArgs: function(args) {
|
||||||
let out = {
|
let out = {
|
||||||
length: Math.max(0, args.length - 1),
|
length: Math.max(0, args.length - 1),
|
||||||
};
|
};
|
||||||
|
@ -795,7 +795,7 @@ JavaBridge.prototype = {
|
||||||
return out;
|
return out;
|
||||||
},
|
},
|
||||||
|
|
||||||
_sendMessage: function (innerType, args) {
|
_sendMessage: function(innerType, args) {
|
||||||
this._EventDispatcher.dispatch(this._JAVA_EVENT_TYPE, {
|
this._EventDispatcher.dispatch(this._JAVA_EVENT_TYPE, {
|
||||||
innerType: innerType,
|
innerType: innerType,
|
||||||
method: args[0],
|
method: args[0],
|
||||||
|
@ -828,7 +828,7 @@ JavaBridge.prototype = {
|
||||||
* Synchronously call a method in Java,
|
* Synchronously call a method in Java,
|
||||||
* given the method name followed by a list of arguments.
|
* given the method name followed by a list of arguments.
|
||||||
*/
|
*/
|
||||||
syncCall: function (methodName /*, ... */) {
|
syncCall: function(methodName /* , ... */) {
|
||||||
this._sendMessage("sync-call", arguments);
|
this._sendMessage("sync-call", arguments);
|
||||||
let thread = this._Services.tm.currentThread;
|
let thread = this._Services.tm.currentThread;
|
||||||
let initialReplies = this._repliesNeeded;
|
let initialReplies = this._repliesNeeded;
|
||||||
|
@ -845,14 +845,14 @@ JavaBridge.prototype = {
|
||||||
* Asynchronously call a method in Java,
|
* Asynchronously call a method in Java,
|
||||||
* given the method name followed by a list of arguments.
|
* given the method name followed by a list of arguments.
|
||||||
*/
|
*/
|
||||||
asyncCall: function (methodName /*, ... */) {
|
asyncCall: function(methodName /* , ... */) {
|
||||||
this._sendMessage("async-call", arguments);
|
this._sendMessage("async-call", arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect with Java.
|
* Disconnect with Java.
|
||||||
*/
|
*/
|
||||||
disconnect: function () {
|
disconnect: function() {
|
||||||
this._EventDispatcher.unregisterListener(this, this._EVENT_TYPE);
|
this._EventDispatcher.unregisterListener(this, this._EVENT_TYPE);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<html>
|
<html>
|
||||||
<script>
|
<script>
|
||||||
function login(){
|
function login() {
|
||||||
document.login.username.value="Test1";
|
document.login.username.value = "Test1";
|
||||||
document.login.password.value="Test2";
|
document.login.password.value = "Test2";
|
||||||
document.getElementById('submit').click();
|
document.getElementById('submit').click();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<html>
|
<html>
|
||||||
<script>
|
<script>
|
||||||
function login(){
|
function login() {
|
||||||
document.login.username.value="Test2";
|
document.login.username.value = "Test2";
|
||||||
document.login.password.value="Test2";
|
document.login.password.value = "Test2";
|
||||||
document.getElementById('submit').click();
|
document.getElementById('submit').click();
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -58,7 +58,7 @@ function testOneFile(uri) {
|
||||||
|
|
||||||
// Output from head.js is fed, line by line, to this function. We
|
// Output from head.js is fed, line by line, to this function. We
|
||||||
// send any such output back to the Java Robocop harness.
|
// send any such output back to the Java Robocop harness.
|
||||||
testScope.dump = function (str) {
|
testScope.dump = function(str) {
|
||||||
let message = { type: "Robocop:Java",
|
let message = { type: "Robocop:Java",
|
||||||
innerType: "progress",
|
innerType: "progress",
|
||||||
message: str,
|
message: str,
|
||||||
|
|
|
@ -39,7 +39,7 @@ function startup(aData, aReason) {
|
||||||
|
|
||||||
// Load into any new windows
|
// Load into any new windows
|
||||||
wm.addListener(windowListener);
|
wm.addListener(windowListener);
|
||||||
EventDispatcher.instance.registerListener(function (event, data, callback) {
|
EventDispatcher.instance.registerListener(function(event, data, callback) {
|
||||||
dump("Robocop:Quit received -- requesting quit");
|
dump("Robocop:Quit received -- requesting quit");
|
||||||
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup);
|
||||||
appStartup.quit(Ci.nsIAppStartup.eForceQuit);
|
appStartup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||||
|
|
|
@ -120,7 +120,7 @@ function check_response(key, response) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let listener = {
|
let listener = {
|
||||||
_checkObject: function (obj) {
|
_checkObject: function(obj) {
|
||||||
do_check_eq(obj.boolean, true);
|
do_check_eq(obj.boolean, true);
|
||||||
do_check_eq(obj.booleanArray.length, 2);
|
do_check_eq(obj.booleanArray.length, 2);
|
||||||
do_check_eq(obj.booleanArray[0], false);
|
do_check_eq(obj.booleanArray[0], false);
|
||||||
|
@ -163,7 +163,7 @@ let listener = {
|
||||||
do_check_eq(obj.mixedArray[1], 1.5);
|
do_check_eq(obj.mixedArray[1], 1.5);
|
||||||
},
|
},
|
||||||
|
|
||||||
onEvent: function (event, data, callback) {
|
onEvent: function(event, data, callback) {
|
||||||
do_check_eq(event, this._type);
|
do_check_eq(event, this._type);
|
||||||
this._callCount++;
|
this._callCount++;
|
||||||
|
|
||||||
|
@ -186,7 +186,7 @@ let listener = {
|
||||||
};
|
};
|
||||||
|
|
||||||
let callbackListener = {
|
let callbackListener = {
|
||||||
onEvent: function (event, data, callback) {
|
onEvent: function(event, data, callback) {
|
||||||
do_check_eq(event, this._type);
|
do_check_eq(event, this._type);
|
||||||
this._callCount++;
|
this._callCount++;
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ function sleep(wait) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
do_print("sleep start");
|
do_print("sleep start");
|
||||||
gTimer.initWithCallback({
|
gTimer.initWithCallback({
|
||||||
notify: function () {
|
notify: function() {
|
||||||
do_print("sleep end");
|
do_print("sleep end");
|
||||||
resolve();
|
resolve();
|
||||||
},
|
},
|
||||||
|
@ -25,7 +25,7 @@ function sleep(wait) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function promiseLoadEvent(browser, url, eventType="load") {
|
function promiseLoadEvent(browser, url, eventType = "load") {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
do_print("Wait browser event: " + eventType);
|
do_print("Wait browser event: " + eventType);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
|
|
||||||
/*globals ReaderMode */
|
/* globals ReaderMode */
|
||||||
|
|
||||||
var { utils: Cu } = Components;
|
var { utils: Cu } = Components;
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ add_task(function* test_snackbar_api() {
|
||||||
Snackbars.show("This is a Snackbar", Snackbars.LENGTH_INDEFINITE, {
|
Snackbars.show("This is a Snackbar", Snackbars.LENGTH_INDEFINITE, {
|
||||||
action: {
|
action: {
|
||||||
label: "Click me",
|
label: "Click me",
|
||||||
callback: function () {}
|
callback: function() {}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||||
Cu.import("resource://gre/modules/Services.jsm");
|
Cu.import("resource://gre/modules/Services.jsm");
|
||||||
Cu.import("resource://gre/modules/Messaging.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) => {
|
return new Promise((resolve, reject) => {
|
||||||
do_print("Wait browser event: " + eventType);
|
do_print("Wait browser event: " + eventType);
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ add_test(function test_telemetry_events() {
|
||||||
let obs = getObserver();
|
let obs = getObserver();
|
||||||
let measurements = removeNonTestMeasurements(obs.getUIMeasurements(clearMeasurements));
|
let measurements = removeNonTestMeasurements(obs.getUIMeasurements(clearMeasurements));
|
||||||
|
|
||||||
measurements.forEach(function (m, i) {
|
measurements.forEach(function(m, i) {
|
||||||
if (m.type === "event") {
|
if (m.type === "event") {
|
||||||
m.sessions = removeNonTestSessions(m.sessions);
|
m.sessions = removeNonTestSessions(m.sessions);
|
||||||
m.sessions.sort(); // Mutates.
|
m.sessions.sort(); // Mutates.
|
||||||
|
@ -101,7 +101,7 @@ add_test(function test_telemetry_events() {
|
||||||
do_check_measurement_eq(expected[i], m);
|
do_check_measurement_eq(expected[i], m);
|
||||||
});
|
});
|
||||||
|
|
||||||
expected.forEach(function (m, i) {
|
expected.forEach(function(m, i) {
|
||||||
do_check_measurement_eq(m, measurements[i]);
|
do_check_measurement_eq(m, measurements[i]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ add_test(function test_telemetry_events() {
|
||||||
* for less typing when initializing the expected arrays.
|
* for less typing when initializing the expected arrays.
|
||||||
*/
|
*/
|
||||||
function expectedArraysToObjs(expectedArrays) {
|
function expectedArraysToObjs(expectedArrays) {
|
||||||
return expectedArrays.map(function (arr) {
|
return expectedArrays.map(function(arr) {
|
||||||
let type = arr[0];
|
let type = arr[0];
|
||||||
if (type === "event") {
|
if (type === "event") {
|
||||||
return {
|
return {
|
||||||
|
@ -135,7 +135,7 @@ function expectedArraysToObjs(expectedArrays) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNonTestMeasurements(measurements) {
|
function removeNonTestMeasurements(measurements) {
|
||||||
return measurements.filter(function (measurement) {
|
return measurements.filter(function(measurement) {
|
||||||
if (measurement.type === "event") {
|
if (measurement.type === "event") {
|
||||||
return measurement.action.startsWith("_test_event_");
|
return measurement.action.startsWith("_test_event_");
|
||||||
} else if (measurement.type === "session") {
|
} else if (measurement.type === "session") {
|
||||||
|
@ -146,7 +146,7 @@ function removeNonTestMeasurements(measurements) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNonTestSessions(sessions) {
|
function removeNonTestSessions(sessions) {
|
||||||
return sessions.filter(function (sessionName) {
|
return sessions.filter(function(sessionName) {
|
||||||
return sessionName.startsWith("_test_session_");
|
return sessionName.startsWith("_test_session_");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ var isResetDone;
|
||||||
|
|
||||||
function getAsyncClientId() {
|
function getAsyncClientId() {
|
||||||
isClientIDSet = false;
|
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
|
// 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).
|
// js messages after we return from the containing function (bug 1253467).
|
||||||
//
|
//
|
||||||
|
@ -23,7 +23,7 @@ function getAsyncClientId() {
|
||||||
// working failed - I have other things to focus on.
|
// working failed - I have other things to focus on.
|
||||||
clientID = retClientID;
|
clientID = retClientID;
|
||||||
isClientIDSet = true;
|
isClientIDSet = true;
|
||||||
}, function (fail) {
|
}, function(fail) {
|
||||||
// Since Java doesn't listen to our messages (bug 1253467), I don't expect
|
// 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.
|
// 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);
|
||||||
|
@ -36,7 +36,7 @@ function pollGetAsyncClientId() {
|
||||||
|
|
||||||
function getAsyncReset() {
|
function getAsyncReset() {
|
||||||
isResetDone = false;
|
isResetDone = false;
|
||||||
ClientID._reset().then(function () {
|
ClientID._reset().then(function() {
|
||||||
isResetDone = true;
|
isResetDone = true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче