--- a/browser/base/content/abouthealthreport/abouthealth.js
+++ b/browser/base/content/abouthealthreport/abouthealth.js
@@ -144,17 +144,19 @@ var healthReportWrapper = {
Cu.reportError("Unexpected remote command received: " + evt.detail.command + ". Ignoring command.");
break;
}
},
initRemotePage() {
let iframe = document.getElementById("remote-report").contentDocument;
iframe.addEventListener("RemoteHealthReportCommand",
- function onCommand(e) { healthReportWrapper.handleRemoteCommand(e); },
+ function onCommand(e) {
+ healthReportWrapper.handleRemoteCommand(e);
+},
false);
healthReportWrapper.updatePrefState();
},
// error handling
ERROR_INIT_FAILED: 1,
ERROR_PAYLOAD_FAILED: 2,
ERROR_PREFS_FAILED: 3,
@@ -170,10 +172,14 @@ var healthReportWrapper = {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_INIT_FAILED);
},
handlePayloadFailure() {
healthReportWrapper.reportFailure(healthReportWrapper.ERROR_PAYLOAD_FAILED);
},
}
-window.addEventListener("load", function() { healthReportWrapper.init(); });
-window.addEventListener("unload", function() { healthReportWrapper.uninit(); });
+window.addEventListener("load", function() {
+ healthReportWrapper.init();
+});
+window.addEventListener("unload", function() {
+ healthReportWrapper.uninit();
+});
--- a/browser/base/content/abouthome/aboutHome.js
+++ b/browser/base/content/abouthome/aboutHome.js
@@ -196,17 +196,19 @@ function ensureSnippetsMapThen(aCallback
.objectStore(SNIPPETS_OBJECTSTORE_NAME).delete(aKey);
return cache.delete(aKey);
},
clear() {
db.transaction(SNIPPETS_OBJECTSTORE_NAME, "readwrite")
.objectStore(SNIPPETS_OBJECTSTORE_NAME).clear();
return cache.clear();
},
- get size() { return cache.size; },
+ get size() {
+ return cache.size;
+},
});
setTimeout(invokeCallbacks, 0);
}
}
}
function onSearchSubmit(aEvent) {
--- a/browser/base/content/browser-fullZoom.js
+++ b/browser/base/content/browser-fullZoom.js
@@ -149,17 +149,19 @@ var FullZoom = {
this._ensureValid(aValue);
// If the current page doesn't have a site-specific preference, then its
// zoom should be set to the new global preference now that the global
// preference has changed.
let hasPref = false;
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(browser.currentURI.spec, this.name, ctxt, {
- handleResult() { hasPref = true; },
+ handleResult() {
+ hasPref = true;
+},
handleCompletion: function() {
if (!hasPref && token.isCurrent)
this._applyPrefToZoom(undefined, browser);
}.bind(this)
});
},
// location change observer
@@ -218,17 +220,19 @@ var FullZoom = {
this._notifyOnLocationChange.bind(this, browser));
return;
}
// It's not cached, so we have to asynchronously fetch it.
let value = undefined;
let token = this._getBrowserToken(browser);
this._cps2.getByDomainAndName(aURI.spec, this.name, ctxt, {
- handleResult(resultPref) { value = resultPref.value; },
+ handleResult(resultPref) {
+ value = resultPref.value;
+},
handleCompletion: function() {
if (!token.isCurrent) {
this._notifyOnLocationChange(browser);
return;
}
this._applyPrefToZoom(value, browser,
this._notifyOnLocationChange.bind(this, browser));
}.bind(this)
@@ -482,17 +486,19 @@ var FullZoom = {
// * Otherwise, this._globalValue is a number, the global value.
return new Promise(resolve => {
if ("_globalValue" in this) {
resolve(this._globalValue);
return;
}
let value = undefined;
this._cps2.getGlobal(this.name, this._loadContextFromBrowser(browser), {
- handleResult(pref) { value = pref.value; },
+ handleResult(pref) {
+ value = pref.value;
+},
handleCompletion: (reason) => {
this._globalValue = this._ensureValid(value);
resolve(this._globalValue);
}
});
});
},
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -412,17 +412,19 @@ var gFxAccounts = {
updateTabContextMenu(aPopupMenu) {
if (!this.sendTabToDeviceEnabled) {
return;
}
const remoteClientPresent = this.remoteClients.length > 0;
["context_sendTabToDevice", "context_sendTabToDevice_separator"]
- .forEach(id => { document.getElementById(id).hidden = !remoteClientPresent });
+ .forEach(id => {
+ document.getElementById(id).hidden = !remoteClientPresent
+});
},
initPageContextMenu(contextMenu) {
if (!this.sendTabToDeviceEnabled) {
return;
}
const remoteClientPresent = this.remoteClients.length > 0;
--- a/browser/base/content/browser-media.js
+++ b/browser/base/content/browser-media.js
@@ -171,17 +171,19 @@ var gEMEHandler = {
Services.prefs.setBoolPref(firstPlayPref, true);
} else {
document.getElementById(anchorId).removeAttribute("firstplay");
}
let mainAction = {
label: gNavigatorBundle.getString(btnLabelId),
accessKey: gNavigatorBundle.getString(btnAccessKeyId),
- callback() { openPreferences("paneContent"); },
+ callback() {
+ openPreferences("paneContent");
+},
dismiss: true
};
let options = {
dismissed: true,
eventCallback: aTopic => aTopic == "swapping",
learnMoreURL: Services.urlFormatter.formatURLPref("app.support.baseURL") + "drm-content",
};
PopupNotifications.show(browser, "drmContentPlaying", message, anchorId, mainAction, null, options);
--- a/browser/base/content/browser-plugins.js
+++ b/browser/base/content/browser-plugins.js
@@ -504,17 +504,19 @@ var gPluginHandler = {
let iconURL = "chrome://mozapps/skin/plugins/notifyPluginCrashed.png";
let reloadLabel = gNavigatorBundle.getString("crashedpluginsMessage.reloadButton.label");
let reloadKey = gNavigatorBundle.getString("crashedpluginsMessage.reloadButton.accesskey");
let buttons = [{
label: reloadLabel,
accessKey: reloadKey,
popup: null,
- callback() { browser.reload(); },
+ callback() {
+ browser.reload();
+},
}];
if (AppConstants.MOZ_CRASHREPORTER &&
PluginCrashReporter.hasCrashReport(pluginID)) {
let submitLabel = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.label");
let submitKey = gNavigatorBundle.getString("crashedpluginsMessage.submitButton.accesskey");
let submitButton = {
label: submitLabel,
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -250,17 +250,19 @@ var TabsInTitlebar = {
ToolbarIconColor.inferFromText();
if (CustomizationHandler.isCustomizing()) {
gCustomizeMode.updateLWTStyling();
}
},
_sizePlaceholder(type, width) {
Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='" + type + "']"),
- function(node) { node.width = width; });
+ function(node) {
+ node.width = width;
+});
},
uninit() {
this._initialized = false;
removeEventListener("resolutionchange", this);
Services.prefs.removeObserver(this._prefName, this);
this._menuObserver.disconnect();
CustomizableUI.removeListener(this);
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1208,17 +1208,19 @@ var gBrowserInit = {
} else {
// Note: loadOneOrMoreURIs *must not* be called if window.arguments.length >= 3.
// Such callers expect that window.arguments[0] is handled as a single URI.
loadOneOrMoreURIs(uriToLoad);
}
}
// Bug 778855 - Perf regression if we do this here. To be addressed in bug 779008.
- setTimeout(function() { SafeBrowsing.init(); }, 2000);
+ setTimeout(function() {
+ SafeBrowsing.init();
+}, 2000);
Services.obs.addObserver(gIdentityHandler, "perm-changed", false);
Services.obs.addObserver(gSessionHistoryObserver, "browser:purge-session-history", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-disabled", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-started", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-blocked", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-origin-blocked", false);
Services.obs.addObserver(gXPInstallObserver, "addon-install-failed", false);
@@ -1975,17 +1977,19 @@ function BrowserOpenTab(event) {
Anything less byzantine is causing horrible crashes, rather believably,
though oddly only on Linux. */
function delayedOpenWindow(chrome, flags, href, postData) {
// The other way to use setTimeout,
// setTimeout(openDialog, 10, chrome, "_blank", flags, url),
// doesn't work here. The extra "magic" extra argument setTimeout adds to
// the callback function would confuse gBrowserInit.onLoad() by making
// window.arguments[1] be an integer instead of null.
- setTimeout(function() { openDialog(chrome, "_blank", flags, href, null, null, postData); }, 10);
+ setTimeout(function() {
+ openDialog(chrome, "_blank", flags, href, null, null, postData);
+}, 10);
}
/* Required because the tab needs time to set up its content viewers and get the load of
the URI kicked off before becoming the active content area. */
function delayedOpenTab(aUrl, aReferrer, aCharset, aPostData, aAllowThirdPartyFixup) {
gBrowser.loadOneTab(aUrl, {
referrerURI: aReferrer,
charset: aCharset,
@@ -3077,17 +3081,19 @@ var BrowserOnClick = {
Services.perms.add(gBrowser.currentURI, "safe-browsing",
Ci.nsIPermissionManager.ALLOW_ACTION,
Ci.nsIPermissionManager.EXPIRE_SESSION);
let buttons = [{
label: gNavigatorBundle.getString("safebrowsing.getMeOutOfHereButton.label"),
accessKey: gNavigatorBundle.getString("safebrowsing.getMeOutOfHereButton.accessKey"),
- callback() { getMeOutOfHere(); }
+ callback() {
+ getMeOutOfHere();
+}
}];
let title;
if (reason === 'malware') {
title = gNavigatorBundle.getString("safebrowsing.reportedAttackSite");
buttons[1] = {
label: gNavigatorBundle.getString("safebrowsing.notAnAttackButton.label"),
accessKey: gNavigatorBundle.getString("safebrowsing.notAnAttackButton.accessKey"),
@@ -3605,17 +3611,19 @@ const BrowserSearch = {
// see bug 335102.
if (Services.search.getEngineByName(engine.title))
hidden = true;
var engines = (hidden ? browser.hiddenEngines : browser.engines) || [];
engines.push({ uri: engine.href,
title: engine.title,
- get icon() { return browser.mIconURL; }
+ get icon() {
+ return browser.mIconURL;
+}
});
if (hidden)
browser.hiddenEngines = engines;
else {
browser.engines = engines;
if (browser == gBrowser.selectedBrowser)
this.updateOpenSearchBadge();
@@ -4594,17 +4602,19 @@ var XULBrowserWindow = {
UpdateBackForwardCommands(gBrowser.webNavigation);
ReaderParent.updateReaderButton(gBrowser.selectedBrowser);
gGestureSupport.restoreRotationState();
// See bug 358202, when tabs are switched during a drag operation,
// timers don't fire on windows (bug 203573)
if (aRequest)
- setTimeout(function() { XULBrowserWindow.asyncUpdateUI(); }, 0);
+ setTimeout(function() {
+ XULBrowserWindow.asyncUpdateUI();
+}, 0);
else
this.asyncUpdateUI();
if (AppConstants.MOZ_CRASHREPORTER && aLocationURI) {
let uri = aLocationURI.clone();
try {
// If the current URI contains a username/password, remove it.
uri.userPass = "";
@@ -8039,17 +8049,19 @@ var ToolbarIconColor = {
}
},
observe(aSubject, aTopic, aData) {
switch (aTopic) {
case "lightweight-theme-styling-update":
// inferFromText needs to run after LightweightThemeConsumer.jsm's
// lightweight-theme-styling-update observer.
- setTimeout(() => { this.inferFromText(); }, 0);
+ setTimeout(() => {
+ this.inferFromText();
+}, 0);
break;
}
},
inferFromText() {
if (!this._initialized)
return;
--- a/browser/base/content/contentSearchUI.js
+++ b/browser/base/content/contentSearchUI.js
@@ -738,26 +738,32 @@ ContentSearchUIController.prototype = {
this._table.id = id;
this._table.hidden = true;
this._table.classList.add("contentSearchSuggestionTable");
this._table.setAttribute("role", "presentation");
// When the search input box loses focus, we want to immediately give focus
// back to it if the blur was because the user clicked somewhere in the table.
// onBlur uses the _mousedown flag to detect this.
- this._table.addEventListener("mousedown", () => { this._mousedown = true; });
- document.addEventListener("mouseup", () => { delete this._mousedown; });
+ this._table.addEventListener("mousedown", () => {
+ this._mousedown = true;
+});
+ document.addEventListener("mouseup", () => {
+ delete this._mousedown;
+});
// Deselect the selected element on mouseout if it wasn't a suggestion.
this._table.addEventListener("mouseout", this);
// If a search is loaded in the same tab, ensure the suggestions dropdown
// is hidden immediately when the page starts loading and not when it first
// appears, in order to provide timely feedback to the user.
- window.addEventListener("beforeunload", () => { this._hideSuggestions(); });
+ window.addEventListener("beforeunload", () => {
+ this._hideSuggestions();
+});
let headerRow = document.createElementNS(HTML_NS, "tr");
let header = document.createElementNS(HTML_NS, "td");
headerRow.setAttribute("class", "contentSearchHeaderRow");
header.setAttribute("class", "contentSearchHeader");
let iconImg = document.createElementNS(HTML_NS, "img");
header.appendChild(iconImg);
header.id = "contentSearchDefaultEngineHeader";
--- a/browser/base/content/pageinfo/pageInfo.js
+++ b/browser/base/content/pageinfo/pageInfo.js
@@ -15,18 +15,22 @@ function pageInfoTreeView(treeid, copyco
this.tree = null;
this.data = [ ];
this.selection = null;
this.sortcol = -1;
this.sortdir = false;
}
pageInfoTreeView.prototype = {
- set rowCount(c) { throw "rowCount is a readonly property"; },
- get rowCount() { return this.rows; },
+ set rowCount(c) {
+ throw "rowCount is a readonly property";
+},
+ get rowCount() {
+ return this.rows;
+},
setTree(tree) {
this.tree = tree;
},
getCellText(row, column) {
// row can be null, but js arrays are 0-indexed.
// colidx cannot be null, but can be larger than the number
@@ -87,53 +91,83 @@ pageInfoTreeView.prototype = {
var treecol = tree.columns.getNamedColumn(columnname);
this.sortdir =
gTreeUtils.sort(
tree,
this,
this.data,
treecol.index,
- function textComparator(a, b) { return (a || "").toLowerCase().localeCompare((b || "").toLowerCase()); },
+ function textComparator(a, b) {
+ return (a || "").toLowerCase().localeCompare((b || "").toLowerCase());
+},
this.sortcol,
this.sortdir
);
Array.forEach(tree.columns, function(col) {
col.element.removeAttribute("sortActive");
col.element.removeAttribute("sortDirection");
});
treecol.element.setAttribute("sortActive", "true");
treecol.element.setAttribute("sortDirection", this.sortdir ?
"ascending" : "descending");
this.sortcol = treecol.index;
},
- getRowProperties(row) { return ""; },
- getCellProperties(row, column) { return ""; },
- getColumnProperties(column) { return ""; },
- isContainer(index) { return false; },
- isContainerOpen(index) { return false; },
- isSeparator(index) { return false; },
- isSorted() { return this.sortcol > -1 },
- canDrop(index, orientation) { return false; },
- drop(row, orientation) { return false; },
- getParentIndex(index) { return 0; },
- hasNextSibling(index, after) { return false; },
- getLevel(index) { return 0; },
+ getRowProperties(row) {
+ return "";
+},
+ getCellProperties(row, column) {
+ return "";
+},
+ getColumnProperties(column) {
+ return "";
+},
+ isContainer(index) {
+ return false;
+},
+ isContainerOpen(index) {
+ return false;
+},
+ isSeparator(index) {
+ return false;
+},
+ isSorted() {
+ return this.sortcol > -1
+},
+ canDrop(index, orientation) {
+ return false;
+},
+ drop(row, orientation) {
+ return false;
+},
+ getParentIndex(index) {
+ return 0;
+},
+ hasNextSibling(index, after) {
+ return false;
+},
+ getLevel(index) {
+ return 0;
+},
getImageSrc(row, column) { },
getProgressMode(row, column) { },
getCellValue(row, column) { },
toggleOpenState(index) { },
cycleHeader(col) { },
selectionChanged() { },
cycleCell(row, column) { },
- isEditable(row, column) { return false; },
- isSelectable(row, column) { return false; },
+ isEditable(row, column) {
+ return false;
+},
+ isSelectable(row, column) {
+ return false;
+},
performAction(action) { },
performActionOnCell(action, row, column) { }
};
// mmm, yummy. global variables.
var gDocInfo = null;
var gImageElement = null;
@@ -184,19 +218,23 @@ gImageView.getCellText = function(row, c
gImageView.onPageMediaSort = function(columnname) {
var tree = document.getElementById(this.treeid);
var treecol = tree.columns.getNamedColumn(columnname);
var comparator;
var index = treecol.index;
if (index == COL_IMAGE_SIZE || index == COL_IMAGE_COUNT) {
- comparator = function numComparator(a, b) { return a - b; };
+ comparator = function numComparator(a, b) {
+ return a - b;
+};
} else {
- comparator = function textComparator(a, b) { return (a || "").toLowerCase().localeCompare((b || "").toLowerCase()); };
+ comparator = function textComparator(a, b) {
+ return (a || "").toLowerCase().localeCompare((b || "").toLowerCase());
+};
}
this.sortdir =
gTreeUtils.sort(
tree,
this,
this.data,
index,
@@ -380,29 +418,33 @@ function loadPageInfo(frameOuterWindowID
if (window.closed) {
mm.removeMessageListener("PageInfo:mediaData", onmessage);
return;
}
// The page info media fetching has been completed.
if (message.data.isComplete) {
mm.removeMessageListener("PageInfo:mediaData", onmessage);
- onFinished.forEach(function(func) { func(pageInfoData); });
+ onFinished.forEach(function(func) {
+ func(pageInfoData);
+});
return;
}
for (let item of message.data.mediaItems) {
addImage(item);
}
selectImage();
});
/* Call registered overlay init functions */
- onLoadRegistry.forEach(function(func) { func(); });
+ onLoadRegistry.forEach(function(func) {
+ func();
+});
}
function resetPageInfo(args) {
/* Reset Meta tags part */
gMetaView.clear();
/* Reset Media tab */
var mediaTab = document.getElementById("mediaTab");
@@ -416,32 +458,36 @@ function resetPageInfo(args) {
gImageHash = {};
/* Reset Feeds Tab */
var feedListbox = document.getElementById("feedListbox");
while (feedListbox.firstChild)
feedListbox.removeChild(feedListbox.firstChild);
/* Call registered overlay reset functions */
- onResetRegistry.forEach(function(func) { func(); });
+ onResetRegistry.forEach(function(func) {
+ func();
+});
/* Rebuild the data */
loadTab(args);
}
function onUnloadPageInfo() {
// Remove the observer, only if there is at least 1 image.
if (!document.getElementById("mediaTab").hidden) {
Components.classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService)
.removeObserver(imagePermissionObserver, "perm-changed");
}
/* Call registered overlay unload functions */
- onUnloadRegistry.forEach(function(func) { func(); });
+ onUnloadRegistry.forEach(function(func) {
+ func();
+});
}
function doHelpButton() {
const helpTopics = {
"generalPanel": "pageinfo_general",
"mediaPanel": "pageinfo_media",
"feedPanel": "pageinfo_feed",
"permPanel": "pageinfo_permissions",
--- a/browser/base/content/test/general/browser_beforeunload_duplicate_dialogs.js
+++ b/browser/base/content/test/general/browser_beforeunload_duplicate_dialogs.js
@@ -57,17 +57,19 @@ add_task(function* closeWindowWithMultip
add_task(function* closeWindoWithSingleTabTwice() {
let newWin = yield promiseOpenAndLoadWindow({}, true);
let firstTab = newWin.gBrowser.selectedTab;
yield promiseTabLoadEvent(firstTab, TEST_PAGE);
let windowClosedPromise = promiseWindowWillBeClosed(newWin);
expectingDialog = true;
wantToClose = false;
- let firstDialogShownPromise = new Promise((resolve, reject) => { resolveDialogPromise = resolve; });
+ let firstDialogShownPromise = new Promise((resolve, reject) => {
+ resolveDialogPromise = resolve;
+});
document.getAnonymousElementByAttribute(firstTab, "anonid", "close-button").click();
yield firstDialogShownPromise;
info("Got initial dialog, now trying again");
expectingDialog = true;
wantToClose = true;
resolveDialogPromise = null;
document.getAnonymousElementByAttribute(firstTab, "anonid", "close-button").click();
yield windowClosedPromise;
--- a/browser/base/content/test/general/browser_bug321000.js
+++ b/browser/base/content/test/general/browser_bug321000.js
@@ -27,17 +27,19 @@ function test() {
waitForExplicitFinish();
let cbHelper = Cc["@mozilla.org/widget/clipboardhelper;1"].
getService(Ci.nsIClipboardHelper);
// Put a multi-line string in the clipboard.
// Setting the clipboard value is an async OS operation, so we need to poll
// the clipboard for valid data before going on.
- waitForClipboard(kTestString, function() { cbHelper.copyString(kTestString); },
+ waitForClipboard(kTestString, function() {
+ cbHelper.copyString(kTestString);
+},
next_test, finish);
}
function next_test() {
if (gTests.length)
test_paste(gTests.shift());
else
finish();
--- a/browser/base/content/test/general/browser_bug408415.js
+++ b/browser/base/content/test/general/browser_bug408415.js
@@ -18,17 +18,19 @@ add_task(function* test() {
gBrowser.addTabsProgressListener(listener);
BrowserTestUtils.loadURI(tabBrowser, URI);
let iconURI = yield got_favicon.promise;
is(iconURI, expectedIcon, "Correct icon before pushState.");
got_favicon = Promise.defer();
- got_favicon.promise.then(() => { ok(false, "shouldn't be called"); }, (e) => e);
+ got_favicon.promise.then(() => {
+ ok(false, "shouldn't be called");
+}, (e) => e);
yield ContentTask.spawn(tabBrowser, null, function() {
content.location.href += "#foo";
});
// We've navigated and shouldn't get a call to onLinkIconAvailable.
TestUtils.executeSoon(() => {
got_favicon.reject(gBrowser.getIcon(gBrowser.getTabForBrowser(tabBrowser)));
});
--- a/browser/base/content/test/general/browser_bug550565.js
+++ b/browser/base/content/test/general/browser_bug550565.js
@@ -18,17 +18,19 @@ add_task(function* test() {
gBrowser.addTabsProgressListener(listener);
BrowserTestUtils.loadURI(tabBrowser, URI);
let iconURI = yield got_favicon.promise;
is(iconURI, expectedIcon, "Correct icon before pushState.");
got_favicon = Promise.defer();
- got_favicon.promise.then(() => { ok(false, "shouldn't be called"); }, (e) => e);
+ got_favicon.promise.then(() => {
+ ok(false, "shouldn't be called");
+}, (e) => e);
yield ContentTask.spawn(tabBrowser, null, function() {
content.history.pushState("page2", "page2", "page2");
});
// We've navigated and shouldn't get a call to onLinkIconAvailable.
TestUtils.executeSoon(() => {
got_favicon.reject(gBrowser.getIcon(gBrowser.getTabForBrowser(tabBrowser)));
});
--- a/browser/base/content/test/general/browser_bug678392.js
+++ b/browser/base/content/test/general/browser_bug678392.js
@@ -8,17 +8,19 @@ function maxSnapshotOverride() {
return 5;
}
function test() {
waitForExplicitFinish();
BrowserOpenTab();
let tab = gBrowser.selectedTab;
- registerCleanupFunction(function() { gBrowser.removeTab(tab); });
+ registerCleanupFunction(function() {
+ gBrowser.removeTab(tab);
+});
ok(gHistorySwipeAnimation, "gHistorySwipeAnimation exists.");
if (!gHistorySwipeAnimation._isSupported()) {
is(gHistorySwipeAnimation.active, false, "History swipe animation is not " +
"active when not supported by the platform.");
finish();
return;
--- a/browser/base/content/test/general/browser_csp_block_all_mixedcontent.js
+++ b/browser/base/content/test/general/browser_csp_block_all_mixedcontent.js
@@ -45,11 +45,13 @@ function runTests() {
// ------------------------------------------------------
function test() {
// Performing async calls, e.g. 'onload', we have to wait till all of them finished
waitForExplicitFinish();
SpecialPowers.pushPrefEnv(
{ 'set': [["security.mixed_content.block_active_content", true]] },
- function() { runTests(); }
+ function() {
+ runTests();
+}
);
}
--- a/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
+++ b/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
@@ -24,16 +24,18 @@ add_task(function* checkBackFromInvalidU
ok(gBrowser.webNavigation.canGoBack, "Should be able to go back");
if (gBrowser.webNavigation.canGoBack) {
// Can't use DOMContentLoaded here because the page is bfcached. Can't use pageshow for
// the error page because it doesn't seem to fire for those.
let promiseOtherPageLoaded = BrowserTestUtils.waitForEvent(tab.linkedBrowser, "pageshow", false,
// Be paranoid we *are* actually seeing this other page load, not some kind of race
// for if/when we do start firing pageshow for the error page...
- function(e) { return gBrowser.currentURI.spec == "about:robots" }
+ function(e) {
+ return gBrowser.currentURI.spec == "about:robots"
+}
);
gBrowser.goBack();
yield promiseOtherPageLoaded;
ok(gBrowser.webNavigation.canGoForward, "Should be able to go forward from previous page.");
}
yield BrowserTestUtils.removeTab(tab);
});
--- a/browser/base/content/test/general/browser_minimize.js
+++ b/browser/base/content/test/general/browser_minimize.js
@@ -1,17 +1,21 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
add_task(function *() {
registerCleanupFunction(function() {
window.restore();
});
- function waitForActive() { return gBrowser.selectedTab.linkedBrowser.docShellIsActive; }
- function waitForInactive() { return !gBrowser.selectedTab.linkedBrowser.docShellIsActive; }
+ function waitForActive() {
+ return gBrowser.selectedTab.linkedBrowser.docShellIsActive;
+}
+ function waitForInactive() {
+ return !gBrowser.selectedTab.linkedBrowser.docShellIsActive;
+}
yield promiseWaitForCondition(waitForActive);
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active");
window.minimize();
yield promiseWaitForCondition(waitForInactive);
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, false, "Docshell should be Inactive");
window.restore();
yield promiseWaitForCondition(waitForActive);
is(gBrowser.selectedTab.linkedBrowser.docShellIsActive, true, "Docshell should be active again");
--- a/browser/base/content/test/general/browser_newTabDrop.js
+++ b/browser/base/content/test/general/browser_newTabDrop.js
@@ -13,27 +13,45 @@ add_task(function* test_setup() {
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
});
// New Tab Button opens any link.
-add_task(function*() { yield dropText("mochi.test/first", 1); });
-add_task(function*() { yield dropText("javascript:'bad'", 1); });
-add_task(function*() { yield dropText("jAvascript:'bad'", 1); });
-add_task(function*() { yield dropText("mochi.test/second", 1); });
-add_task(function*() { yield dropText("data:text/html,bad", 1); });
-add_task(function*() { yield dropText("mochi.test/third", 1); });
+add_task(function*() {
+ yield dropText("mochi.test/first", 1);
+});
+add_task(function*() {
+ yield dropText("javascript:'bad'", 1);
+});
+add_task(function*() {
+ yield dropText("jAvascript:'bad'", 1);
+});
+add_task(function*() {
+ yield dropText("mochi.test/second", 1);
+});
+add_task(function*() {
+ yield dropText("data:text/html,bad", 1);
+});
+add_task(function*() {
+ yield dropText("mochi.test/third", 1);
+});
// Single text/plain item, with multiple links.
-add_task(function*() { yield dropText("mochi.test/1\nmochi.test/2", 2); });
-add_task(function*() { yield dropText("javascript:'bad1'\nmochi.test/3", 2); });
-add_task(function*() { yield dropText("mochi.test/4\ndata:text/html,bad1", 2); });
+add_task(function*() {
+ yield dropText("mochi.test/1\nmochi.test/2", 2);
+});
+add_task(function*() {
+ yield dropText("javascript:'bad1'\nmochi.test/3", 2);
+});
+add_task(function*() {
+ yield dropText("mochi.test/4\ndata:text/html,bad1", 2);
+});
// Multiple text/plain items, with single and multiple links.
add_task(function*() {
yield drop([[{type: "text/plain",
data: "mochi.test/5"}],
[{type: "text/plain",
data: "mochi.test/6\nmochi.test/7"}]], 3);
});
--- a/browser/base/content/test/general/browser_newWindowDrop.js
+++ b/browser/base/content/test/general/browser_newWindowDrop.js
@@ -26,27 +26,45 @@ add_task(function* test_setup() {
CustomizableUI.ensureWidgetPlacedInWindow("new-window-button", window);
registerCleanupFunction(function() {
CustomizableUI.removeWidgetFromArea("new-window-button");
});
}
});
// New Window Button opens any link.
-add_task(function*() { yield dropText("mochi.test/first", 1); });
-add_task(function*() { yield dropText("javascript:'bad'", 1); });
-add_task(function*() { yield dropText("jAvascript:'bad'", 1); });
-add_task(function*() { yield dropText("mochi.test/second", 1); });
-add_task(function*() { yield dropText("data:text/html,bad", 1); });
-add_task(function*() { yield dropText("mochi.test/third", 1); });
+add_task(function*() {
+ yield dropText("mochi.test/first", 1);
+});
+add_task(function*() {
+ yield dropText("javascript:'bad'", 1);
+});
+add_task(function*() {
+ yield dropText("jAvascript:'bad'", 1);
+});
+add_task(function*() {
+ yield dropText("mochi.test/second", 1);
+});
+add_task(function*() {
+ yield dropText("data:text/html,bad", 1);
+});
+add_task(function*() {
+ yield dropText("mochi.test/third", 1);
+});
// Single text/plain item, with multiple links.
-add_task(function*() { yield dropText("mochi.test/1\nmochi.test/2", 2); });
-add_task(function*() { yield dropText("javascript:'bad1'\nmochi.test/3", 2); });
-add_task(function*() { yield dropText("mochi.test/4\ndata:text/html,bad1", 2); });
+add_task(function*() {
+ yield dropText("mochi.test/1\nmochi.test/2", 2);
+});
+add_task(function*() {
+ yield dropText("javascript:'bad1'\nmochi.test/3", 2);
+});
+add_task(function*() {
+ yield dropText("mochi.test/4\ndata:text/html,bad1", 2);
+});
// Multiple text/plain items, with single and multiple links.
add_task(function*() {
yield drop([[{type: "text/plain",
data: "mochi.test/5"}],
[{type: "text/plain",
data: "mochi.test/6\nmochi.test/7"}]], 3);
});
--- a/browser/base/content/test/general/browser_printpreview.js
+++ b/browser/base/content/test/general/browser_printpreview.js
@@ -57,17 +57,19 @@ function openPrintPreview(aCallback) {
executeSoon(arguments.callee);
});
}
function checkPrintPreviewClosed(aCallback) {
let count = 0;
executeSoon(function() {
if (!gInPrintPreviewMode) {
- executeSoon(function() { aCallback(count < 1000); });
+ executeSoon(function() {
+ aCallback(count < 1000);
+});
return;
}
if (++count == 1000) {
// The test might fail.
PrintUtils.exitPrintPreview();
}
executeSoon(arguments.callee);
});
--- a/browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
+++ b/browser/base/content/test/general/browser_remoteWebNavigation_postdata.js
@@ -40,11 +40,13 @@ add_task(function* test_remoteWebNavigat
"success";
openUILinkIn(path, "tab", null, makeInputStream(postdata));
yield loadDeferred.promise;
yield BrowserTestUtils.removeTab(gBrowser.selectedTab);
let serverStoppedDeferred = Promise.defer();
- server.stop(function() { serverStoppedDeferred.resolve(); });
+ server.stop(function() {
+ serverStoppedDeferred.resolve();
+});
yield serverStoppedDeferred.promise;
});
--- a/browser/base/content/test/general/browser_sanitize-timespans.js
+++ b/browser/base/content/test/general/browser_sanitize-timespans.js
@@ -122,18 +122,22 @@ function* onHistoryReady() {
"Pretend visit to 4hour10minutes.com should should still exist");
if (minutesSinceMidnight > 10) {
ok((yield promiseIsURIVisited(makeURI("http://today.com"))),
"Pretend visit to today.com should still exist");
}
ok((yield promiseIsURIVisited(makeURI("http://before-today.com"))),
"Pretend visit to before-today.com should still exist");
- let checkZero = function(num, message) { is(num, 0, message); }
- let checkOne = function(num, message) { is(num, 1, message); }
+ let checkZero = function(num, message) {
+ is(num, 0, message);
+}
+ let checkOne = function(num, message) {
+ is(num, 1, message);
+}
yield countEntries("10minutes", "10minutes form entry should be deleted", checkZero);
yield countEntries("1hour", "1hour form entry should still exist", checkOne);
yield countEntries("1hour10minutes", "1hour10minutes form entry should still exist", checkOne);
yield countEntries("2hour", "2hour form entry should still exist", checkOne);
yield countEntries("2hour10minutes", "2hour10minutes form entry should still exist", checkOne);
yield countEntries("4hour", "4hour form entry should still exist", checkOne);
yield countEntries("4hour10minutes", "4hour10minutes form entry should still exist", checkOne);
@@ -492,28 +496,32 @@ function* setupFormHistory() {
let deferred = Promise.defer();
let results = [];
FormHistory.search(terms, params, { handleResult: result => results.push(result),
handleError(error) {
deferred.reject(error);
throw new Error("Error occurred searching form history: " + error);
},
- handleCompletion(reason) { deferred.resolve(results); }
+ handleCompletion(reason) {
+ deferred.resolve(results);
+}
});
return deferred.promise;
}
function update(changes) {
let deferred = Promise.defer();
FormHistory.update(changes, { handleError(error) {
deferred.reject(error);
throw new Error("Error occurred searching form history: " + error);
},
- handleCompletion(reason) { deferred.resolve(); }
+ handleCompletion(reason) {
+ deferred.resolve();
+}
});
return deferred.promise;
}
// Make sure we've got a clean DB to start with, then add the entries we'll be testing.
yield update(
[{
op: "remove"
@@ -595,17 +603,19 @@ function* setupFormHistory() {
let lastYear = new Date();
lastYear.setFullYear(lastYear.getFullYear() - 1);
timestamp = lastYear.getTime() * 1000;
results = yield searchEntries(["guid"], { fieldname: "b4today" });
yield update({ op: "update", firstUsed: timestamp, guid: results[0].guid });
var checks = 0;
- let checkOne = function(num, message) { is(num, 1, message); checks++; }
+ let checkOne = function(num, message) {
+ is(num, 1, message); checks++;
+}
// Sanity check.
yield countEntries("10minutes", "Checking for 10minutes form history entry creation", checkOne);
yield countEntries("1hour", "Checking for 1hour form history entry creation", checkOne);
yield countEntries("1hour10minutes", "Checking for 1hour10minutes form history entry creation", checkOne);
yield countEntries("2hour", "Checking for 2hour form history entry creation", checkOne);
yield countEntries("2hour10minutes", "Checking for 2hour10minutes form history entry creation", checkOne);
yield countEntries("4hour", "Checking for 4hour form history entry creation", checkOne);
--- a/browser/base/content/test/general/browser_sanitizeDialog.js
+++ b/browser/base/content/test/general/browser_sanitizeDialog.js
@@ -577,17 +577,19 @@ add_task(function* test_offline_cache()
}
};
storage.asyncVisitStorage(visitor, false);
// Offline cache visit happens synchronously, since it's forwarded to the old code
is(size, 0, "offline application cache entries evicted");
};
var cacheListener = {
- onCacheEntryCheck() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
+ onCacheEntryCheck() {
+ return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
+},
onCacheEntryAvailable(entry, isnew, unused, status) {
is(status, Cr.NS_OK);
var stream = entry.openOutputStream(0);
var content = "content";
stream.write(content, content.length);
stream.close();
entry.close();
wh.open();
@@ -635,17 +637,19 @@ var now_uSec = now_mSec * 1000;
* This wraps the dialog and provides some convenience methods for interacting
* with it.
*
* @param aWin
* The dialog's nsIDOMWindow
*/
function WindowHelper(aWin) {
this.win = aWin;
- this.promiseClosed = new Promise(resolve => { this._resolveClosed = resolve });
+ this.promiseClosed = new Promise(resolve => {
+ this._resolveClosed = resolve
+});
}
WindowHelper.prototype = {
/**
* "Presses" the dialog's OK button.
*/
acceptDialog() {
is(this.win.document.documentElement.getButton("accept").disabled, false,
--- a/browser/base/content/test/general/browser_tabDrop.js
+++ b/browser/base/content/test/general/browser_tabDrop.js
@@ -12,28 +12,48 @@ add_task(function* test_setup() {
// Stop search-engine loads from hitting the network
Services.search.addEngineWithDetails("MozSearch", "", "", "", "GET",
"http://example.com/?q={searchTerms}");
let engine = Services.search.getEngineByName("MozSearch");
originalEngine = Services.search.currentEngine;
Services.search.currentEngine = engine;
});
-add_task(function*() { yield dropText("mochi.test/first", 1); });
-add_task(function*() { yield dropText("javascript:'bad'"); });
-add_task(function*() { yield dropText("jAvascript:'bad'"); });
-add_task(function*() { yield dropText("search this", 1); });
-add_task(function*() { yield dropText("mochi.test/second", 1); });
-add_task(function*() { yield dropText("data:text/html,bad"); });
-add_task(function*() { yield dropText("mochi.test/third", 1); });
+add_task(function*() {
+ yield dropText("mochi.test/first", 1);
+});
+add_task(function*() {
+ yield dropText("javascript:'bad'");
+});
+add_task(function*() {
+ yield dropText("jAvascript:'bad'");
+});
+add_task(function*() {
+ yield dropText("search this", 1);
+});
+add_task(function*() {
+ yield dropText("mochi.test/second", 1);
+});
+add_task(function*() {
+ yield dropText("data:text/html,bad");
+});
+add_task(function*() {
+ yield dropText("mochi.test/third", 1);
+});
// Single text/plain item, with multiple links.
-add_task(function*() { yield dropText("mochi.test/1\nmochi.test/2", 2); });
-add_task(function*() { yield dropText("javascript:'bad1'\nmochi.test/3", 0); });
-add_task(function*() { yield dropText("mochi.test/4\ndata:text/html,bad1", 0); });
+add_task(function*() {
+ yield dropText("mochi.test/1\nmochi.test/2", 2);
+});
+add_task(function*() {
+ yield dropText("javascript:'bad1'\nmochi.test/3", 0);
+});
+add_task(function*() {
+ yield dropText("mochi.test/4\ndata:text/html,bad1", 0);
+});
// Multiple text/plain items, with single and multiple links.
add_task(function*() {
yield drop([[{type: "text/plain",
data: "mochi.test/5"}],
[{type: "text/plain",
data: "mochi.test/6\nmochi.test/7"}]], 3);
});
--- a/browser/base/content/test/general/browser_tabfocus.js
+++ b/browser/base/content/test/general/browser_tabfocus.js
@@ -461,17 +461,19 @@ function compareFocusResults() {
currentPromiseResolver();
currentPromiseResolver = null;
});
}
function* expectFocusShiftAfterTabSwitch(tab, expectedWindow, expectedElement, focusChanged, testid) {
let tabSwitchPromise = null;
- yield expectFocusShift(() => { tabSwitchPromise = BrowserTestUtils.switchTab(gBrowser, tab) },
+ yield expectFocusShift(() => {
+ tabSwitchPromise = BrowserTestUtils.switchTab(gBrowser, tab)
+},
expectedWindow, expectedElement, focusChanged, testid)
yield tabSwitchPromise;
}
function* expectFocusShift(callback, expectedWindow, expectedElement, focusChanged, testid) {
currentPromiseResolver = null;
currentTestName = testid;
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -118,17 +118,19 @@ function waitForCondition(condition, nex
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;
}, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
+ var moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
function promiseWaitForCondition(aConditionFn) {
let deferred = Promise.defer();
waitForCondition(aConditionFn, deferred.resolve, "Condition didn't pass.");
return deferred.promise;
}
@@ -1065,17 +1067,19 @@ function getCertExceptionDialog(aLocatio
return undefined;
}
function setupRemoteClientsFixture(fixture) {
let oldRemoteClientsGetter =
Object.getOwnPropertyDescriptor(gFxAccounts, "remoteClients").get;
Object.defineProperty(gFxAccounts, "remoteClients", {
- get() { return fixture; }
+ get() {
+ return fixture;
+}
});
return oldRemoteClientsGetter;
}
function restoreRemoteClients(getter) {
Object.defineProperty(gFxAccounts, "remoteClients", {
get: getter
});
--- a/browser/base/content/test/newtab/browser_newtab_bug722273.js
+++ b/browser/base/content/test/newtab/browser_newtab_bug722273.js
@@ -11,24 +11,28 @@ Cc["@mozilla.org/moz/jssubscript-loader;
var {Sanitizer} = tmp;
add_task(function* () {
yield promiseSanitizeHistory();
yield promiseAddFakeVisits();
yield* addNewTabPageTab();
- let cellUrl = yield performOnCell(0, cell => { return cell.site.url; });
+ let cellUrl = yield performOnCell(0, cell => {
+ return cell.site.url;
+});
is(cellUrl, URL, "first site is our fake site");
let updatedPromise = whenPagesUpdated();
yield promiseSanitizeHistory();
yield updatedPromise;
- let isGone = yield performOnCell(0, cell => { return cell.site == null; });
+ let isGone = yield performOnCell(0, cell => {
+ return cell.site == null;
+});
ok(isGone, "fake site is gone");
});
function promiseAddFakeVisits() {
let visits = [];
for (let i = 59; i > 0; i--) {
visits.push({
visitDate: NOW - i * 60 * 1000000,
--- a/browser/base/content/test/newtab/browser_newtab_update.js
+++ b/browser/base/content/test/newtab/browser_newtab_update.js
@@ -28,17 +28,19 @@ add_task(function* () {
yield* addNewTabPageTab();
yield* checkGrid("1,2,,,,,,,");
yield fillHistoryAndWaitForPageUpdate([2, 3, 4]);
yield* addNewTabPageTab();
yield* checkGrid("2,1,3,4,,,,,");
// Make sure these added links have the right type
- let type = yield performOnCell(1, cell => { return cell.site.link.type });
+ let type = yield performOnCell(1, cell => {
+ return cell.site.link.type
+});
is(type, "history", "added link is history");
});
function fillHistoryAndWaitForPageUpdate(links) {
let updatedPromise = whenPagesUpdated;
let fillHistoryPromise = fillHistory(links.map(link));
return Promise.all([updatedPromise, fillHistoryPromise]);
}
--- a/browser/base/content/test/plugins/browser_bug744745.js
+++ b/browser/base/content/test/plugins/browser_bug744745.js
@@ -30,17 +30,19 @@ add_task(function* () {
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
gTestBrowser.addEventListener("PluginBindingAttached", pluginBindingAttached, true, true);
let testRoot = getRootDirectory(gTestPath).replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
yield promiseTabLoadEvent(gBrowser.selectedTab, testRoot + "plugin_bug744745.html");
- yield promiseForCondition(function() { return gNumPluginBindingsAttached == 1; });
+ yield promiseForCondition(function() {
+ return gNumPluginBindingsAttached == 1;
+});
yield ContentTask.spawn(gTestBrowser, {}, function* () {
let plugin = content.document.getElementById("test");
if (!plugin) {
Assert.ok(false, "plugin element not available.");
return;
}
// We can't use MochiKit's routine
--- a/browser/base/content/test/plugins/browser_bug820497.js
+++ b/browser/base/content/test/plugins/browser_bug820497.js
@@ -18,21 +18,25 @@ add_task(function* () {
Services.prefs.setBoolPref("plugins.click_to_play", true);
gBrowser.selectedTab = gBrowser.addTab();
gTestBrowser = gBrowser.selectedBrowser;
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Test Plug-in");
setTestPluginEnabledState(Ci.nsIPluginTag.STATE_CLICKTOPLAY, "Second Test Plug-in");
- gTestBrowser.addEventListener("PluginBindingAttached", function() { gNumPluginBindingsAttached++ }, true, true);
+ gTestBrowser.addEventListener("PluginBindingAttached", function() {
+ gNumPluginBindingsAttached++
+}, true, true);
yield promiseTabLoadEvent(gBrowser.selectedTab, gTestRoot + "plugin_bug820497.html");
- yield promiseForCondition(function() { return gNumPluginBindingsAttached == 1; });
+ yield promiseForCondition(function() {
+ return gNumPluginBindingsAttached == 1;
+});
yield ContentTask.spawn(gTestBrowser, null, () => {
// Note we add the second plugin in the code farther down, so there's
// no way we got here with anything but one plugin loaded.
let doc = content.document;
let testplugin = doc.getElementById("test");
ok(testplugin, "should have test plugin");
let secondtestplugin = doc.getElementById("secondtest");
@@ -46,17 +50,19 @@ add_task(function* () {
yield promiseForNotificationShown(notification);
is(notification.options.pluginData.size, 1, "should be 1 type of plugin in the popup notification");
yield ContentTask.spawn(gTestBrowser, {}, function* () {
XPCNativeWrapper.unwrap(content).addSecondPlugin();
});
- yield promiseForCondition(function() { return gNumPluginBindingsAttached == 2; });
+ yield promiseForCondition(function() {
+ return gNumPluginBindingsAttached == 2;
+});
yield ContentTask.spawn(gTestBrowser, null, () => {
let doc = content.document;
let testplugin = doc.getElementById("test");
ok(testplugin, "should have test plugin");
let secondtestplugin = doc.getElementById("secondtest");
ok(secondtestplugin, "should have second test plugin");
});
--- a/browser/base/content/test/plugins/head.js
+++ b/browser/base/content/test/plugins/head.js
@@ -117,17 +117,19 @@ function waitForCondition(condition, nex
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;
}, maxWait);
- let moveOn = function() { clearInterval(interval); nextTest(); };
+ let moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
// Waits for a conditional function defined by the caller to return true.
function promiseForCondition(aConditionFn, aMessage, aTries, aWait) {
return new Promise((resolve) => {
waitForCondition(aConditionFn, resolve,
(aMessage || "Condition didn't pass."),
aTries, aWait);
--- a/browser/base/content/test/social/browser_share.js
+++ b/browser/base/content/test/social/browser_share.js
@@ -122,17 +122,19 @@ function hasoptions(testOptions, options
let data = testOptions[option];
info("data: " + JSON.stringify(data));
let message_data = options[option];
info("message_data: " + JSON.stringify(message_data));
if (Array.isArray(data)) {
// the message may have more array elements than we are testing for, this
// is ok since some of those are hard to test. So we just test that
// anything in our test data IS in the message.
- ok(Array.every(data, function(item) { return message_data.indexOf(item) >= 0 }), "option " + option);
+ ok(Array.every(data, function(item) {
+ return message_data.indexOf(item) >= 0
+}), "option " + option);
} else {
is(message_data, data, "option " + option);
}
}
}
var tests = {
testShareDisabledOnActivation(next) {
@@ -190,17 +192,19 @@ var tests = {
// ensure correct state
SocialUI.onCustomizeEnd(window);
let mm = getGroupMessageManager("social");
mm.addMessageListener("sharedata", function handler(msg) {
BrowserTestUtils.removeTab(testTab).then(() => {
hasoptions(testData.options, JSON.parse(msg.data));
testData = corpus[testIndex++];
- BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; }, "share panel closed").then(() => {
+ BrowserTestUtils.waitForCondition(() => {
+ return SocialShare.currentShare == null;
+}, "share panel closed").then(() => {
if (testData) {
runOneTest();
} else {
mm.removeMessageListener("sharedata", handler);
SocialService.disableProvider(manifest.origin, next);
}
});
SocialShare.iframe.messageManager.sendAsyncMessage("closeself", {});
@@ -274,17 +278,19 @@ var tests = {
}
}
}
});
let mm = getGroupMessageManager("social");
mm.addMessageListener("sharedata", function handler(msg) {
is(msg.data, expecting, "microformats data ok");
- BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },
+ BrowserTestUtils.waitForCondition(() => {
+ return SocialShare.currentShare == null;
+},
"share panel closed").then(() => {
mm.removeMessageListener("sharedata", handler);
BrowserTestUtils.removeTab(testTab).then(() => {
SocialService.disableProvider(manifest.origin, next);
});
});
SocialShare.iframe.messageManager.sendAsyncMessage("closeself", {});
});
@@ -323,17 +329,19 @@ var tests = {
let subframe = iframe.contentDocument.getElementById("activation-frame");
ensureFrameLoaded(subframe, activationPage).then(() => {
is(subframe.contentDocument.location.href, activationPage, "activation page loaded");
promiseObserverNotified("social:provider-enabled").then(() => {
let mm = getGroupMessageManager("social");
mm.addMessageListener("sharedata", function handler(msg) {
ok(true, "share completed");
- BrowserTestUtils.waitForCondition(() => { return SocialShare.currentShare == null; },
+ BrowserTestUtils.waitForCondition(() => {
+ return SocialShare.currentShare == null;
+},
"share panel closed").then(() => {
BrowserTestUtils.removeTab(testTab).then(() => {
mm.removeMessageListener("sharedata", handler);
SocialService.uninstallProvider(manifest.origin, next);
});
});
SocialShare.iframe.messageManager.sendAsyncMessage("closeself", {});
});
--- a/browser/base/content/test/social/browser_social_activation.js
+++ b/browser/base/content/test/social/browser_social_activation.js
@@ -98,17 +98,19 @@ function clickAddonRemoveButton(tab, aCa
let button = item._removeBtn;
isnot(button, null, "Should have a remove button");
ok(!button.disabled, "Button should not be disabled");
// uninstall happens after about:addons tab is closed, so we wait on
// disabled
promiseObserverNotified("social:provider-disabled").then(() => {
is(item.getAttribute("pending"), "uninstall", "Add-on should be uninstalling");
- executeSoon(function() { aCallback(addon); });
+ executeSoon(function() {
+ aCallback(addon);
+});
});
BrowserTestUtils.synthesizeMouseAtCenter(button, {}, tab.linkedBrowser);
});
}
function activateOneProvider(manifest, finishActivation, aCallback) {
Task.spawn(function* () {
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -147,20 +147,24 @@ function runSocialTests(tests, cbPreTest
}
})();
let providersAtStart = Social.providers.length;
info("runSocialTests: start test run with " + providersAtStart + " providers");
window.focus();
if (cbPreTest === undefined) {
- cbPreTest = function(cb) { cb() };
+ cbPreTest = function(cb) {
+ cb()
+};
}
if (cbPostTest === undefined) {
- cbPostTest = function(cb) { cb() };
+ cbPostTest = function(cb) {
+ cb()
+};
}
function runNextTest() {
let result = testIter.next();
if (result.done) {
// out of items:
(cbFinish || defaultFinishChecks)();
is(providersAtStart, Social.providers.length,
--- a/browser/base/content/test/tabcrashed/browser_withoutDump.js
+++ b/browser/base/content/test/tabcrashed/browser_withoutDump.js
@@ -3,17 +3,19 @@
const PAGE = "data:text/html,<html><body>A%20regular,%20everyday,%20normal%20page.";
/**
* Monkey patches TabCrashHandler.getDumpID to return null in order to test
* about:tabcrashed when a dump is not available.
*/
add_task(function* setup() {
let originalGetDumpID = TabCrashHandler.getDumpID;
- TabCrashHandler.getDumpID = function(browser) { return null; };
+ TabCrashHandler.getDumpID = function(browser) {
+ return null;
+};
registerCleanupFunction(() => {
TabCrashHandler.getDumpID = originalGetDumpID;
});
});
/**
* Tests tab crash page when a dump is not available.
*/
--- a/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
+++ b/browser/base/content/test/urlbar/browser_tabMatchesInAwesomebar.js
@@ -168,17 +168,19 @@ function checkAutocompleteResults(aExpec
textValue: "",
searches: ["unifiedcomplete"],
searchParam: "enable-actions",
popupOpen: false,
minResultsForPopup: 0,
invalidate() {},
disableAutoComplete: false,
completeDefaultIndex: false,
- get popup() { return this; },
+ get popup() {
+ return this;
+},
onSearchBegin() {},
onSearchComplete() {
info("Found " + gController.matchCount + " matches.");
// Check to see the expected uris and titles match up (in any order)
for (let i = 0; i < gController.matchCount; i++) {
if (gController.getStyleAt(i).includes("heuristic")) {
info("Skip heuristic match");
continue;
@@ -196,18 +198,22 @@ function checkAutocompleteResults(aExpec
// Make sure there is no reported open page that is not open.
for (let entry in aExpected) {
ok(false, "'" + entry + "' should be found in autocomplete");
}
executeSoon(aCallback);
},
setSelectedIndex() {},
- get searchCount() { return this.searches.length; },
- getSearchAt(aIndex) { return this.searches[aIndex]; },
+ get searchCount() {
+ return this.searches.length;
+},
+ getSearchAt(aIndex) {
+ return this.searches[aIndex];
+},
QueryInterface: XPCOMUtils.generateQI([
Ci.nsIAutoCompleteInput,
Ci.nsIAutoCompletePopup,
])
};
info("Searching open pages.");
gController.startSearch(Services.prefs.getCharPref("browser.urlbar.restrict.openpage"));
--- a/browser/base/content/test/urlbar/browser_urlbarCopying.js
+++ b/browser/base/content/test/urlbar/browser_urlbarCopying.js
@@ -148,17 +148,19 @@ var tests = [
copyVal: "<data:text/html,(>%C3%A9 %25P)",
copyExpected: "data:text/html,("
},
{
copyVal: "<data:text/html,(%C3%A9 %25P>)",
copyExpected: "data:text/html,(%C3%A9 %25P",
},
{
- setup() { Services.prefs.setBoolPref(decodeURLpref, true); },
+ setup() {
+ Services.prefs.setBoolPref(decodeURLpref, true);
+},
loadURL: "http://example.com/%D0%B1%D0%B8%D0%BE%D0%B3%D1%80%D0%B0%D1%84%D0%B8%D1%8F",
expectedURL: toUnicode("example.com/биография"),
copyExpected: toUnicode("http://example.com/биография")
},
{
copyVal: toUnicode("<example.com/би>ография"),
copyExpected: toUnicode("http://example.com/би")
},
--- a/browser/base/content/test/webrtc/head.js
+++ b/browser/base/content/test/webrtc/head.js
@@ -21,17 +21,19 @@ function waitForCondition(condition, nex
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;
}, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
+ var moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
function promiseWaitForCondition(aConditionFn) {
let deferred = Promise.defer();
waitForCondition(aConditionFn, deferred.resolve, "Condition didn't pass.");
return deferred.promise;
}
--- a/browser/base/content/utilityOverlay.js
+++ b/browser/base/content/utilityOverlay.js
@@ -675,17 +675,19 @@ function openPreferences(paneID, extraAr
if (extraArgs && extraArgs["advancedTab"]) {
let advancedPaneTabs = doc.getElementById("advancedPrefs");
advancedPaneTabs.selectedTab = doc.getElementById(extraArgs["advancedTab"]);
}
}
// This function is duplicated from preferences.js.
function internalPrefCategoryNameToFriendlyName(aName) {
- return (aName || "").replace(/^pane./, function(toReplace) { return toReplace[4].toLowerCase(); });
+ return (aName || "").replace(/^pane./, function(toReplace) {
+ return toReplace[4].toLowerCase();
+});
}
let win = Services.wm.getMostRecentWindow("navigator:browser");
let friendlyCategoryName = internalPrefCategoryNameToFriendlyName(paneID);
let params;
if (extraArgs && extraArgs["urlParams"]) {
params = new URLSearchParams();
let urlParams = extraArgs["urlParams"];
--- a/browser/components/contextualidentity/test/browser/browser_blobUrl.js
+++ b/browser/components/contextualidentity/test/browser/browser_blobUrl.js
@@ -19,32 +19,38 @@ add_task(function* test() {
let browser1 = gBrowser.getBrowserForTab(tab1);
yield BrowserTestUtils.browserLoaded(browser1);
let blobURL;
info("Creating a blob URL...");
yield ContentTask.spawn(browser1, null, function() {
return Promise.resolve(content.window.URL.createObjectURL(new content.window.Blob([123])));
- }).then(newURL => { blobURL = newURL });
+ }).then(newURL => {
+ blobURL = newURL
+});
info("Blob URL: " + blobURL);
info("Creating a tab with UCI = 2...");
let tab2 = gBrowser.addTab(BASE_URI, {userContextId: 2});
is(tab2.getAttribute('usercontextid'), 2, "New tab has UCI equal 2");
let browser2 = gBrowser.getBrowserForTab(tab2);
yield BrowserTestUtils.browserLoaded(browser2);
yield ContentTask.spawn(browser2, blobURL, function(url) {
return new Promise(resolve => {
var xhr = new content.window.XMLHttpRequest();
- xhr.onerror = function() { resolve("SendErrored"); }
- xhr.onload = function() { resolve("SendLoaded"); }
+ xhr.onerror = function() {
+ resolve("SendErrored");
+}
+ xhr.onload = function() {
+ resolve("SendLoaded");
+}
xhr.open("GET", url);
xhr.send();
});
}).then(status => {
is(status, "SendErrored", "Using a blob URI from one user context id in another should not work");
});
info("Creating a tab with UCI = 1...");
--- a/browser/components/contextualidentity/test/browser/browser_eme.js
+++ b/browser/components/contextualidentity/test/browser/browser_eme.js
@@ -111,17 +111,19 @@ add_task(function* test() {
let mediaKeys = yield access.createMediaKeys();
let session = mediaKeys.createSession(aKeyInfo.sessionType);
let res = {};
// Insert the media key.
yield new Promise(resolve => {
session.addEventListener("message", function(event) {
session.update(aKeyInfo.keyObj).then(
- () => { resolve(); }
+ () => {
+ resolve();
+}
).catch(
() => {
ok(false, "Update the media key fail.");
resolve();
}
);
});
--- a/browser/components/contextualidentity/test/browser/browser_forgetAPI_EME_forgetThisSite.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetAPI_EME_forgetThisSite.js
@@ -105,17 +105,19 @@ function* setupEMEKey(browser) {
let mediaKeys = yield access.createMediaKeys();
let session = mediaKeys.createSession(aKeyInfo.sessionType);
let res = {};
// Insert the EME key.
yield new Promise(resolve => {
session.addEventListener("message", function(event) {
session.update(aKeyInfo.keyObj).then(
- () => { resolve(); }
+ () => {
+ resolve();
+}
).catch(
() => {
ok(false, "Update the EME key fail.");
resolve();
}
);
});
--- a/browser/components/contextualidentity/test/browser/browser_windowName.js
+++ b/browser/components/contextualidentity/test/browser/browser_windowName.js
@@ -36,17 +36,19 @@ add_task(function* test() {
content.window.name = 'tab-2';
});
// Let's try to open a window from tab1 with a name 'tab-2'.
info("Opening a window from the first tab...");
yield ContentTask.spawn(browser1, { url: BASE_URI + '?new' }, function* (opts) {
yield (new content.window.wrappedJSObject.Promise(resolve => {
let w = content.window.wrappedJSObject.open(opts.url, 'tab-2');
- w.onload = function() { resolve(); }
+ w.onload = function() {
+ resolve();
+}
}));
});
is(browser1.contentTitle, '?old', "Tab1 title must be 'old'");
is(browser1.contentPrincipal.userContextId, 1, "Tab1 UCI must be 1");
is(browser2.contentTitle, '?old', "Tab2 title must be 'old'");
is(browser2.contentPrincipal.userContextId, 2, "Tab2 UCI must be 2");
--- a/browser/components/customizableui/CustomizeMode.jsm
+++ b/browser/components/customizableui/CustomizeMode.jsm
@@ -1430,17 +1430,19 @@ CustomizeMode.prototype = {
recommendedThemes = JSON.parse(recommendedThemes);
let sb = Services.strings.createBundle("chrome://browser/locale/lightweightThemes.properties");
for (let theme of recommendedThemes) {
theme.name = sb.GetStringFromName("lightweightThemes." + theme.id + ".name");
theme.description = sb.GetStringFromName("lightweightThemes." + theme.id + ".description");
let button = buildToolbarButton(theme);
button.addEventListener("command", () => {
LightweightThemeManager.setLocalTheme(button.theme);
- recommendedThemes = recommendedThemes.filter((aTheme) => { return aTheme.id != button.theme.id; });
+ recommendedThemes = recommendedThemes.filter((aTheme) => {
+ return aTheme.id != button.theme.id;
+});
let string = Cc["@mozilla.org/supports-string;1"]
.createInstance(Ci.nsISupportsString);
string.data = JSON.stringify(recommendedThemes);
lwthemePrefs.setComplexValue("recommendedThemes",
Ci.nsISupportsString, string);
onThemeSelected(panel);
});
panel.insertBefore(button, footer);
--- a/browser/components/customizableui/test/browser_967000_button_sync.js
+++ b/browser/components/customizableui/test/browser_967000_button_sync.js
@@ -26,18 +26,22 @@ function updateTabsPanel() {
let promiseTabsUpdated = promiseObserverNotified("synced-tabs-menu:test:tabs-updated");
Services.obs.notifyObservers(null, SyncedTabs.TOPIC_TABS_CHANGED, null);
return promiseTabsUpdated;
}
// This is the mock we use for SyncedTabs.jsm - tests may override various
// functions.
let mockedInternal = {
- get isConfiguredToSyncTabs() { return true; },
- getTabClients() { return []; },
+ get isConfiguredToSyncTabs() {
+ return true;
+},
+ getTabClients() {
+ return [];
+},
syncTabs() {},
hasSyncedThisSession: false,
};
add_task(function* setup() {
let oldInternal = SyncedTabs._internal;
SyncedTabs._internal = mockedInternal;
--- a/browser/components/customizableui/test/browser_976792_insertNodeInWindow.js
+++ b/browser/components/customizableui/test/browser_976792_insertNodeInWindow.js
@@ -321,17 +321,19 @@ add_task(function*() {
let missingId = 1;
for (let i = 0; i < 5; i++) {
let id = kTestWidgetPrefix + i;
widgetIds.push(id);
if (i != missingId) {
// Setting min-width to make the overflow state not depend on styling of the button and/or
// screen width
let spec = {id, type: "button", removable: true, label: "test", tooltiptext: "" + i,
- onCreated(node) { node.style.minWidth = "100px"; }};
+ onCreated(node) {
+ node.style.minWidth = "100px";
+}};
info("Creating: " + id);
CustomizableUI.createWidget(spec);
}
}
let toolbarNode = createOverflowableToolbarWithPlacements(kToolbarName, widgetIds);
assertAreaPlacements(kToolbarName, widgetIds);
ok(!toolbarNode.hasAttribute("overflowing"), "Toolbar shouldn't overflow to start with.");
@@ -370,17 +372,19 @@ add_task(function*() {
let missingId = 3;
for (let i = 0; i < 5; i++) {
let id = kTestWidgetPrefix + i;
widgetIds.push(id);
if (i != missingId) {
// Setting min-width to make the overflow state not depend on styling of the button and/or
// screen width
let spec = {id, type: "button", removable: true, label: "test", tooltiptext: "" + i,
- onCreated(node) { node.style.minWidth = "200px"; }};
+ onCreated(node) {
+ node.style.minWidth = "200px";
+}};
info("Creating: " + id);
CustomizableUI.createWidget(spec);
}
}
let toolbarNode = createOverflowableToolbarWithPlacements(kToolbarName, widgetIds);
assertAreaPlacements(kToolbarName, widgetIds);
ok(!toolbarNode.hasAttribute("overflowing"), "Toolbar shouldn't overflow to start with.");
--- a/browser/components/feeds/test/unit/test_355473.js
+++ b/browser/components/feeds/test/unit/test_355473.js
@@ -31,13 +31,17 @@ function run_test() {
do_check_true(httpsFeedURI.equals(httpsChannel.originalURI));
// actually using the horrible mess that's a feed: URI is suicidal
do_check_true(httpURI.equals(feedChannel.URI));
do_check_true(httpURI.equals(httpChannel.URI));
do_check_true(httpsURI.equals(httpsChannel.URI));
// check that we throw creating feed: URIs from file and ftp
- Assert.throws(function() { ios.newURI("feed:ftp://example.com/feed.xml"); },
+ Assert.throws(function() {
+ ios.newURI("feed:ftp://example.com/feed.xml");
+},
"Should throw an exception when trying to create a feed: URI with an ftp: inner");
- Assert.throws(function() { ios.newURI("feed:file:///var/feed.xml"); },
+ Assert.throws(function() {
+ ios.newURI("feed:file:///var/feed.xml");
+},
"Should throw an exception when trying to create a feed: URI with a file: inner");
}
--- a/browser/components/migration/360seProfileMigrator.js
+++ b/browser/components/migration/360seProfileMigrator.js
@@ -172,17 +172,19 @@ Bookmarks.prototype = {
} catch (ex) {
Cu.reportError(ex);
}
}
} finally {
yield connection.close();
}
}.bind(this)).then(() => aCallback(true),
- e => { Cu.reportError(e); aCallback(false) });
+ e => {
+ Cu.reportError(e); aCallback(false);
+ });
}
};
function Qihoo360seProfileMigrator() {
let paths = [
// for v6 and above
{
users: ["360se6", "apps", "data", "users"],
--- a/browser/components/migration/AutoMigrate.jsm
+++ b/browser/components/migration/AutoMigrate.jsm
@@ -363,17 +363,19 @@ const AutoMigrate = {
["visits", state.visits],
]);
},
_saveUndoStateTrackerForShutdown: "not running",
saveUndoState: Task.async(function* () {
let resolveSavingPromise;
this._saveUndoStateTrackerForShutdown = "processing undo history";
- this._savingPromise = new Promise(resolve => { resolveSavingPromise = resolve });
+ this._savingPromise = new Promise(resolve => {
+ resolveSavingPromise = resolve;
+ });
let state = yield MigrationUtils.stopAndRetrieveUndoData();
this._saveUndoStateTrackerForShutdown = "writing undo history";
this._undoSavePromise = OS.File.writeAtomic(
kUndoStateFullPath, this._jsonifyUndoState(state), {
encoding: "utf-8",
compression: "lz4",
tmpPath: kUndoStateFullPath + ".tmp",
});
--- a/browser/components/migration/ChromeProfileMigrator.js
+++ b/browser/components/migration/ChromeProfileMigrator.js
@@ -242,17 +242,19 @@ function GetBookmarksResource(aProfileFo
return null;
return {
type: MigrationUtils.resourceTypes.BOOKMARKS,
migrate(aCallback) {
return Task.spawn(function* () {
let gotErrors = false;
- let errorGatherer = function() { gotErrors = true };
+ let errorGatherer = function() {
+ gotErrors = true;
+ };
let jsonStream = yield new Promise((resolve, reject) => {
let options = {
uri: NetUtil.newURI(bookmarksFile),
loadUsingSystemPrincipal: true
};
NetUtil.asyncFetch(options, (inputStream, resultCode) => {
if (Components.isSuccessCode(resultCode)) {
resolve(inputStream);
@@ -349,17 +351,19 @@ function GetHistoryResource(aProfileFold
resolve();
} else {
reject(new Error("Couldn't add visits"));
}
}
});
});
}
- }).then(() => { aCallback(true) },
+ }).then(() => {
+ aCallback(true);
+ },
ex => {
Cu.reportError(ex);
aCallback(false);
});
}
};
}
--- a/browser/components/migration/EdgeProfileMigrator.js
+++ b/browser/components/migration/EdgeProfileMigrator.js
@@ -227,19 +227,23 @@ EdgeReadingListMigrator.prototype = {
function EdgeBookmarksMigrator(dbOverride) {
this.dbOverride = dbOverride;
}
EdgeBookmarksMigrator.prototype = {
type: MigrationUtils.resourceTypes.BOOKMARKS,
- get db() { return this.dbOverride || gEdgeDatabase },
+ get db() {
+ return this.dbOverride || gEdgeDatabase;
+ },
- get TABLE_NAME() { return "Favorites" },
+ get TABLE_NAME() {
+ return "Favorites";
+ },
get exists() {
if (!("_exists" in this)) {
this._exists = !!this.db && this._checkTableExists();
}
return this._exists;
},
--- a/browser/components/migration/MSMigrationUtils.jsm
+++ b/browser/components/migration/MSMigrationUtils.jsm
@@ -368,17 +368,19 @@ Bookmarks.prototype = {
// Import to the bookmarks menu.
let folderGuid = PlacesUtils.bookmarks.menuGuid;
if (!MigrationUtils.isStartupMigration) {
folderGuid =
yield MigrationUtils.createImportedBookmarksFolder(this.importedAppLabel, folderGuid);
}
yield this._migrateFolder(this._favoritesFolder, folderGuid);
}.bind(this)).then(() => aCallback(true),
- e => { Cu.reportError(e); aCallback(false) });
+ e => {
+ Cu.reportError(e); aCallback(false);
+ });
},
_migrateFolder: Task.async(function* (aSourceFolder, aDestFolderGuid) {
// TODO (bug 741993): the favorites order is stored in the Registry, at
// HCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Favorites
// for IE, and in a similar location for Edge.
// Until we support it, bookmarks are imported in alphabetical order.
let entries = aSourceFolder.directoryEntries;
--- a/browser/components/migration/MigrationUtils.jsm
+++ b/browser/components/migration/MigrationUtils.jsm
@@ -204,17 +204,19 @@ this.MigratorPrototype = {
* @see nsIBrowserProfileMigrator
*/
getMigrateData: function MP_getMigrateData(aProfile) {
let resources = this._getMaybeCachedResources(aProfile);
if (!resources) {
return [];
}
let types = resources.map(r => r.type);
- return types.reduce((a, b) => { a |= b; return a }, 0);
+ return types.reduce((a, b) => {
+ a |= b; return a;
+ }, 0);
},
getKey: function MP_getKey() {
return this.contractID.match(/\=([^\=]+)$/)[1];
},
/**
* DO NOT OVERRIDE - After deCOMing migration, the UI will just call
@@ -657,23 +659,27 @@ this.MigrationUtils = Object.freeze({
getMigrator: function MU_getMigrator(aKey) {
let migrator = null;
if (this._migrators.has(aKey)) {
migrator = this._migrators.get(aKey);
} else {
try {
migrator = Cc["@mozilla.org/profile/migrator;1?app=browser&type=" +
aKey].createInstance(Ci.nsIBrowserProfileMigrator);
- } catch (ex) { Cu.reportError(ex) }
+ } catch (ex) {
+ Cu.reportError(ex);
+ }
this._migrators.set(aKey, migrator);
}
try {
return migrator && migrator.sourceExists ? migrator : null;
- } catch (ex) { Cu.reportError(ex); return null }
+ } catch (ex) {
+ Cu.reportError(ex); return null;
+ }
},
/**
* Figure out what is the default browser, and if there is a migrator
* for it, return that migrator's internal name.
* For the time being, the "internal name" of a migrator is its contract-id
* trailer (e.g. ie for @mozilla.org/profile/migrator;1?app=browser&type=ie),
* but it will soon be exposed properly.
--- a/browser/components/migration/SafariProfileMigrator.js
+++ b/browser/components/migration/SafariProfileMigrator.js
@@ -43,17 +43,19 @@ Bookmarks.prototype = {
let children = dict.get("Children");
if (!children)
throw new Error("Invalid Bookmarks.plist format");
let collection = dict.get("Title") == "com.apple.ReadingList" ?
this.READING_LIST_COLLECTION : this.ROOT_COLLECTION;
yield this._migrateCollection(children, collection);
}.bind(this)).then(() => aCallback(true),
- e => { Cu.reportError(e); aCallback(false) });
+ e => {
+ Cu.reportError(e); aCallback(false);
+ });
},
// Bookmarks collections in Safari. Constants for migrateCollection.
ROOT_COLLECTION: 0,
MENU_COLLECTION: 1,
TOOLBAR_COLLECTION: 2,
READING_LIST_COLLECTION: 3,
--- a/browser/components/migration/tests/browser/browser_undo_notification.js
+++ b/browser/components/migration/tests/browser/browser_undo_notification.js
@@ -14,17 +14,19 @@ registerCleanupFunction(function() {
const kExpectedNotificationId = "automigration-undo";
add_task(function* autoMigrationUndoNotificationShows() {
let getNotification = browser =>
gBrowser.getNotificationBox(browser).getNotificationWithValue(kExpectedNotificationId);
scope.AutoMigrate.canUndo = () => true;
let undoCalled;
- scope.AutoMigrate.undo = () => { undoCalled = true };
+ scope.AutoMigrate.undo = () => {
+ undoCalled = true;
+ };
for (let url of ["about:newtab", "about:home"]) {
undoCalled = false;
// Can't use pushPrefEnv because of bug 1323779
Services.prefs.setCharPref("browser.migrate.automigrate.browser", "someunknownbrowser");
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, url, false);
let browser = tab.linkedBrowser;
if (!getNotification(browser)) {
info(`Notification for ${url} not immediately present, waiting for it.`);
--- a/browser/components/migration/tests/unit/test_automigration.js
+++ b/browser/components/migration/tests/unit/test_automigration.js
@@ -12,17 +12,19 @@ const kUsecPerMin = 60 * 1000000;
// return a different value to an object when directly proxying a frozen
// object.
AutoMigrateBackstage.MigrationUtils = new Proxy({}, {
get(target, name) {
if (name == "getMigratorKeyForDefaultBrowser" && gShimmedMigratorKeyPicker) {
return gShimmedMigratorKeyPicker;
}
if (name == "getMigrator" && gShimmedMigrator) {
- return function() { return gShimmedMigrator };
+ return function() {
+ return gShimmedMigrator;
+ };
}
return MigrationUtils[name];
},
});
do_register_cleanup(function() {
AutoMigrateBackstage.MigrationUtils = MigrationUtils;
});
--- a/browser/components/nsBrowserGlue.js
+++ b/browser/components/nsBrowserGlue.js
@@ -2518,17 +2518,19 @@ ContentPermissionPrompt.prototype = {
Cu.reportError(ex);
request.cancel();
throw ex;
}
},
};
var DefaultBrowserCheck = {
- get OPTIONPOPUP() { return "defaultBrowserNotificationPopup" },
+ get OPTIONPOPUP() {
+ return "defaultBrowserNotificationPopup"
+},
_setAsDefaultTimer: null,
_setAsDefaultButtonClickStartTime: 0,
closePrompt(aNode) {
if (this._notification) {
this._notification.close();
}
},
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -1119,17 +1119,19 @@ PlacesTreeView.prototype = {
},
get selection() {
return this._selection;
},
set selection(val) {
this._selection = val;
},
- getRowProperties() { return ""; },
+ getRowProperties() {
+ return "";
+},
getCellProperties:
function PTV_getCellProperties(aRow, aColumn) {
// for anonid-trees, we need to add the column-type manually
var props = "";
let columnType = aColumn.element.getAttribute("anonid");
if (columnType)
props += columnType;
@@ -1198,17 +1200,19 @@ PlacesTreeView.prototype = {
}
this._cellProperties.set(node, properties);
}
return props + " " + properties;
},
- getColumnProperties(aColumn) { return ""; },
+ getColumnProperties(aColumn) {
+ return "";
+},
isContainer: function PTV_isContainer(aRow) {
// Only leaf nodes aren't listed in the rows array.
let node = this._rows[aRow];
if (node === undefined)
return false;
if (PlacesUtils.nodeIsContainer(node)) {
@@ -1694,13 +1698,15 @@ PlacesTreeView.prototype = {
this._cuttingNodes.delete(aNode);
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
}
},
selectionChanged() { },
cycleCell(aRow, aColumn) { },
- isSelectable(aRow, aColumn) { return false; },
+ isSelectable(aRow, aColumn) {
+ return false;
+},
performAction(aAction) { },
performActionOnRow(aAction, aRow) { },
performActionOnCell(aAction, aRow, aColumn) { }
};
--- a/browser/components/places/tests/browser/browser_435851_copy_query.js
+++ b/browser/components/places/tests/browser/browser_435851_copy_query.js
@@ -12,17 +12,19 @@ add_task(function* copy_toolbar_shortcut
registerCleanupFunction(function() {
library.close();
PlacesUtils.bookmarks.removeFolderChildren(PlacesUtils.unfiledBookmarksFolderId);
});
library.PlacesOrganizer.selectLeftPaneQuery("BookmarksToolbar");
- yield promiseClipboard(function() { library.PlacesOrganizer._places.controller.copy(); },
+ yield promiseClipboard(function() {
+ library.PlacesOrganizer._places.controller.copy();
+},
PlacesUtils.TYPE_X_MOZ_PLACE);
library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
library.ContentTree.view.controller.paste();
let toolbarCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0);
is(toolbarCopyNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_FOLDER_SHORTCUT,
@@ -35,17 +37,19 @@ add_task(function* copy_toolbar_shortcut
"original is still a folder shortcut");
});
add_task(function* copy_history_query() {
let library = yield promiseLibrary();
library.PlacesOrganizer.selectLeftPaneQuery("History");
- yield promiseClipboard(function() { library.PlacesOrganizer._places.controller.copy(); },
+ yield promiseClipboard(function() {
+ library.PlacesOrganizer._places.controller.copy();
+},
PlacesUtils.TYPE_X_MOZ_PLACE);
library.PlacesOrganizer.selectLeftPaneQuery("UnfiledBookmarks");
library.ContentTree.view.controller.paste();
let historyCopyNode = library.ContentTree.view.view.nodeForTreeIndex(0);
is(historyCopyNode.type,
Ci.nsINavHistoryResultNode.RESULT_TYPE_QUERY,
--- a/browser/components/places/tests/browser/browser_bookmarklet_windowOpen.js
+++ b/browser/components/places/tests/browser/browser_bookmarklet_windowOpen.js
@@ -17,17 +17,19 @@ add_task(function* openKeywordBookmarkWi
// This is the current default, but let's not assume that...
yield SpecialPowers.pushPrefEnv({"set": [
[ 'browser.link.open_newwindow', 3 ],
[ 'dom.disable_open_during_load', true ]
]});
let moztab;
let tabOpened = BrowserTestUtils.openNewForegroundTab(gBrowser, "about:mozilla")
- .then((tab) => { moztab = tab; });
+ .then((tab) => {
+ moztab = tab;
+});
let keywordForBM = "openmeatab";
let bookmarkInfo;
let bookmarkCreated =
makeBookmarkFor("javascript:void open('" + TEST_URL + "')", keywordForBM)
.then((values) => {
bookmarkInfo = values[0];
});
--- a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
+++ b/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
@@ -66,17 +66,19 @@ function synthesizeDragWithDirection(aEl
aElement.removeEventListener("click", prevent, false);
// Cleanup eventually opened menus.
if (aElement.localName == "menu" && aElement.open)
aElement.open = false;
aCallback()
}, false);
- var prevent = function(aEvent) { aEvent.preventDefault(); }
+ var prevent = function(aEvent) {
+ aEvent.preventDefault();
+}
var xIncrement = 0;
var yIncrement = 0;
switch (aDirection) {
case dragDirections.LEFT:
xIncrement = -1;
break;
--- a/browser/components/places/tests/unit/test_clearHistory_shutdown.js
+++ b/browser/components/places/tests/unit/test_clearHistory_shutdown.js
@@ -108,26 +108,32 @@ function addFormHistory() {
let now = Date.now() * 1000;
FormHistory.update({ op: "add",
fieldname: "testfield",
value: "test",
timesUsed: 1,
firstUsed: now,
lastUsed: now
},
- { handleCompletion(reason) { resolve(); } });
+ { handleCompletion(reason) {
+ resolve();
+} });
});
}
function getFormHistoryCount() {
return new Promise((resolve, reject) => {
let count = -1;
FormHistory.count({ fieldname: "testfield" },
- { handleResult(result) { count = result; },
- handleCompletion(reason) { resolve(count); }
+ { handleResult(result) {
+ count = result;
+},
+ handleCompletion(reason) {
+ resolve(count);
+}
});
});
}
function storeCache(aURL, aContent) {
let cache = Services.cache2;
let storage = cache.diskCacheStorage(LoadContextInfo.default, false);
--- a/browser/components/preferences/blocklists.js
+++ b/browser/components/preferences/blocklists.js
@@ -28,30 +28,40 @@ var gBlocklistManager = {
let desc = list.description ? list.description : "";
let text = gBlocklistManager._bundle.getFormattedString("mozNameTemplate",
[list.name, desc]);
return text;
}
return "";
},
- isSeparator(index) { return false; },
- isSorted() { return false; },
- isContainer(index) { return false; },
+ isSeparator(index) {
+ return false;
+},
+ isSorted() {
+ return false;
+},
+ isContainer(index) {
+ return false;
+},
setTree(tree) {},
getImageSrc(row, column) {},
getProgressMode(row, column) {},
getCellValue(row, column) {
if (column.id == "selectionCol")
return gBlocklistManager._blockLists[row].selected;
return undefined;
},
cycleHeader(column) {},
- getRowProperties(row) { return ""; },
- getColumnProperties(column) { return ""; },
+ getRowProperties(row) {
+ return "";
+},
+ getColumnProperties(column) {
+ return "";
+},
getCellProperties(row, column) {
if (column.id == "selectionCol") {
return "checkmark";
}
return "";
}
},
--- a/browser/components/preferences/cookies.js
+++ b/browser/components/preferences/cookies.js
@@ -315,21 +315,31 @@ var gCookiesWindow = {
return this._filterSet[aIndex].rawHost;
} else if (aColumn.id == "nameCol") {
return this._filterSet[aIndex].name;
}
return "";
},
_selection: null,
- get selection() { return this._selection; },
- set selection(val) { this._selection = val; return val; },
- getRowProperties(aIndex) { return ""; },
- getCellProperties(aIndex, aColumn) { return ""; },
- getColumnProperties(aColumn) { return ""; },
+ get selection() {
+ return this._selection;
+},
+ set selection(val) {
+ this._selection = val; return val;
+},
+ getRowProperties(aIndex) {
+ return "";
+},
+ getCellProperties(aIndex, aColumn) {
+ return "";
+},
+ getColumnProperties(aColumn) {
+ return "";
+},
isContainer(aIndex) {
if (!this._filtered) {
var item = this._getItemAtIndex(aIndex);
if (!item) return false;
return item.container;
}
return false;
},
@@ -344,19 +354,25 @@ var gCookiesWindow = {
isContainerEmpty(aIndex) {
if (!this._filtered) {
var item = this._getItemAtIndex(aIndex);
if (!item) return false;
return item.cookies.length == 0;
}
return false;
},
- isSeparator(aIndex) { return false; },
- isSorted(aIndex) { return false; },
- canDrop(aIndex, aOrientation) { return false; },
+ isSeparator(aIndex) {
+ return false;
+},
+ isSorted(aIndex) {
+ return false;
+},
+ canDrop(aIndex, aOrientation) {
+ return false;
+},
drop(aIndex, aOrientation) {},
getParentIndex(aIndex) {
if (!this._filtered) {
var item = this._getItemAtIndex(aIndex);
// If an item has no parent index (i.e. it is at the top level) this
// function MUST return -1 otherwise we will go into an infinite loop.
// Containers are always top level items in the cookies tree, so make
// sure to return the appropriate value here.
--- a/browser/components/preferences/in-content/preferences.js
+++ b/browser/components/preferences/in-content/preferences.js
@@ -218,17 +218,19 @@ function helpButtonCommand() {
function friendlyPrefCategoryNameToInternalName(aName) {
if (aName.startsWith("pane"))
return aName;
return "pane" + aName.substring(0, 1).toUpperCase() + aName.substr(1);
}
// This function is duplicated inside of utilityOverlay.js's openPreferences.
function internalPrefCategoryNameToFriendlyName(aName) {
- return (aName || "").replace(/^pane./, function(toReplace) { return toReplace[4].toLowerCase(); });
+ return (aName || "").replace(/^pane./, function(toReplace) {
+ return toReplace[4].toLowerCase();
+});
}
// Put up a confirm dialog with "ok to restart", "revert without restarting"
// and "restart later" buttons and returns the index of the button chosen.
// We can choose not to display the "restart later", or "revert" buttons,
// altough the later still lets us revert by using the escape key.
//
// The constants are useful to interpret the return value of the function.
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -552,39 +552,65 @@ EngineView.prototype = {
gSearchPane.buildDefaultEngineDropDown();
// Redraw, and adjust selection
this.invalidate();
this.selection.select(dropIndex);
},
selection: null,
- getRowProperties(index) { return ""; },
- getCellProperties(index, column) { return ""; },
- getColumnProperties(column) { return ""; },
- isContainer(index) { return false; },
- isContainerOpen(index) { return false; },
- isContainerEmpty(index) { return false; },
- isSeparator(index) { return false; },
- isSorted(index) { return false; },
- getParentIndex(index) { return -1; },
- hasNextSibling(parentIndex, index) { return false; },
- getLevel(index) { return 0; },
+ getRowProperties(index) {
+ return "";
+},
+ getCellProperties(index, column) {
+ return "";
+},
+ getColumnProperties(column) {
+ return "";
+},
+ isContainer(index) {
+ return false;
+},
+ isContainerOpen(index) {
+ return false;
+},
+ isContainerEmpty(index) {
+ return false;
+},
+ isSeparator(index) {
+ return false;
+},
+ isSorted(index) {
+ return false;
+},
+ getParentIndex(index) {
+ return -1;
+},
+ hasNextSibling(parentIndex, index) {
+ return false;
+},
+ getLevel(index) {
+ return 0;
+},
getProgressMode(index, column) { },
getCellValue(index, column) {
if (column.id == "engineShown")
return this._engineStore.engines[index].shown;
return undefined;
},
toggleOpenState(index) { },
cycleHeader(column) { },
selectionChanged() { },
cycleCell(row, column) { },
- isEditable(index, column) { return column.id != "engineName"; },
- isSelectable(index, column) { return false; },
+ isEditable(index, column) {
+ return column.id != "engineName";
+},
+ isSelectable(index, column) {
+ return false;
+},
setCellValue(index, column, value) {
if (column.id == "engineShown") {
this._engineStore.engines[index].shown = value == "true";
gEngineView.invalidate();
gSearchPane.saveOneClickEnginesList();
}
},
setCellText(index, column, value) {
--- a/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
+++ b/browser/components/preferences/in-content/tests/browser_basic_rebuild_fonts_test.js
@@ -28,18 +28,22 @@ add_task(function*() {
win.FontBuilder._enumerator = {
_list: ["MockedFont1", "MockedFont2", "MockedFont3"],
EnumerateFonts(lang, type, list) {
return this._list;
},
EnumerateAllFonts() {
return this._list;
},
- getDefaultFont() { return null; },
- getStandardFamilyName(name) { return name; },
+ getDefaultFont() {
+ return null;
+},
+ getStandardFamilyName(name) {
+ return name;
+},
};
win.FontBuilder._allFonts = null;
win.FontBuilder._langGroupSupported = false;
let langGroupElement = doc.getElementById("font.language.group");
let selectLangsField = doc.getElementById("selectLangs");
let serifField = doc.getElementById("serif");
let armenian = "x-armn";
--- a/browser/components/preferences/in-content/tests/browser_bug705422.js
+++ b/browser/components/preferences/in-content/tests/browser_bug705422.js
@@ -41,17 +41,21 @@ function initTest() {
cookieSvc.setCookieString(cookieUri, null, name + "=" + value + ";", null);
}
// open cookie manager
var cmd = window.openDialog("chrome://browser/content/preferences/cookies.xul",
"Browser:Cookies", "", {});
// when it has loaded, run actual tests
- cmd.addEventListener("load", function() { executeSoon(function() { runTest(cmd, searchTerm, vals.length, matches); }); }, false);
+ cmd.addEventListener("load", function() {
+ executeSoon(function() {
+ runTest(cmd, searchTerm, vals.length, matches);
+});
+}, false);
}
function isDisabled(win, expectation) {
var disabled = win.document.getElementById("removeAllCookies").disabled;
is(disabled, expectation, "Remove all cookies button has correct state: " + (expectation ? "disabled" : "enabled"));
}
function runTest(win, searchTerm, cookies, matches) {
--- a/browser/components/preferences/in-content/tests/browser_subdialogs.js
+++ b/browser/components/preferences/in-content/tests/browser_subdialogs.js
@@ -111,109 +111,129 @@ add_task(function* check_titlebar_focus_
ContentTask.spawn(tab.linkedBrowser, null, function*() {
let dialogTitleElement = content.document.getElementById("dialogTitle");
Assert.equal(dialogTitleElement.textContent, "Updated title",
"subdialog should have updated title");
});
// Accept the dialog
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog(); },
+ function() {
+ content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog();
+},
"accept", 1);
});
add_task(function* check_canceling_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentDocument.documentElement.cancelDialog(); },
+ function() {
+ content.window.gSubDialog._frame.contentDocument.documentElement.cancelDialog();
+},
"cancel", 0);
});
add_task(function* check_reopening_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("opening another dialog which will close the first");
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, "", gDialogURL2);
info("closing as normal");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog(); },
+ function() {
+ content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog();
+},
"accept", 1);
});
add_task(function* check_opening_while_closing() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("closing");
content.window.gSubDialog.close();
info("reopening immediately after calling .close()");
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog(); },
+ function() {
+ content.window.gSubDialog._frame.contentDocument.documentElement.acceptDialog();
+},
"accept", 1);
});
add_task(function* window_close_on_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
+ function() {
+ content.window.gSubDialog._frame.contentWindow.window.close();
+},
null, 0);
});
add_task(function* click_close_button_on_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { return BrowserTestUtils.synthesizeMouseAtCenter("#dialogClose", {}, tab.linkedBrowser); },
+ function() {
+ return BrowserTestUtils.synthesizeMouseAtCenter("#dialogClose", {}, tab.linkedBrowser);
+},
null, 0, {runClosingFnOutsideOfContentTask: true});
});
add_task(function* back_navigation_on_subdialog_should_close_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.goBack(); },
+ function() {
+ content.window.gSubDialog._frame.goBack();
+},
null, undefined);
});
add_task(function* back_navigation_on_browser_tab_should_close_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { tab.linkedBrowser.goBack(); },
+ function() {
+ tab.linkedBrowser.goBack();
+},
null, undefined, {runClosingFnOutsideOfContentTask: true});
});
add_task(function* escape_should_close_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
info("canceling the dialog");
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { return BrowserTestUtils.synthesizeKey("VK_ESCAPE", {}, tab.linkedBrowser); },
+ function() {
+ return BrowserTestUtils.synthesizeKey("VK_ESCAPE", {}, tab.linkedBrowser);
+},
"cancel", 0, {runClosingFnOutsideOfContentTask: true});
});
add_task(function* correct_width_and_height_should_be_used_for_dialog() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser);
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let frameStyle = content.window.gSubDialog._frame.style;
Assert.equal(frameStyle.width, "32em",
"Width should be set on the frame from the dialog");
Assert.equal(frameStyle.height, "5em",
"Height should be set on the frame from the dialog");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
+ function() {
+ content.window.gSubDialog._frame.contentWindow.window.close();
+},
null, 0);
});
add_task(function* wrapped_text_in_dialog_should_have_expected_scrollHeight() {
let oldHeight = yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
let frame = content.window.gSubDialog._frame;
let doc = frame.contentDocument;
let scrollHeight = doc.documentElement.scrollHeight;
@@ -240,17 +260,19 @@ add_task(function* wrapped_text_in_dialo
"Width should be set on the frame from the dialog");
Assert.ok(docEl.scrollHeight > contentOldHeight,
"Content height increased (from " + contentOldHeight + " to " + docEl.scrollHeight + ").");
Assert.equal(frame.style.height, docEl.scrollHeight + "px",
"Height on the frame should be higher now");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
+ function() {
+ content.window.gSubDialog._frame.contentWindow.window.close();
+},
null, 0);
});
add_task(function* dialog_too_tall_should_get_reduced_in_height() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
let frame = content.window.gSubDialog._frame;
frame.contentDocument.documentElement.style.height = '100000px';
});
@@ -258,17 +280,19 @@ add_task(function* dialog_too_tall_shoul
yield ContentTask.spawn(tab.linkedBrowser, null, function*() {
let frame = content.window.gSubDialog._frame;
Assert.equal(frame.style.width, "32em", "Width should be set on the frame from the dialog");
Assert.ok(parseInt(frame.style.height, 10) < content.window.innerHeight,
"Height on the frame should be smaller than window's innerHeight");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
+ function() {
+ content.window.gSubDialog._frame.contentWindow.window.close();
+},
null, 0);
});
add_task(function* scrollWidth_and_scrollHeight_from_subdialog_should_size_the_browser() {
yield open_subdialog_and_test_generic_start_state(tab.linkedBrowser, function domcontentloadedFn() {
let frame = content.window.gSubDialog._frame;
frame.contentDocument.documentElement.style.removeProperty("height");
frame.contentDocument.documentElement.style.removeProperty("width");
@@ -278,15 +302,17 @@ add_task(function* scrollWidth_and_scrol
let frame = content.window.gSubDialog._frame;
Assert.ok(frame.style.width.endsWith("px"),
"Width (" + frame.style.width + ") should be set to a px value of the scrollWidth from the dialog");
Assert.ok(frame.style.height.endsWith("px"),
"Height (" + frame.style.height + ") should be set to a px value of the scrollHeight from the dialog");
});
yield close_subdialog_and_test_generic_end_state(tab.linkedBrowser,
- function() { content.window.gSubDialog._frame.contentWindow.window.close(); },
+ function() {
+ content.window.gSubDialog._frame.contentWindow.window.close();
+},
null, 0);
});
add_task(function* test_shutdown() {
gBrowser.removeTab(tab);
});
--- a/browser/components/preferences/languages.js
+++ b/browser/components/preferences/languages.js
@@ -60,23 +60,27 @@ var gLanguagesDialog = {
var abCDPairs = abCD.split("-"); // ab[-cd]
var useABCDFormat = abCDPairs.length > 1;
var ab = useABCDFormat ? abCDPairs[0] : abCD;
var cd = useABCDFormat ? abCDPairs[1] : "";
if (ab) {
var language = "";
try {
language = bundleLanguages.getString(ab);
- } catch (e) { continue; }
+ } catch (e) {
+ continue;
+}
var region = "";
if (useABCDFormat) {
try {
region = bundleRegions.getString(cd);
- } catch (e) { continue; }
+ } catch (e) {
+ continue;
+}
}
var name = "";
if (useABCDFormat)
name = bundlePreferences.getFormattedString("languageRegionCodeFormat",
[language, region, abCD]);
else
name = bundlePreferences.getFormattedString("languageCodeFormat",
--- a/browser/components/preferences/permissions.js
+++ b/browser/components/preferences/permissions.js
@@ -36,26 +36,36 @@ var gPermissionManager = {
getCellText(aRow, aColumn) {
if (aColumn.id == "siteCol")
return gPermissionManager._permissions[aRow].origin;
else if (aColumn.id == "statusCol")
return gPermissionManager._permissions[aRow].capability;
return "";
},
- isSeparator(aIndex) { return false; },
- isSorted() { return false; },
- isContainer(aIndex) { return false; },
+ isSeparator(aIndex) {
+ return false;
+},
+ isSorted() {
+ return false;
+},
+ isContainer(aIndex) {
+ return false;
+},
setTree(aTree) {},
getImageSrc(aRow, aColumn) {},
getProgressMode(aRow, aColumn) {},
getCellValue(aRow, aColumn) {},
cycleHeader(column) {},
- getRowProperties(row) { return ""; },
- getColumnProperties(column) { return ""; },
+ getRowProperties(row) {
+ return "";
+},
+ getColumnProperties(column) {
+ return "";
+},
getCellProperties(row, column) {
if (column.element.getAttribute("id") == "siteCol")
return "ltr";
return "";
}
},
--- a/browser/components/search/test/browser_426329.js
+++ b/browser/components/search/test/browser_426329.js
@@ -44,18 +44,22 @@ function getMenuEntries() {
return entries;
}
function countEntries(name, value) {
return new Promise(resolve => {
let count = 0;
let obj = name && value ? {fieldname: name, value} : {};
FormHistory.count(obj,
- { handleResult(result) { count = result; },
- handleError(error) { throw error; },
+ { handleResult(result) {
+ count = result;
+},
+ handleError(error) {
+ throw error;
+},
handleCompletion(reason) {
if (!reason) {
resolve(count);
}
}
});
});
}
--- a/browser/components/search/test/browser_searchbar_keyboard_navigation.js
+++ b/browser/components/search/test/browser_searchbar_keyboard_navigation.js
@@ -54,17 +54,19 @@ add_task(function* init() {
});
resolve();
},
handleError: reject
});
});
textbox.value = kUserValue;
- registerCleanupFunction(() => { textbox.value = ""; });
+ registerCleanupFunction(() => {
+ textbox.value = "";
+});
});
add_task(function* test_arrows() {
let promise = promiseEvent(searchPopup, "popupshown");
info("Opening search panel");
searchbar.focus();
yield promise;
--- a/browser/components/syncedtabs/test/browser/browser_sidebar_syncedtabslist.js
+++ b/browser/components/syncedtabs/test/browser/browser_sidebar_syncedtabslist.js
@@ -86,18 +86,22 @@ add_task(function* testSyncedTabsSidebar
let SyncedTabs = SidebarUI.browser.contentWindow.SyncedTabs;
Assert.ok(syncedTabsDeckComponent, "component exists");
originalSyncedTabsInternal = SyncedTabs._internal;
SyncedTabs._internal = {
isConfiguredToSyncTabs: true,
hasSyncedThisSession: true,
- getTabClients() { return Promise.resolve([]) },
- syncTabs() { return Promise.resolve(); },
+ getTabClients() {
+ return Promise.resolve([])
+},
+ syncTabs() {
+ return Promise.resolve();
+},
};
sinon.stub(syncedTabsDeckComponent, "_accountStatus", () => Promise.resolve(true));
sinon.stub(SyncedTabs._internal, "getTabClients", () => Promise.resolve(Cu.cloneInto(FIXTURE, {})));
yield syncedTabsDeckComponent.updatePanel();
// This is a hacky way of waiting for the view to render. The view renders
// after the following promise (a different instance of which is triggered
@@ -139,18 +143,22 @@ add_task(function* testSyncedTabsSidebar
let SyncedTabs = window.SidebarUI.browser.contentWindow.SyncedTabs;
Assert.ok(syncedTabsDeckComponent, "component exists");
originalSyncedTabsInternal = SyncedTabs._internal;
SyncedTabs._internal = {
isConfiguredToSyncTabs: true,
hasSyncedThisSession: true,
- getTabClients() { return Promise.resolve([]) },
- syncTabs() { return Promise.resolve(); },
+ getTabClients() {
+ return Promise.resolve([])
+},
+ syncTabs() {
+ return Promise.resolve();
+},
};
sinon.stub(syncedTabsDeckComponent, "_accountStatus", () => Promise.resolve(true));
sinon.stub(SyncedTabs._internal, "getTabClients", () => Promise.resolve(Cu.cloneInto(FIXTURE, {})));
yield syncedTabsDeckComponent.updatePanel();
// This is a hacky way of waiting for the view to render. The view renders
// after the following promise (a different instance of which is triggered
@@ -199,17 +207,19 @@ add_task(function* testSyncedTabsSidebar
let syncedTabsDeckComponent = window.SidebarUI.browser.contentWindow.syncedTabsDeckComponent;
let SyncedTabs = window.SidebarUI.browser.contentWindow.SyncedTabs;
originalSyncedTabsInternal = SyncedTabs._internal;
SyncedTabs._internal = {
isConfiguredToSyncTabs: false,
hasSyncedThisSession: false,
getTabClients() {},
- syncTabs() { return Promise.resolve(); },
+ syncTabs() {
+ return Promise.resolve();
+},
};
Assert.ok(syncedTabsDeckComponent, "component exists");
sinon.spy(syncedTabsDeckComponent, "updatePanel");
sinon.spy(syncedTabsDeckComponent, "observe");
sinon.stub(syncedTabsDeckComponent, "_accountStatus", () => Promise.reject("Test error"));
@@ -261,18 +271,22 @@ add_task(function* testSyncedTabsSidebar
let SyncedTabs = window.SidebarUI.browser.contentWindow.SyncedTabs;
Assert.ok(syncedTabsDeckComponent, "component exists");
originalSyncedTabsInternal = SyncedTabs._internal;
SyncedTabs._internal = {
isConfiguredToSyncTabs: true,
hasSyncedThisSession: true,
- getTabClients() { return Promise.resolve([]) },
- syncTabs() { return Promise.resolve(); },
+ getTabClients() {
+ return Promise.resolve([])
+},
+ syncTabs() {
+ return Promise.resolve();
+},
};
sinon.stub(syncedTabsDeckComponent, "_accountStatus", () => Promise.resolve(true));
sinon.stub(SyncedTabs._internal, "getTabClients", () => Promise.resolve(Cu.cloneInto(FIXTURE, {})));
yield syncedTabsDeckComponent.updatePanel();
// This is a hacky way of waiting for the view to render. The view renders
// after the following promise (a different instance of which is triggered
--- a/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
+++ b/browser/components/syncedtabs/test/xpcshell/test_TabListComponent.js
@@ -76,17 +76,19 @@ add_task(function* testActions() {
let getChromeWindowMock = sinon.stub();
getChromeWindowMock.returns(chromeWindowMock);
let clipboardHelperMock = {
copyString() {},
};
let windowMock = {
top: {
PlacesCommandHook: {
- bookmarkLink() { return Promise.resolve(); }
+ bookmarkLink() {
+ return Promise.resolve();
+}
},
PlacesUtils: { bookmarksMenuFolderId: "id" }
},
getBrowserURL() {},
openDialog() {},
openUILinkIn() {}
};
let component = new TabListComponent({
--- a/browser/components/tests/browser/browser_contentpermissionprompt.js
+++ b/browser/components/tests/browser/browser_contentpermissionprompt.js
@@ -65,64 +65,72 @@ MockContentPermissionRequest.prototype =
/**
* Tests that if the nsIContentPermissionRequest has an empty
* types array, that NS_ERROR_UNEXPECTED is thrown, and the
* request is cancelled.
*/
add_task(function* test_empty_types() {
let mockRequest = new MockContentPermissionRequest([]);
- Assert.throws(() => { ContentPermissionPrompt.prompt(mockRequest); },
+ Assert.throws(() => {
+ ContentPermissionPrompt.prompt(mockRequest);
+},
/NS_ERROR_UNEXPECTED/,
"Should have thrown NS_ERROR_UNEXPECTED.");
Assert.ok(mockRequest.cancelled, "Should have cancelled the request.");
});
/**
* Tests that if the nsIContentPermissionRequest has more than
* one type, that NS_ERROR_UNEXPECTED is thrown, and the request
* is cancelled.
*/
add_task(function* test_multiple_types() {
let mockRequest = new MockContentPermissionRequest([
new MockContentPermissionType("test1"),
new MockContentPermissionType("test2"),
]);
- Assert.throws(() => { ContentPermissionPrompt.prompt(mockRequest); },
+ Assert.throws(() => {
+ ContentPermissionPrompt.prompt(mockRequest);
+},
/NS_ERROR_UNEXPECTED/);
Assert.ok(mockRequest.cancelled, "Should have cancelled the request.");
});
/**
* Tests that if the nsIContentPermissionRequest has a type that
* does not implement nsIContentPermissionType that NS_NOINTERFACE
* is thrown, and the request is cancelled.
*/
add_task(function* test_not_permission_type() {
let mockRequest = new MockContentPermissionRequest([
{ QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]) },
]);
- Assert.throws(() => { ContentPermissionPrompt.prompt(mockRequest); },
+ Assert.throws(() => {
+ ContentPermissionPrompt.prompt(mockRequest);
+},
/NS_NOINTERFACE/);
Assert.ok(mockRequest.cancelled, "Should have cancelled the request.");
});
/**
* Tests that if the nsIContentPermissionRequest is for a type
* that is not recognized, that NS_ERROR_FAILURE is thrown and
* the request is cancelled.
*/
add_task(function* test_unrecognized_type() {
let mockRequest = new MockContentPermissionRequest([
new MockContentPermissionType("test1"),
]);
- Assert.throws(() => { ContentPermissionPrompt.prompt(mockRequest); },
+ Assert.throws(() => {
+ ContentPermissionPrompt.prompt(mockRequest);
+},
/NS_ERROR_FAILURE/);
Assert.ok(mockRequest.cancelled, "Should have cancelled the request.");
});
/**
* Tests that if we meet the minimal requirements for a
* nsIContentPermissionRequest, that it will be passed to
* ContentPermissionIntegration's createPermissionPrompt
--- a/browser/components/translation/BingTranslator.jsm
+++ b/browser/components/translation/BingTranslator.jsm
@@ -202,17 +202,19 @@ this.BingTranslator.prototype = {
if (root.isSimpleRoot) {
// Workaround for Bing's service problem in which "&" chars in
// plain-text TranslationItems are double-escaped.
result = result.replace(/&/g, "&");
}
root.parseResult(result);
- } catch (e) { error = true; }
+ } catch (e) {
+ error = true;
+}
}
return !error;
},
/**
* This function will determine what is the data to be used for
* the Nth request we are generating, based on the input params.
--- a/browser/components/translation/YandexTranslator.jsm
+++ b/browser/components/translation/YandexTranslator.jsm
@@ -210,17 +210,19 @@ this.YandexTranslator.prototype = {
}
let error = false;
for (let i = 0; i < len; i++) {
try {
let result = results[i];
let root = yandexRequest.translationData[i][0];
root.parseResult(result);
- } catch (e) { error = true; }
+ } catch (e) {
+ error = true;
+}
}
return !error;
},
/**
* This function will determine what is the data to be used for
* the Nth request we are generating, based on the input params.
--- a/browser/components/translation/test/browser_translation_infobar.js
+++ b/browser/components/translation/test/browser_translation_infobar.js
@@ -24,17 +24,19 @@ function waitForCondition(condition, nex
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;
}, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
+ var moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
var TranslationStub = {
translate(aFrom, aTo) {
this.state = Translation.STATE_TRANSLATING;
this.translatedFrom = aFrom;
this.translatedTo = aTo;
},
--- a/browser/components/uitour/test/browser_UITour_defaultBrowser.js
+++ b/browser/components/uitour/test/browser_UITour_defaultBrowser.js
@@ -7,17 +7,19 @@ var setDefaultBrowserCalled = false;
Cc["@mozilla.org/moz/jssubscript-loader;1"]
.getService(Ci.mozIJSSubScriptLoader)
.loadSubScript("chrome://mochikit/content/tests/SimpleTest/MockObjects.js", this);
function MockShellService() {}
MockShellService.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIShellService]),
- isDefaultBrowser(aStartupCheck, aForAllTypes) { return false; },
+ isDefaultBrowser(aStartupCheck, aForAllTypes) {
+ return false;
+},
setDefaultBrowser(aClaimAllTypes, aForAllUsers) {
setDefaultBrowserCalled = true;
},
shouldCheckDefaultBrowser: false,
canSetDesktopBackground: false,
BACKGROUND_TILE : 1,
BACKGROUND_STRETCH : 2,
BACKGROUND_CENTER : 3,
--- a/browser/components/uitour/test/browser_UITour_modalDialog.js
+++ b/browser/components/uitour/test/browser_UITour_modalDialog.js
@@ -21,17 +21,19 @@ function startCallbackTimer() {
}
var observer = SpecialPowers.wrapCallbackObject({
QueryInterface(iid) {
const interfaces = [Ci.nsIObserver,
Ci.nsISupports, Ci.nsISupportsWeakReference];
- if (!interfaces.some( function(v) { return iid.equals(v) } ))
+ if (!interfaces.some( function(v) {
+ return iid.equals(v)
+} ))
throw SpecialPowers.Components.results.NS_ERROR_NO_INTERFACE;
return this;
},
observe(subject, topic, data) {
var doc = getDialogDoc();
if (doc)
handleDialog(doc);
--- a/browser/experiments/test/xpcshell/test_cacherace.js
+++ b/browser/experiments/test/xpcshell/test_cacherace.js
@@ -51,18 +51,22 @@ add_task(function* test_setup() {
let Experiments = ExperimentsScope.Experiments;
gPolicy = new Experiments.Policy();
patchPolicy(gPolicy, {
updatechannel: () => "nightly",
delayCacheWrite: (promise) => {
return new Promise((resolve, reject) => {
promise.then(
- (result) => { setTimeout(() => resolve(result), 500); },
- (err) => { reject(err); }
+ (result) => {
+ setTimeout(() => resolve(result), 500);
+},
+ (err) => {
+ reject(err);
+}
);
});
},
});
let now = new Date(2014, 5, 1, 12);
defineNow(gPolicy, now);
--- a/browser/extensions/pocket/content/Pocket.jsm
+++ b/browser/extensions/pocket/content/Pocket.jsm
@@ -11,18 +11,22 @@ Cu.import("resource://gre/modules/XPCOMU
Cu.import("resource://gre/modules/Services.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "CustomizableUI",
"resource:///modules/CustomizableUI.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "ReaderMode",
"resource://gre/modules/ReaderMode.jsm");
var Pocket = {
- get site() { return Services.prefs.getCharPref("extensions.pocket.site"); },
- get listURL() { return "https://" + Pocket.site + "/?src=ff_ext"; },
+ get site() {
+ return Services.prefs.getCharPref("extensions.pocket.site");
+},
+ get listURL() {
+ return "https://" + Pocket.site + "/?src=ff_ext";
+},
/**
* Functions related to the Pocket panel UI.
*/
onPanelViewShowing(event) {
let document = event.target.ownerDocument;
let window = document.defaultView;
let iframe = window.pktUI.getPanelFrame();
--- a/browser/extensions/pocket/content/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -625,20 +625,24 @@ var pktUIMessaging = (function() {
}, false, true);
}
/**
* Send a message to the panel's iframe
*/
function sendMessageToPanel(panelId, messageId, payload) {
- if (!isPanelIdValid(panelId)) { return; }
+ if (!isPanelIdValid(panelId)) {
+ return;
+}
var panelFrame = pktUI.getPanelFrame();
- if (!isPocketPanelFrameValid(panelFrame)) { return; }
+ if (!isPocketPanelFrameValid(panelFrame)) {
+ return;
+}
var doc = panelFrame.contentWindow.document;
var documentElement = doc.documentElement;
// Send message to panel
var panelMessageId = prefixedMessageId(panelId + '_' + messageId);
var AnswerEvt = doc.createElement("PKTMessage");
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -96,41 +96,53 @@ var tasksCfg = [
* args - Command line args to invoke the task.
* iconIndex - Optional win icon index into the main application for the
* list item.
* open - Boolean indicates if the command should be visible after the browser opens.
* close - Boolean indicates if the command should be visible after the browser closes.
*/
// Open new tab
{
- get title() { return _getString("taskbar.tasks.newTab.label"); },
- get description() { return _getString("taskbar.tasks.newTab.description"); },
+ get title() {
+ return _getString("taskbar.tasks.newTab.label");
+},
+ get description() {
+ return _getString("taskbar.tasks.newTab.description");
+},
args: "-new-tab about:blank",
iconIndex: 3, // New window icon
open: true,
close: true, // The jump list already has an app launch icon, but
// we don't always update the list on shutdown.
// Thus true for consistency.
},
// Open new window
{
- get title() { return _getString("taskbar.tasks.newWindow.label"); },
- get description() { return _getString("taskbar.tasks.newWindow.description"); },
+ get title() {
+ return _getString("taskbar.tasks.newWindow.label");
+},
+ get description() {
+ return _getString("taskbar.tasks.newWindow.description");
+},
args: "-browser",
iconIndex: 2, // New tab icon
open: true,
close: true, // No point, but we don't always update the list on
// shutdown. Thus true for consistency.
},
// Open new private window
{
- get title() { return _getString("taskbar.tasks.newPrivateWindow.label"); },
- get description() { return _getString("taskbar.tasks.newPrivateWindow.description"); },
+ get title() {
+ return _getString("taskbar.tasks.newPrivateWindow.label");
+},
+ get description() {
+ return _getString("taskbar.tasks.newPrivateWindow.description");
+},
args: "-private-window",
iconIndex: 4, // Private browsing mode icon
open: true,
close: true, // No point, but we don't always update the list on
// shutdown. Thus true for consistency.
},
];
--- a/browser/modules/test/browser_BrowserUITelemetry_syncedtabs.js
+++ b/browser/modules/test/browser_BrowserUITelemetry_syncedtabs.js
@@ -2,17 +2,19 @@
"use strict";
const { BrowserUITelemetry: BUIT } = Cu.import("resource:///modules/BrowserUITelemetry.jsm", {});
const {SyncedTabs} = Cu.import("resource://services-sync/SyncedTabs.jsm", {});
function mockSyncedTabs() {
// Mock SyncedTabs.jsm
let mockedInternal = {
- get isConfiguredToSyncTabs() { return true; },
+ get isConfiguredToSyncTabs() {
+ return true;
+},
getTabClients() {
return Promise.resolve([
{
id: "guid_desktop",
type: "client",
name: "My Desktop",
tabs: [
{
--- a/browser/modules/test/browser_UsageTelemetry_searchbar.js
+++ b/browser/modules/test/browser_UsageTelemetry_searchbar.js
@@ -151,18 +151,22 @@ add_task(function* test_suggestion() {
Services.telemetry.clearEvents();
let search_hist = getSearchCountsHistogram();
// Create an engine to generate search suggestions and add it as default
// for this test.
const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml";
let suggestionEngine = yield new Promise((resolve, reject) => {
Services.search.addEngine(url, null, "", false, {
- onSuccess(engine) { resolve(engine) },
- onError() { reject() }
+ onSuccess(engine) {
+ resolve(engine)
+},
+ onError() {
+ reject()
+}
});
});
let previousEngine = Services.search.currentEngine;
Services.search.currentEngine = suggestionEngine;
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
--- a/browser/modules/test/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser_UsageTelemetry_urlbar.js
@@ -244,18 +244,22 @@ add_task(function* test_suggestion() {
let search_hist = getSearchCountsHistogram();
// Create an engine to generate search suggestions and add it as default
// for this test.
const url = getRootDirectory(gTestPath) + "usageTelemetrySearchSuggestions.xml";
let suggestionEngine = yield new Promise((resolve, reject) => {
Services.search.addEngine(url, null, "", false, {
- onSuccess(engine) { resolve(engine) },
- onError() { reject() }
+ onSuccess(engine) {
+ resolve(engine)
+},
+ onError() {
+ reject()
+}
});
});
let previousEngine = Services.search.currentEngine;
Services.search.currentEngine = suggestionEngine;
let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:blank");
--- a/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
+++ b/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
@@ -162,17 +162,19 @@ function fetchData() {
}
function readJsonFile(jsonFile = DIRECTORY_LINKS_FILE) {
let decoder = new TextDecoder();
let directoryLinksFilePath = OS.Path.join(OS.Constants.Path.localProfileDir, jsonFile);
return OS.File.read(directoryLinksFilePath).then(array => {
let json = decoder.decode(array);
return JSON.parse(json);
- }, () => { return "" });
+ }, () => {
+ return ""
+});
}
function cleanJsonFile(jsonFile = DIRECTORY_LINKS_FILE) {
let directoryLinksFilePath = OS.Path.join(OS.Constants.Path.localProfileDir, jsonFile);
return OS.File.remove(directoryLinksFilePath);
}
function LinksChangeObserver() {
@@ -1430,17 +1432,19 @@ add_task(function* test_DirectoryLinksPr
// exhaust daily views
DirectoryLinksProvider._addFrequencyCapView("1")
do_check_true(DirectoryLinksProvider._testFrequencyCapLimits("1"));
DirectoryLinksProvider._addFrequencyCapView("1")
do_check_false(DirectoryLinksProvider._testFrequencyCapLimits("1"));
// now step into the furture
let _wasTodayOrig = DirectoryLinksProvider._wasToday;
- DirectoryLinksProvider._wasToday = function() { return false; }
+ DirectoryLinksProvider._wasToday = function() {
+ return false;
+}
// exhaust total views
DirectoryLinksProvider._addFrequencyCapView("1")
do_check_true(DirectoryLinksProvider._testFrequencyCapLimits("1"));
DirectoryLinksProvider._addFrequencyCapView("1")
// reached totalViews 4, should return false
do_check_false(DirectoryLinksProvider._testFrequencyCapLimits("1"));
// add more views by updating configuration
@@ -1479,17 +1483,19 @@ add_task(function* test_DirectoryLinksPr
do_check_true(DirectoryLinksProvider._testFrequencyCapLimits("bar.com"));
// report site action
yield DirectoryLinksProvider.reportSitesAction([{
link: {
targetedSite: "foo.com",
url: "bar.com"
},
- isPinned() { return false; },
+ isPinned() {
+ return false;
+},
}], "view", 0);
// read file content and ensure that view counters are updated
let data = yield readJsonFile(DirectoryLinksProvider._frequencyCapFilePath);
do_check_eq(data["bar.com"].dailyViews, 1);
do_check_eq(data["bar.com"].totalViews, 1);
yield promiseCleanDirectoryLinksProvider();
@@ -1523,19 +1529,23 @@ add_task(function* test_DirectoryLinksPr
uri: NetUtil.newURI(landingUrl),
title: "HELLO",
visits: [{
visitDate: Date.now() * 1000,
transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
},
{
- handleError() { do_check_true(false); },
+ handleError() {
+ do_check_true(false);
+},
handleResult() {},
- handleCompletion() { resolve(); }
+ handleCompletion() {
+ resolve();
+}
}
);
});
function UrlDeletionTester() {
this.promise = new Promise(resolve => {
this.onDeleteURI = (directoryLinksProvider, link) => {
resolve();
@@ -1819,17 +1829,19 @@ add_task(function* test_blockSuggestedTi
});
// ensure that tile is suggested
let suggestedLink = DirectoryLinksProvider._updateSuggestedTile();
do_check_true(suggestedLink.frecent_sites);
// block suggested tile in a regular way
DirectoryLinksProvider.reportSitesAction([{
- isPinned() { return false; },
+ isPinned() {
+ return false;
+},
link: Object.assign({frecency: 1000}, suggestedLink)
}], "block", 0);
// suggested tile still must be recommended
suggestedLink = DirectoryLinksProvider._updateSuggestedTile();
do_check_true(suggestedLink.frecent_sites);
// timestamp suggested_block in the frequency cap object
--- a/storage/test/unit/head_storage.js
+++ b/storage/test/unit/head_storage.js
@@ -40,17 +40,19 @@ function getFakeDB() {
/**
* Delete the test database file.
*/
function deleteTestDB() {
print("*** Storage Tests: Trying to remove file!");
var dbFile = getTestDB();
if (dbFile.exists())
- try { dbFile.remove(false); } catch (e) { /* stupid windows box */ }
+ try {
+ dbFile.remove(false);
+} catch (e) { /* stupid windows box */ }
}
function cleanup() {
// close the connection
print("*** Storage Tests: Trying to close!");
getOpenedDatabase().close();
// we need to null out the database variable to get a new connection the next
@@ -65,17 +67,19 @@ function cleanup() {
* Use asyncClose to cleanup a connection. Synchronous by means of internally
* spinning an event loop.
*/
function asyncCleanup() {
let closed = false;
// close the connection
print("*** Storage Tests: Trying to asyncClose!");
- getOpenedDatabase().asyncClose(function() { closed = true; });
+ getOpenedDatabase().asyncClose(function() {
+ closed = true;
+});
let curThread = Components.classes["@mozilla.org/thread-manager;1"]
.getService().currentThread;
while (!closed)
curThread.processNextEvent(true);
// we need to null out the database variable to get a new connection the next
// time getOpenedDatabase is called
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -9,17 +9,17 @@ module.exports = {
// Require spacing around =>
"arrow-spacing": "error",
// Always require spacing around a single line block
"block-spacing": "error",
// No newline before open brace for a block
- "brace-style": ["error", "1tbs", { "allowSingleLine": true }],
+ "brace-style": ["error", "1tbs", { "allowSingleLine": false }],
// No space before always a space after a comma
"comma-spacing": ["error", {"before": false, "after": true}],
// Commas at the end of the line not the start
// "comma-style": "error",
// Don't require spaces around computed properties
--- a/toolkit/components/aboutcache/content/aboutCache.js
+++ b/toolkit/components/aboutcache/content/aboutCache.js
@@ -11,17 +11,19 @@ var cacheContext = searchParams.get('con
// The context is in a format as used by the HTTP cache v2 back end
if (cacheContext)
var [context, isAnon, isInBrowser, appId, isPrivate] = cacheContext.match(/(a,)?(b,)?(i\d+,)?(p,)?/);
if (appId)
appId = appId.match(/i(\d+),/)[1];
-function $(id) { return document.getElementById(id) || {}; }
+function $(id) {
+ return document.getElementById(id) || {};
+}
// Initialize the context UI controls at the start according what we got in the "context=" argument
addEventListener('DOMContentLoaded', function() {
$('anon').checked = !!isAnon;
$('inbrowser').checked = !!isInBrowser;
$('appid').value = appId || '';
$('priv').checked = !!isPrivate;
}, false);
--- a/toolkit/components/aboutmemory/content/aboutMemory.js
+++ b/toolkit/components/aboutmemory/content/aboutMemory.js
@@ -607,18 +607,22 @@ function updateAboutMemoryFromJSONString
* @param aFn
* The function to call and pass the read string to upon completion.
*/
function loadMemoryReportsFromFile(aFilename, aTitleNote, aFn) {
updateMainAndFooter("Loading...", HIDE_FOOTER);
try {
let reader = new FileReader();
- reader.onerror = () => { throw new Error("FileReader.onerror"); };
- reader.onabort = () => { throw new Error("FileReader.onabort"); };
+ reader.onerror = () => {
+ throw new Error("FileReader.onerror");
+};
+ reader.onabort = () => {
+ throw new Error("FileReader.onabort");
+};
reader.onload = (aEvent) => {
// Clear "Loading..." from above.
updateTitleMainAndFooter(aTitleNote, "", SHOW_FOOTER);
aFn(aEvent.target.result);
};
// If it doesn't have a .gz suffix, read it as a (legacy) ungzipped file.
if (!aFilename.endsWith(".gz")) {
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -127,17 +127,19 @@ let tabFinder = {
* In mochi tests, it's possible for this to be called after the
* about:performance window has been torn down, which causes `setTimeout` to
* throw an NS_ERROR_NOT_INITIALIZED exception. In that case, returning
* `undefined` is fine.
*/
function wait(ms = 0) {
try {
let resolve;
- let p = new Promise(resolve_ => { resolve = resolve_ });
+ let p = new Promise(resolve_ => {
+ resolve = resolve_
+});
setTimeout(resolve, ms);
return p;
} catch (e) {
dump("WARNING: wait aborted because of an invalid Window state in aboutPerformance.js.\n");
return undefined;
}
}
--- a/toolkit/components/addoncompat/RemoteAddonsParent.jsm
+++ b/toolkit/components/addoncompat/RemoteAddonsParent.jsm
@@ -239,17 +239,19 @@ var AboutProtocolParent = {
}
},
// We immediately read all the data out of the channel here and
// return it to the child.
openChannel(msg) {
function wrapGetInterface(cpow) {
return {
- getInterface(intf) { return cpow.getInterface(intf); }
+ getInterface(intf) {
+ return cpow.getInterface(intf);
+}
};
}
let uri = BrowserUtils.makeURI(msg.data.uri);
let channelParams;
if (msg.data.contentPolicyType === Ci.nsIContentPolicy.TYPE_DOCUMENT) {
// For TYPE_DOCUMENT loads, we cannot recreate the loadinfo here in the
// parent. In that case, treat this as a chrome (addon)-requested
--- a/toolkit/components/addoncompat/multiprocessShims.js
+++ b/toolkit/components/addoncompat/multiprocessShims.js
@@ -154,20 +154,24 @@ AddonInterpositionService.prototype = {
if ("methods" in interp && prop in interp.methods) {
desc.writable = false;
desc.value = function(...args) {
return interp.methods[prop](addon, target, ...args);
}
return desc;
} else if ("getters" in interp && prop in interp.getters) {
- desc.get = function() { return interp.getters[prop](addon, target); };
+ desc.get = function() {
+ return interp.getters[prop](addon, target);
+};
if ("setters" in interp && prop in interp.setters) {
- desc.set = function(v) { return interp.setters[prop](addon, target, v); };
+ desc.set = function(v) {
+ return interp.setters[prop](addon, target, v);
+};
}
return desc;
}
return Prefetcher.lookupInCache(addon, target, prop);
},
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -160,22 +160,26 @@ function onAlertLoad() {
if (gReplacedWindow && !gReplacedWindow.closed) {
moveWindowToReplace(gReplacedWindow);
gReplacedWindow.gIsReplaced = true;
gReplacedWindow.close();
} else {
moveWindowToEnd();
}
- window.addEventListener("XULAlertClose", function() { window.close(); });
+ window.addEventListener("XULAlertClose", function() {
+ window.close();
+});
// If the require interaction flag is set, prevent auto-closing the notification.
if (!gRequireInteraction) {
if (Services.prefs.getBoolPref("alerts.disableSlidingEffect")) {
- setTimeout(function() { window.close(); }, ALERT_DURATION_IMMEDIATE);
+ setTimeout(function() {
+ window.close();
+}, ALERT_DURATION_IMMEDIATE);
} else {
let alertBox = document.getElementById("alertBox");
alertBox.addEventListener("animationend", function hideAlert(event) {
if (event.animationName == "alert-animation" ||
event.animationName == "alert-clicked-animation" ||
event.animationName == "alert-closing-animation") {
alertBox.removeEventListener("animationend", hideAlert, false);
window.close();
--- a/toolkit/components/autocomplete/tests/unit/test_stopSearch.js
+++ b/toolkit/components/autocomplete/tests/unit/test_stopSearch.js
@@ -23,29 +23,41 @@ function AutoCompleteInput(aSearches) {
AutoCompleteInput.prototype = {
constructor: AutoCompleteInput,
minResultsForPopup: 0,
timeout: 10,
searchParam: "",
textValue: "hello",
disableAutoComplete: false,
completeDefaultIndex: false,
- set popupOpen(val) { return val; }, // ignore
- get popupOpen() { return false; },
- get searchCount() { return this.searches.length; },
- getSearchAt(aIndex) { return this.searches[aIndex]; },
+ set popupOpen(val) {
+ return val;
+}, // ignore
+ get popupOpen() {
+ return false;
+},
+ get searchCount() {
+ return this.searches.length;
+},
+ getSearchAt(aIndex) {
+ return this.searches[aIndex];
+},
onSearchBegin() {},
onSearchComplete() {},
onTextReverted() {},
onTextEntered() {},
popup: {
selectBy() {},
invalidate() {},
- set selectedIndex(val) { return val; }, // ignore
- get selectedIndex() { return -1 },
+ set selectedIndex(val) {
+ return val;
+}, // ignore
+ get selectedIndex() {
+ return -1
+},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup])
},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput])
}
/**
* nsIAutoCompleteSearch implementation.
--- a/toolkit/components/captivedetect/captivedetect.js
+++ b/toolkit/components/captivedetect/captivedetect.js
@@ -41,18 +41,22 @@ function URLFetcher(url, timeout) {
// final destination. It does not help if a resource is already
// cached locally.
xhr.setRequestHeader("Cache-Control", "no-cache");
// HTTP/1.0 servers might not implement Cache-Control and
// might only implement Pragma: no-cache
xhr.setRequestHeader("Pragma", "no-cache");
xhr.timeout = timeout;
- xhr.ontimeout = function() { self.ontimeout(); };
- xhr.onerror = function() { self.onerror(); };
+ xhr.ontimeout = function() {
+ self.ontimeout();
+};
+ xhr.onerror = function() {
+ self.onerror();
+};
xhr.onreadystatechange = function(oEvent) {
if (xhr.readyState === 4) {
if (self._isAborted) {
return;
}
if (xhr.status === 200) {
self.onsuccess(xhr.responseText);
} else if (xhr.status) {
--- a/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
+++ b/toolkit/components/captivedetect/test/unit/test_captive_portal_not_found.js
@@ -35,17 +35,19 @@ function test_portal_not_found() {
prepare: function prepare() {
do_check_eq(++step, 1);
gCaptivePortalDetector.finishPreparation(kInterfaceName);
},
complete: function complete(success) {
do_check_eq(++step, 2);
do_check_true(success);
do_check_eq(attempt, 1);
- gServer.stop(function() { dump('server stop\n'); do_test_finished(); });
+ gServer.stop(function() {
+ dump('server stop\n'); do_test_finished();
+});
}
};
gCaptivePortalDetector.checkCaptivePortal(kInterfaceName, callback);
}
function run_test() {
run_captivedetect_test(xhr_handler, fakeUIResponse, test_portal_not_found);
--- a/toolkit/components/contentprefs/nsContentPrefService.js
+++ b/toolkit/components/contentprefs/nsContentPrefService.js
@@ -217,17 +217,19 @@ ContentPrefService.prototype = {
Cr.NS_ERROR_ILLEGAL_VALUE);
var group = this._parseGroupParam(aGroup);
if (aContext && aContext.usePrivateBrowsing) {
if (this._privModeStorage.has(group, aName)) {
let value = this._privModeStorage.get(group, aName);
if (aCallback) {
- this._scheduleCallback(function() { aCallback.onResult(value); });
+ this._scheduleCallback(function() {
+ aCallback.onResult(value);
+});
return undefined;
}
return value;
}
// if we don't have a pref specific to this private mode browsing
// session, to try to get one from normal mode
}
@@ -577,17 +579,19 @@ ContentPrefService.prototype = {
tm.mainThread.dispatch(func, Ci.nsIThread.DISPATCH_NORMAL);
},
_selectPref: function ContentPrefService__selectPref(aGroup, aSetting, aCallback) {
let value = undefined;
if (this._cache.has(aGroup, aSetting)) {
value = this._cache.get(aGroup, aSetting);
if (aCallback) {
- this._scheduleCallback(function() { aCallback.onResult(value); });
+ this._scheduleCallback(function() {
+ aCallback.onResult(value);
+});
return undefined;
}
return value;
}
try {
this._stmtSelectPref.params.group = aGroup;
this._stmtSelectPref.params.setting = aSetting;
@@ -625,17 +629,19 @@ ContentPrefService.prototype = {
return this.__stmtSelectGlobalPref;
},
_selectGlobalPref: function ContentPrefService__selectGlobalPref(aName, aCallback) {
let value = undefined;
if (this._cache.has(null, aName)) {
value = this._cache.get(null, aName);
if (aCallback) {
- this._scheduleCallback(function() { aCallback.onResult(value); });
+ this._scheduleCallback(function() {
+ aCallback.onResult(value);
+});
return undefined;
}
return value;
}
try {
this._stmtSelectGlobalPref.params.name = aName;
@@ -1125,17 +1131,19 @@ ContentPrefService.prototype = {
_dbBackUpAndRecreate: function ContentPrefService__dbBackUpAndRecreate(aDBService,
aDBFile,
aDBConnection) {
aDBService.backupDatabaseFile(aDBFile, "content-prefs.sqlite.corrupt");
// Close the database, ignoring the "already closed" exception, if any.
// It'll be open if we're here because of a migration failure but closed
// if we're here because of database corruption.
- try { aDBConnection.close() } catch (ex) {}
+ try {
+ aDBConnection.close()
+} catch (ex) {}
aDBFile.remove(false);
let dbConnection = this._dbCreate(aDBService, aDBFile);
return dbConnection;
},
--- a/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
+++ b/toolkit/components/contentprefs/tests/unit/head_contentPrefs.js
@@ -43,17 +43,19 @@ var ContentPrefTest = {
},
// nsISupports
interfaces: [Ci.nsIDirectoryServiceProvider, Ci.nsISupports],
QueryInterface: function ContentPrefTest_QueryInterface(iid) {
- if (!this.interfaces.some( function(v) { return iid.equals(v) } ))
+ if (!this.interfaces.some( function(v) {
+ return iid.equals(v)
+} ))
throw Cr.NS_ERROR_NO_INTERFACE;
return this;
},
// nsIDirectoryServiceProvider
getFile: function ContentPrefTest_getFile(property, persistent) {
@@ -99,17 +101,19 @@ var ContentPrefTest = {
* Delete the content pref service's persistent datastore. We do this before
* and after running tests to make sure we start from scratch each time. We
* also do it during the database creation, schema migration, and backup tests.
*/
deleteDatabase: function ContentPrefTest_deleteDatabase() {
var file = this.getProfileDir();
file.append(CONTENT_PREFS_DB_FILENAME);
if (file.exists())
- try { file.remove(false); } catch (e) { /* stupid windows box */ }
+ try {
+ file.remove(false);
+} catch (e) { /* stupid windows box */ }
return file;
},
/**
* Delete the backup of the content pref service's persistent datastore.
* We do this during the database creation, schema migration, and backup tests.
*/
deleteBackupDatabase: function ContentPrefTest_deleteBackupDatabase() {
--- a/toolkit/components/contentprefs/tests/unit/test_bug248970.js
+++ b/toolkit/components/contentprefs/tests/unit/test_bug248970.js
@@ -1,14 +1,16 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
function run_test() {
- let loadContext = { get usePrivateBrowsing() { return gInPrivateBrowsing; } };
+ let loadContext = { get usePrivateBrowsing() {
+ return gInPrivateBrowsing;
+} };
ContentPrefTest.deleteDatabase();
var cp = new ContentPrefInstance(loadContext);
do_check_neq(cp, null, "Retrieving the content prefs service failed");
try {
const uri1 = ContentPrefTest.getURI("http://www.example.com/");
const uri2 = ContentPrefTest.getURI("http://www.anotherexample.com/");
--- a/toolkit/components/contentprefs/tests/unit/test_bug503971.js
+++ b/toolkit/components/contentprefs/tests/unit/test_bug503971.js
@@ -2,29 +2,53 @@
* 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/. */
function run_test() {
var cps = new ContentPrefInstance(null);
var uri = ContentPrefTest.getURI("http://www.example.com/");
- do_check_thrown(function() { cps.setPref(uri, null, 8); });
- do_check_thrown(function() { cps.hasPref(uri, null); });
- do_check_thrown(function() { cps.getPref(uri, null); });
- do_check_thrown(function() { cps.removePref(uri, null); });
- do_check_thrown(function() { cps.getPrefsByName(null); });
- do_check_thrown(function() { cps.removePrefsByName(null); });
+ do_check_thrown(function() {
+ cps.setPref(uri, null, 8);
+});
+ do_check_thrown(function() {
+ cps.hasPref(uri, null);
+});
+ do_check_thrown(function() {
+ cps.getPref(uri, null);
+});
+ do_check_thrown(function() {
+ cps.removePref(uri, null);
+});
+ do_check_thrown(function() {
+ cps.getPrefsByName(null);
+});
+ do_check_thrown(function() {
+ cps.removePrefsByName(null);
+});
- do_check_thrown(function() { cps.setPref(uri, "", 21); });
- do_check_thrown(function() { cps.hasPref(uri, ""); });
- do_check_thrown(function() { cps.getPref(uri, ""); });
- do_check_thrown(function() { cps.removePref(uri, ""); });
- do_check_thrown(function() { cps.getPrefsByName(""); });
- do_check_thrown(function() { cps.removePrefsByName(""); });
+ do_check_thrown(function() {
+ cps.setPref(uri, "", 21);
+});
+ do_check_thrown(function() {
+ cps.hasPref(uri, "");
+});
+ do_check_thrown(function() {
+ cps.getPref(uri, "");
+});
+ do_check_thrown(function() {
+ cps.removePref(uri, "");
+});
+ do_check_thrown(function() {
+ cps.getPrefsByName("");
+});
+ do_check_thrown(function() {
+ cps.removePrefsByName("");
+});
}
function do_check_thrown(aCallback) {
var exThrown = false;
try {
aCallback();
do_throw("NS_ERROR_ILLEGAL_VALUE should have been thrown here");
} catch (e) {
--- a/toolkit/components/contentprefs/tests/unit/test_bug679784.js
+++ b/toolkit/components/contentprefs/tests/unit/test_bug679784.js
@@ -10,17 +10,19 @@ var prefObserver = {
},
removedCalledNum: 0,
onContentPrefRemoved(aGroup, aName) {
this.removedCalledNum++;
}
};
function run_test() {
- let loadContext = { get usePrivateBrowsing() { return gInPrivateBrowsing; } };
+ let loadContext = { get usePrivateBrowsing() {
+ return gInPrivateBrowsing;
+} };
var cps = new ContentPrefInstance(loadContext);
cps.removeGroupedPrefs();
var uri = ContentPrefTest.getURI("http://www.example.com/");
var group = cps.grouper.group(uri);
// first, set a pref in normal mode
--- a/toolkit/components/contentprefs/tests/unit/test_contentPrefs.js
+++ b/toolkit/components/contentprefs/tests/unit/test_contentPrefs.js
@@ -227,17 +227,19 @@ function run_test() {
}
// Observers
var specificObserver = {
interfaces: [Ci.nsIContentPrefObserver, Ci.nsISupports],
QueryInterface: function ContentPrefTest_QueryInterface(iid) {
- if (!this.interfaces.some( function(v) { return iid.equals(v) } ))
+ if (!this.interfaces.some( function(v) {
+ return iid.equals(v)
+} ))
throw Cr.NS_ERROR_NO_INTERFACE;
return this;
},
numTimesSetCalled: 0,
onContentPrefSet: function specificObserver_onContentPrefSet(group, name, value) {
++this.numTimesSetCalled;
do_check_eq(group, "www.example.com");
@@ -253,17 +255,19 @@ function run_test() {
}
};
var genericObserver = {
interfaces: [Ci.nsIContentPrefObserver, Ci.nsISupports],
QueryInterface: function ContentPrefTest_QueryInterface(iid) {
- if (!this.interfaces.some( function(v) { return iid.equals(v) } ))
+ if (!this.interfaces.some( function(v) {
+ return iid.equals(v)
+} ))
throw Cr.NS_ERROR_NO_INTERFACE;
return this;
},
numTimesSetCalled: 0,
onContentPrefSet: function genericObserver_onContentPrefSet(group, name, value, isPrivate) {
++this.numTimesSetCalled;
do_check_eq(group, "www.example.com");
@@ -329,17 +333,19 @@ function run_test() {
// Get/Remove Prefs By Name
{
var anObserver = {
interfaces: [Ci.nsIContentPrefObserver, Ci.nsISupports],
QueryInterface: function ContentPrefTest_QueryInterface(iid) {
- if (!this.interfaces.some( function(v) { return iid.equals(v) } ))
+ if (!this.interfaces.some( function(v) {
+ return iid.equals(v)
+} ))
throw Cr.NS_ERROR_NO_INTERFACE;
return this;
},
onContentPrefSet: function anObserver_onContentPrefSet(group, name, value) {
},
expectedDomains: [],
--- a/toolkit/components/contentprefs/tests/unit/test_stringGroups.js
+++ b/toolkit/components/contentprefs/tests/unit/test_stringGroups.js
@@ -18,21 +18,31 @@ function run_test() {
var stringObjectURI = new String("www.example.com"); // typeof = "object"
// First check that all the methods work or don't work.
function simple_test_methods(aGroup, shouldThrow) {
var prefName = "test.pref.0";
var prefValue = Math.floor(Math.random() * 100);
if (shouldThrow) {
- do_check_thrown(function() { cps.getPref(aGroup, prefName); });
- do_check_thrown(function() { cps.setPref(aGroup, prefName, prefValue); });
- do_check_thrown(function() { cps.hasPref(aGroup, prefName); });
- do_check_thrown(function() { cps.removePref(aGroup, prefName); });
- do_check_thrown(function() { cps.getPrefs(aGroup); });
+ do_check_thrown(function() {
+ cps.getPref(aGroup, prefName);
+});
+ do_check_thrown(function() {
+ cps.setPref(aGroup, prefName, prefValue);
+});
+ do_check_thrown(function() {
+ cps.hasPref(aGroup, prefName);
+});
+ do_check_thrown(function() {
+ cps.removePref(aGroup, prefName);
+});
+ do_check_thrown(function() {
+ cps.getPrefs(aGroup);
+});
} else {
do_check_eq(cps.setPref(aGroup, prefName, prefValue), undefined);
do_check_true(cps.hasPref(aGroup, prefName));
do_check_eq(cps.getPref(aGroup, prefName), prefValue);
do_check_eq(cps.removePref(aGroup, prefName), undefined);
do_check_false(cps.hasPref(aGroup, prefName));
}
}
--- a/toolkit/components/crashes/CrashManager.jsm
+++ b/toolkit/components/crashes/CrashManager.jsm
@@ -566,17 +566,19 @@ this.CrashManager.prototype = Object.fre
let entries = [];
for (let dir of this._eventsDirs) {
for (let e of yield this._getDirectoryEntries(dir, this.ALL_REGEX)) {
entries.push(e);
}
}
- entries.sort((a, b) => { return a.date - b.date; });
+ entries.sort((a, b) => {
+ return a.date - b.date;
+});
return entries;
}.bind(this));
},
// See docs/crash-events.rst for the file format specification.
_processEventFile(entry) {
return Task.spawn(function* () {
@@ -752,17 +754,19 @@ this.CrashManager.prototype = Object.fre
date: info.lastModificationDate,
});
});
});
} finally {
it.close();
}
- entries.sort((a, b) => { return a.date - b.date; });
+ entries.sort((a, b) => {
+ return a.date - b.date;
+});
return entries;
});
},
_getStore() {
if (this._getStoreTask) {
return this._getStoreTask;
--- a/toolkit/components/ctypes/tests/unit/test_finalizer_shouldfail.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer_shouldfail.js
@@ -54,29 +54,39 @@ function run_test() {
}
/**
* Testing construction of finalizers with wrong arguments.
*/
function test_finalize_bad_construction() {
// First argument does not match second
- must_throw(function() { ctypes.CDataFinalizer({}, dispose); });
- must_throw(function() { ctypes.CDataFinalizer(dispose, dispose); });
+ must_throw(function() {
+ ctypes.CDataFinalizer({}, dispose);
+});
+ must_throw(function() {
+ ctypes.CDataFinalizer(dispose, dispose);
+});
// Not enough arguments
- must_throw(function() { ctypes.CDataFinalizer(dispose); },
+ must_throw(function() {
+ ctypes.CDataFinalizer(dispose);
+},
"TypeError: CDataFinalizer constructor takes two arguments");
// Too many arguments
- must_throw(function() { ctypes.CDataFinalizer(dispose, dispose, dispose); },
+ must_throw(function() {
+ ctypes.CDataFinalizer(dispose, dispose, dispose);
+},
"TypeError: CDataFinalizer constructor takes two arguments");
// Second argument is null
- must_throw(function() { ctypes.CDataFinalizer(dispose, null); },
+ must_throw(function() {
+ ctypes.CDataFinalizer(dispose, null);
+},
"TypeError: expected _a CData object_ of a function pointer type, got null");
// Second argument is undefined
must_throw(function() {
let a;
ctypes.CDataFinalizer(dispose, a);
},
"TypeError: expected _a CData object_ of a function pointer type, got undefined");
@@ -84,17 +94,19 @@ function test_finalize_bad_construction(
/**
* Test that forget/dispose can only take place once.
*/
function test_double_dispose() {
function test_one_combination(i, a, b) {
let v = ctypes.CDataFinalizer(acquire(i), dispose);
a(v);
- must_throw(function() { b(v); } );
+ must_throw(function() {
+ b(v);
+} );
}
let call_dispose = function(v) {
v.dispose();
};
let call_forget = function(v) {
v.forget();
};
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js
@@ -172,37 +172,45 @@ function run_test() {
run_closure_tests(library);
run_variadic_tests(library);
run_static_data_tests(library);
run_cpp_class_tests(library);
// test library.close
let test_void_t = library.declare("test_void_t_cdecl", ctypes.default_abi, ctypes.void_t);
library.close();
- do_check_throws(function() { test_void_t(); }, Error);
+ do_check_throws(function() {
+ test_void_t();
+}, Error);
do_check_throws(function() {
library.declare("test_void_t_cdecl", ctypes.default_abi, ctypes.void_t);
}, Error);
// test that library functions throw when bound to other objects
library = ctypes.open(libfile.path);
let obj = {};
obj.declare = library.declare;
- do_check_throws(function() { run_void_tests(obj); }, Error);
+ do_check_throws(function() {
+ run_void_tests(obj);
+}, Error);
obj.close = library.close;
- do_check_throws(function() { obj.close(); }, Error);
+ do_check_throws(function() {
+ obj.close();
+}, Error);
// test that functions work as properties of other objects
let getter = library.declare("get_int8_t_cdecl", ctypes.default_abi, ctypes.int8_t);
do_check_eq(getter(), 109);
obj.t = getter;
do_check_eq(obj.t(), 109);
// bug 521937
- do_check_throws(function() { let nolib = ctypes.open("notfoundlibrary.dll"); nolib.close(); }, Error);
+ do_check_throws(function() {
+ let nolib = ctypes.open("notfoundlibrary.dll"); nolib.close();
+}, Error);
// bug 522360
do_check_eq(run_load_system_library(), true);
// Test loading a library with a unicode name (bug 589413). Note that nsIFile
// implementations are not available in some harnesses; if not, the harness
// should take care of the copy for us.
let unicodefile = do_get_file(CTYPES_UNICODE_LIB, true);
@@ -213,115 +221,159 @@ function run_test() {
run_void_tests(library);
library.close();
if (copy)
unicodefile.remove(false);
}
function run_abstract_class_tests() {
// Test that ctypes.CType is an abstract constructor that throws.
- do_check_throws(function() { ctypes.CType(); }, TypeError);
- do_check_throws(function() { new ctypes.CType() }, TypeError);
+ do_check_throws(function() {
+ ctypes.CType();
+}, TypeError);
+ do_check_throws(function() {
+ new ctypes.CType()
+}, TypeError);
do_check_true(ctypes.CType.hasOwnProperty("prototype"));
- do_check_throws(function() { ctypes.CType.prototype(); }, TypeError);
- do_check_throws(function() { new ctypes.CType.prototype() }, TypeError);
+ do_check_throws(function() {
+ ctypes.CType.prototype();
+}, TypeError);
+ do_check_throws(function() {
+ new ctypes.CType.prototype()
+}, TypeError);
do_check_true(ctypes.CType.prototype.hasOwnProperty("constructor"));
do_check_true(ctypes.CType.prototype.constructor === ctypes.CType);
// Check that ctypes.CType.prototype has the correct properties and functions.
do_check_true(ctypes.CType.prototype.hasOwnProperty("name"));
do_check_true(ctypes.CType.prototype.hasOwnProperty("size"));
do_check_true(ctypes.CType.prototype.hasOwnProperty("ptr"));
do_check_true(ctypes.CType.prototype.hasOwnProperty("array"));
do_check_true(ctypes.CType.prototype.hasOwnProperty("toString"));
do_check_true(ctypes.CType.prototype.hasOwnProperty("toSource"));
// Make sure we can access 'prototype' on a CTypeProto.
do_check_true(ctypes.CType.prototype.prototype === ctypes.CData.prototype);
// Check that the shared properties and functions on ctypes.CType.prototype throw.
- do_check_throws(function() { ctypes.CType.prototype.name; }, TypeError);
- do_check_throws(function() { ctypes.CType.prototype.size; }, TypeError);
- do_check_throws(function() { ctypes.CType.prototype.ptr; }, TypeError);
- do_check_throws(function() { ctypes.CType.prototype.array(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.CType.prototype.name;
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.CType.prototype.size;
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.CType.prototype.ptr;
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.CType.prototype.array();
+}, TypeError);
// toString and toSource are called by the web console during inspection,
// so we don't want them to throw.
do_check_eq(typeof ctypes.CType.prototype.toString(), 'string');
do_check_eq(typeof ctypes.CType.prototype.toSource(), 'string');
// Test that ctypes.CData is an abstract constructor that throws.
- do_check_throws(function() { ctypes.CData(); }, TypeError);
- do_check_throws(function() { new ctypes.CData() }, TypeError);
+ do_check_throws(function() {
+ ctypes.CData();
+}, TypeError);
+ do_check_throws(function() {
+ new ctypes.CData()
+}, TypeError);
do_check_true(ctypes.CData.__proto__ === ctypes.CType.prototype);
do_check_true(ctypes.CData instanceof ctypes.CType);
do_check_true(ctypes.CData.hasOwnProperty("prototype"));
do_check_true(ctypes.CData.prototype.hasOwnProperty("constructor"));
do_check_true(ctypes.CData.prototype.constructor === ctypes.CData);
// Check that ctypes.CData.prototype has the correct properties and functions.
do_check_true(ctypes.CData.prototype.hasOwnProperty("value"));
do_check_true(ctypes.CData.prototype.hasOwnProperty("address"));
do_check_true(ctypes.CData.prototype.hasOwnProperty("readString"));
do_check_true(ctypes.CData.prototype.hasOwnProperty("toString"));
do_check_true(ctypes.CData.prototype.hasOwnProperty("toSource"));
// Check that the shared properties and functions on ctypes.CData.prototype throw.
- do_check_throws(function() { ctypes.CData.prototype.value; }, TypeError);
- do_check_throws(function() { ctypes.CData.prototype.value = null; }, TypeError);
- do_check_throws(function() { ctypes.CData.prototype.address(); }, TypeError);
- do_check_throws(function() { ctypes.CData.prototype.readString(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.CData.prototype.value;
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.CData.prototype.value = null;
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.CData.prototype.address();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.CData.prototype.readString();
+}, TypeError);
// toString and toSource are called by the web console during inspection,
// so we don't want them to throw.
do_check_eq(ctypes.CData.prototype.toString(), '[CData proto object]');
do_check_eq(ctypes.CData.prototype.toSource(), '[CData proto object]');
}
function run_Int64_tests() {
- do_check_throws(function() { ctypes.Int64(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64();
+}, TypeError);
do_check_true(ctypes.Int64.hasOwnProperty("prototype"));
do_check_true(ctypes.Int64.prototype.hasOwnProperty("constructor"));
do_check_true(ctypes.Int64.prototype.constructor === ctypes.Int64);
// Check that ctypes.Int64 and ctypes.Int64.prototype have the correct
// properties and functions.
do_check_true(ctypes.Int64.hasOwnProperty("compare"));
do_check_true(ctypes.Int64.hasOwnProperty("lo"));
do_check_true(ctypes.Int64.hasOwnProperty("hi"));
do_check_true(ctypes.Int64.hasOwnProperty("join"));
do_check_true(ctypes.Int64.prototype.hasOwnProperty("toString"));
do_check_true(ctypes.Int64.prototype.hasOwnProperty("toSource"));
// Check that the shared functions on ctypes.Int64.prototype throw.
- do_check_throws(function() { ctypes.Int64.prototype.toString(); }, TypeError);
- do_check_throws(function() { ctypes.Int64.prototype.toSource(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.prototype.toString();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.prototype.toSource();
+}, TypeError);
let int64 = ctypes.Int64(0);
do_check_true(int64.__proto__ === ctypes.Int64.prototype);
do_check_true(int64 instanceof ctypes.Int64);
// Test Int64.toString([radix]).
do_check_eq(int64.toString(), "0");
for (let radix = 2; radix <= 36; ++radix)
do_check_eq(int64.toString(radix), "0");
- do_check_throws(function() { int64.toString(0); }, RangeError);
- do_check_throws(function() { int64.toString(1); }, RangeError);
- do_check_throws(function() { int64.toString(37); }, RangeError);
- do_check_throws(function() { int64.toString(10, 2); }, TypeError);
+ do_check_throws(function() {
+ int64.toString(0);
+}, RangeError);
+ do_check_throws(function() {
+ int64.toString(1);
+}, RangeError);
+ do_check_throws(function() {
+ int64.toString(37);
+}, RangeError);
+ do_check_throws(function() {
+ int64.toString(10, 2);
+}, TypeError);
// Test Int64.toSource().
do_check_eq(int64.toSource(), "ctypes.Int64(\"0\")");
- do_check_throws(function() { int64.toSource(10); }, TypeError);
+ do_check_throws(function() {
+ int64.toSource(10);
+}, TypeError);
int64 = ctypes.Int64("0x28590a1c921def71");
do_check_eq(int64.toString(), int64.toString(10));
do_check_eq(int64.toString(10), "2907366152271163249");
do_check_eq(int64.toString(16), "28590a1c921def71");
do_check_eq(int64.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(int64.toSource(), "ctypes.Int64(\"" + int64.toString(10) + "\")");
@@ -405,93 +457,137 @@ function run_Int64_tests() {
do_check_eq(int64.toString(10), "9223372036854775807");
do_check_eq(int64.toString(16), "7fffffffffffffff");
do_check_eq(int64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
let vals = [-0x8000000000001000, 0x8000000000000000,
ctypes.UInt64("0x8000000000000000"),
Infinity, -Infinity, NaN, 0.1,
5.68e21, null, undefined, "", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { ctypes.Int64(vals[i]); }, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64(vals[i]);
+}, TypeError);
vals = ["-0x8000000000000001", "0x8000000000000000"];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { ctypes.Int64(vals[i]); }, RangeError);
+ do_check_throws(function() {
+ ctypes.Int64(vals[i]);
+}, RangeError);
// Test ctypes.Int64.compare.
do_check_eq(ctypes.Int64.compare(ctypes.Int64(5), ctypes.Int64(5)), 0);
do_check_eq(ctypes.Int64.compare(ctypes.Int64(5), ctypes.Int64(4)), 1);
do_check_eq(ctypes.Int64.compare(ctypes.Int64(4), ctypes.Int64(5)), -1);
do_check_eq(ctypes.Int64.compare(ctypes.Int64(-5), ctypes.Int64(-5)), 0);
do_check_eq(ctypes.Int64.compare(ctypes.Int64(-5), ctypes.Int64(-4)), -1);
do_check_eq(ctypes.Int64.compare(ctypes.Int64(-4), ctypes.Int64(-5)), 1);
- do_check_throws(function() { ctypes.Int64.compare(ctypes.Int64(4), ctypes.UInt64(4)); }, TypeError);
- do_check_throws(function() { ctypes.Int64.compare(4, 5); }, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.compare(ctypes.Int64(4), ctypes.UInt64(4));
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.compare(4, 5);
+}, TypeError);
// Test ctypes.Int64.{lo,hi}.
do_check_eq(ctypes.Int64.lo(ctypes.Int64(0x28590a1c921de000)), 0x921de000);
do_check_eq(ctypes.Int64.hi(ctypes.Int64(0x28590a1c921de000)), 0x28590a1c);
do_check_eq(ctypes.Int64.lo(ctypes.Int64(-0x28590a1c921de000)), 0x6de22000);
do_check_eq(ctypes.Int64.hi(ctypes.Int64(-0x28590a1c921de000)), -0x28590a1d);
- do_check_throws(function() { ctypes.Int64.lo(ctypes.UInt64(0)); }, TypeError);
- do_check_throws(function() { ctypes.Int64.hi(ctypes.UInt64(0)); }, TypeError);
- do_check_throws(function() { ctypes.Int64.lo(0); }, TypeError);
- do_check_throws(function() { ctypes.Int64.hi(0); }, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.lo(ctypes.UInt64(0));
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.hi(ctypes.UInt64(0));
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.lo(0);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.hi(0);
+}, TypeError);
// Test ctypes.Int64.join.
do_check_eq(ctypes.Int64.join(0, 0).toString(), "0");
do_check_eq(ctypes.Int64.join(0x28590a1c, 0x921de000).toString(16), "28590a1c921de000");
do_check_eq(ctypes.Int64.join(-0x28590a1d, 0x6de22000).toString(16), "-28590a1c921de000");
do_check_eq(ctypes.Int64.join(0x7fffffff, 0xffffffff).toString(16), "7fffffffffffffff");
do_check_eq(ctypes.Int64.join(-0x80000000, 0x00000000).toString(16), "-8000000000000000");
- do_check_throws(function() { ctypes.Int64.join(-0x80000001, 0); }, TypeError);
- do_check_throws(function() { ctypes.Int64.join(0x80000000, 0); }, TypeError);
- do_check_throws(function() { ctypes.Int64.join(0, -0x1); }, TypeError);
- do_check_throws(function() { ctypes.Int64.join(0, 0x800000000); }, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.join(-0x80000001, 0);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.join(0x80000000, 0);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.join(0, -0x1);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.Int64.join(0, 0x800000000);
+}, TypeError);
}
function run_UInt64_tests() {
- do_check_throws(function() { ctypes.UInt64(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64();
+}, TypeError);
do_check_true(ctypes.UInt64.hasOwnProperty("prototype"));
do_check_true(ctypes.UInt64.prototype.hasOwnProperty("constructor"));
do_check_true(ctypes.UInt64.prototype.constructor === ctypes.UInt64);
// Check that ctypes.UInt64 and ctypes.UInt64.prototype have the correct
// properties and functions.
do_check_true(ctypes.UInt64.hasOwnProperty("compare"));
do_check_true(ctypes.UInt64.hasOwnProperty("lo"));
do_check_true(ctypes.UInt64.hasOwnProperty("hi"));
do_check_true(ctypes.UInt64.hasOwnProperty("join"));
do_check_true(ctypes.UInt64.prototype.hasOwnProperty("toString"));
do_check_true(ctypes.UInt64.prototype.hasOwnProperty("toSource"));
// Check that the shared functions on ctypes.UInt64.prototype throw.
- do_check_throws(function() { ctypes.UInt64.prototype.toString(); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.prototype.toSource(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.prototype.toString();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.prototype.toSource();
+}, TypeError);
let uint64 = ctypes.UInt64(0);
do_check_true(uint64.__proto__ === ctypes.UInt64.prototype);
do_check_true(uint64 instanceof ctypes.UInt64);
// Test UInt64.toString([radix]).
do_check_eq(uint64.toString(), "0");
for (let radix = 2; radix <= 36; ++radix)
do_check_eq(uint64.toString(radix), "0");
- do_check_throws(function() { uint64.toString(0); }, RangeError);
- do_check_throws(function() { uint64.toString(1); }, RangeError);
- do_check_throws(function() { uint64.toString(37); }, RangeError);
- do_check_throws(function() { uint64.toString(10, 2); }, TypeError);
+ do_check_throws(function() {
+ uint64.toString(0);
+}, RangeError);
+ do_check_throws(function() {
+ uint64.toString(1);
+}, RangeError);
+ do_check_throws(function() {
+ uint64.toString(37);
+}, RangeError);
+ do_check_throws(function() {
+ uint64.toString(10, 2);
+}, TypeError);
// Test UInt64.toSource().
do_check_eq(uint64.toSource(), "ctypes.UInt64(\"0\")");
- do_check_throws(function() { uint64.toSource(10); }, TypeError);
+ do_check_throws(function() {
+ uint64.toSource(10);
+}, TypeError);
uint64 = ctypes.UInt64("0x28590a1c921def71");
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "2907366152271163249");
do_check_eq(uint64.toString(16), "28590a1c921def71");
do_check_eq(uint64.toString(2), "10100001011001000010100001110010010010000111011110111101110001");
do_check_eq(uint64.toSource(), "ctypes.UInt64(\"" + uint64.toString(10) + "\")");
@@ -555,52 +651,80 @@ function run_UInt64_tests() {
do_check_eq(uint64.toString(), uint64.toString(10));
do_check_eq(uint64.toString(10), "9223372036854775807");
do_check_eq(uint64.toString(16), "7fffffffffffffff");
do_check_eq(uint64.toString(2), "111111111111111111111111111111111111111111111111111111111111111");
let vals = [-1, 0x10000000000000000, "-1", "-0x1",
ctypes.Int64("-1"), Infinity, -Infinity, NaN, 0.1,
5.68e21, null, undefined, "", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { ctypes.UInt64(vals[i]); }, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64(vals[i]);
+}, TypeError);
vals = ["0x10000000000000000"];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { ctypes.UInt64(vals[i]); }, RangeError);
+ do_check_throws(function() {
+ ctypes.UInt64(vals[i]);
+}, RangeError);
// Test ctypes.UInt64.compare.
do_check_eq(ctypes.UInt64.compare(ctypes.UInt64(5), ctypes.UInt64(5)), 0);
do_check_eq(ctypes.UInt64.compare(ctypes.UInt64(5), ctypes.UInt64(4)), 1);
do_check_eq(ctypes.UInt64.compare(ctypes.UInt64(4), ctypes.UInt64(5)), -1);
- do_check_throws(function() { ctypes.UInt64.compare(ctypes.UInt64(4), ctypes.Int64(4)); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.compare(4, 5); }, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.compare(ctypes.UInt64(4), ctypes.Int64(4));
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.compare(4, 5);
+}, TypeError);
// Test ctypes.UInt64.{lo,hi}.
do_check_eq(ctypes.UInt64.lo(ctypes.UInt64(0x28590a1c921de000)), 0x921de000);
do_check_eq(ctypes.UInt64.hi(ctypes.UInt64(0x28590a1c921de000)), 0x28590a1c);
do_check_eq(ctypes.UInt64.lo(ctypes.UInt64(0xa8590a1c921de000)), 0x921de000);
do_check_eq(ctypes.UInt64.hi(ctypes.UInt64(0xa8590a1c921de000)), 0xa8590a1c);
- do_check_throws(function() { ctypes.UInt64.lo(ctypes.Int64(0)); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.hi(ctypes.Int64(0)); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.lo(0); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.hi(0); }, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.lo(ctypes.Int64(0));
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.hi(ctypes.Int64(0));
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.lo(0);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.hi(0);
+}, TypeError);
// Test ctypes.UInt64.join.
do_check_eq(ctypes.UInt64.join(0, 0).toString(), "0");
do_check_eq(ctypes.UInt64.join(0x28590a1c, 0x921de000).toString(16), "28590a1c921de000");
do_check_eq(ctypes.UInt64.join(0xa8590a1c, 0x921de000).toString(16), "a8590a1c921de000");
do_check_eq(ctypes.UInt64.join(0xffffffff, 0xffffffff).toString(16), "ffffffffffffffff");
do_check_eq(ctypes.UInt64.join(0, 0).toString(16), "0");
- do_check_throws(function() { ctypes.UInt64.join(-0x1, 0); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.join(0x100000000, 0); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.join(0, -0x1); }, TypeError);
- do_check_throws(function() { ctypes.UInt64.join(0, 0x1000000000); }, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.join(-0x1, 0);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.join(0x100000000, 0);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.join(0, -0x1);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.UInt64.join(0, 0x1000000000);
+}, TypeError);
}
function run_basic_abi_tests(library, t, name, toprimitive,
get_test, set_tests, sum_tests, sum_many_tests) {
// Test the function call ABI for calls involving the type.
function declare_fn_cdecl(fn_t, prefix) {
return library.declare(prefix + name + "_cdecl", fn_t);
}
@@ -721,20 +845,28 @@ function run_basic_class_tests(t) {
do_check_true(t.__proto__ === ctypes.CType.prototype);
do_check_true(t instanceof ctypes.CType);
do_check_true(t.prototype.__proto__ === ctypes.CData.prototype);
do_check_true(t.prototype instanceof ctypes.CData);
do_check_true(t.prototype.constructor === t);
// Check that the shared properties and functions on 't.prototype' throw.
- do_check_throws(function() { t.prototype.value; }, TypeError);
- do_check_throws(function() { t.prototype.value = null; }, TypeError);
- do_check_throws(function() { t.prototype.address(); }, TypeError);
- do_check_throws(function() { t.prototype.readString(); }, TypeError);
+ do_check_throws(function() {
+ t.prototype.value;
+}, TypeError);
+ do_check_throws(function() {
+ t.prototype.value = null;
+}, TypeError);
+ do_check_throws(function() {
+ t.prototype.address();
+}, TypeError);
+ do_check_throws(function() {
+ t.prototype.readString();
+}, TypeError);
// toString and toSource are called by the web console during inspection,
// so we don't want them to throw.
do_check_eq(t.prototype.toString(), '[CData proto object]');
do_check_eq(t.prototype.toSource(), '[CData proto object]');
// Test that an instance 'd' of 't' is a CData.
let d = t();
@@ -769,29 +901,37 @@ function run_bool_tests(library) {
do_check_eq(d.value, 1);
d = new t(1);
do_check_eq(d.value, 1);
// don't convert anything else
let vals = [-1, 2, Infinity, -Infinity, NaN, 0.1,
ctypes.Int64(0), ctypes.UInt64(0),
null, undefined, "", "0", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { d.value = vals[i]; }, TypeError);
+ do_check_throws(function() {
+ d.value = vals[i];
+}, TypeError);
do_check_true(d.address().constructor === t.ptr);
do_check_eq(d.address().contents, d.value);
do_check_eq(d.toSource(), "ctypes." + name + "(" + d.value + ")");
do_check_eq(d.toSource(), d.toString());
// Test the function call ABI for calls involving the type,
// and check the alignment of the type against what C says.
- function toprimitive(a) { return a; }
+ function toprimitive(a) {
+ return a;
+}
run_basic_abi_tests(library, t, name, toprimitive,
true,
[ false, true ],
[ [ false, false, false ], [ false, true, true ],
[ true, false, true ], [true, true, true ] ],
[ [ false, false, false, false, false, false, false, false, false,
false, false, false, false, false, false, false, false, false,
false ],
@@ -849,29 +989,37 @@ function run_integer_tests(library, t, n
d.value = false;
do_check_eq(d.value, 0);
d.value = true;
do_check_eq(d.value, 1);
// don't convert anything else
let vals = [limits[0] - 1, limits[1] + 1, Infinity, -Infinity, NaN, 0.1,
null, undefined, "", "0", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { d.value = vals[i]; }, TypeError);
+ do_check_throws(function() {
+ d.value = vals[i];
+}, TypeError);
do_check_true(d.address().constructor === t.ptr);
do_check_eq(d.address().contents, d.value);
do_check_eq(d.toSource(), "ctypes." + name + "(" + d.value + ")");
do_check_eq(d.toSource(), d.toString());
// Test the function call ABI for calls involving the type,
// and check the alignment of the type against what C says.
- function toprimitive(a) { return a; }
+ function toprimitive(a) {
+ return a;
+}
run_basic_abi_tests(library, t, name, toprimitive,
109,
[ 0, limits[0], limits[1] ],
[ [ 0, 0, 0 ], [ 0, 1, 1 ], [ 1, 0, 1 ], [ 1, 1, 2 ],
[ limits[0], 1, limits[0] + 1 ],
[ limits[1], 1, limits[0] ] ],
[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -901,55 +1049,69 @@ function run_float_tests(library, t, nam
do_check_eq(d.value, 5.25);
d = t(10);
do_check_eq(d.value, 10);
d.value = -10;
do_check_eq(d.value, -10);
d = new t(20);
do_check_eq(d.value, 20);
- do_check_throws(function() { d.value = ctypes.Int64(5); }, TypeError);
- do_check_throws(function() { d.value = ctypes.Int64(-5); }, TypeError);
- do_check_throws(function() { d.value = ctypes.UInt64(5); }, TypeError);
+ do_check_throws(function() {
+ d.value = ctypes.Int64(5);
+}, TypeError);
+ do_check_throws(function() {
+ d.value = ctypes.Int64(-5);
+}, TypeError);
+ do_check_throws(function() {
+ d.value = ctypes.UInt64(5);
+}, TypeError);
if (size == 4) {
d.value = 0x7fffff;
do_check_eq(d.value, 0x7fffff);
// allow values that can't be represented precisely as a float
d.value = 0xffffffff;
let delta = 1 - d.value / 0xffffffff;
do_check_true(delta != 0);
do_check_true(delta > -0.01 && delta < 0.01);
d.value = 1 + 1 / 0x80000000;
do_check_eq(d.value, 1);
} else {
d.value = 0xfffffffffffff000;
do_check_eq(d.value, 0xfffffffffffff000);
- do_check_throws(function() { d.value = ctypes.Int64("0x7fffffffffffffff"); }, TypeError);
+ do_check_throws(function() {
+ d.value = ctypes.Int64("0x7fffffffffffffff");
+}, TypeError);
}
d.value = Infinity;
do_check_eq(d.value, Infinity);
d.value = -Infinity;
do_check_eq(d.value, -Infinity);
d.value = NaN;
do_check_true(isNaN(d.value));
d.value = 0;
do_check_eq(d.value, 0);
d.value = -0;
do_check_eq(1 / d.value, 1 / -0);
// don't convert anything else
let vals = [true, false, null, undefined, "", "0", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { d.value = vals[i]; }, TypeError);
+ do_check_throws(function() {
+ d.value = vals[i];
+}, TypeError);
// Check that values roundtrip through toSource() correctly.
function test_roundtrip(tFn, val) {
let f1 = tFn(val);
var f2 = eval(f1.toSource());
do_check_eq(f1.value, f2.value);
}
vals = [Infinity, -Infinity, -0, 0, 1, -1, 1 / 3, -1 / 3, 1 / 4, -1 / 4,
@@ -970,17 +1132,19 @@ function run_float_tests(library, t, nam
operand[0] = 503859.75;
operand[1] = 1012385.25;
operand[2] = 1516245;
} else {
operand[0] = 501823873859.75;
operand[1] = 171290577385.25;
operand[2] = 673114451245;
}
- function toprimitive(a) { return a; }
+ function toprimitive(a) {
+ return a;
+}
run_basic_abi_tests(library, t, name, toprimitive,
109.25,
[ 0, operand[0], operand[1] ],
[ [ 0, 0, 0 ], [ 0, 1, 1 ], [ 1, 0, 1 ], [ 1, 1, 2 ],
[ operand[0], operand[1], operand[2] ] ],
[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0 ],
@@ -1035,29 +1199,37 @@ function run_wrapped_integer_tests(libra
d.value = false;
do_check_eq(d.value, 0);
d.value = true;
do_check_eq(d.value, 1);
// don't convert anything else
let vals = [limits[2], limits[3], Infinity, -Infinity, NaN, 0.1,
null, undefined, "", "0", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { d.value = vals[i]; }, TypeError);
+ do_check_throws(function() {
+ d.value = vals[i];
+}, TypeError);
do_check_true(d.address().constructor === t.ptr);
do_check_eq(d.address().contents.toString(), d.value.toString());
do_check_eq(d.toSource(), "ctypes." + name + "(" + wname + "(\"" + d.value + "\"))");
do_check_eq(d.toSource(), d.toString());
// Test the function call ABI for calls involving the type,
// and check the alignment of the type against what C says.
- function toprimitive(a) { return a.toString(); }
+ function toprimitive(a) {
+ return a.toString();
+}
run_basic_abi_tests(library, t, name, toprimitive,
109,
[ 0, w(limits[0]), w(limits[1]) ],
[ [ 0, 0, 0 ], [ 0, 1, 1 ], [ 1, 0, 1 ], [ 1, 1, 2 ],
signed ? [ w(limits[0]), -1, w(limits[1]) ]
: [ w(limits[1]), 1, w(limits[0]) ] ],
[ [ 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -1084,22 +1256,26 @@ function run_char_tests(library, t, name
d.value = 5;
do_check_eq(d.value, 5);
d = t(10);
do_check_eq(d.value, 10);
if (signed) {
d.value = -10;
do_check_eq(d.value, -10);
} else {
- do_check_throws(function() { d.value = -10; }, TypeError);
+ do_check_throws(function() {
+ d.value = -10;
+}, TypeError);
}
d = new t(20);
do_check_eq(d.value, 20);
- function toprimitive(a) { return a; }
+ function toprimitive(a) {
+ return a;
+}
d.value = ctypes.Int64(5);
do_check_eq(d.value, 5);
if (signed) {
d.value = ctypes.Int64(-10);
do_check_eq(d.value, -10);
}
d.value = ctypes.UInt64(5);
@@ -1113,41 +1289,53 @@ function run_char_tests(library, t, name
do_check_eq(d.value, 0);
d.value = -0;
do_check_eq(1 / d.value, 1 / 0);
d.value = false;
do_check_eq(d.value, 0);
d.value = true;
do_check_eq(d.value, 1);
- do_check_throws(function() { d.value = "5"; }, TypeError);
+ do_check_throws(function() {
+ d.value = "5";
+}, TypeError);
// don't convert anything else
let vals = [limits[0] - 1, limits[1] + 1, Infinity, -Infinity, NaN, 0.1,
null, undefined, "", "aa", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { d.value = vals[i]; }, TypeError);
+ do_check_throws(function() {
+ d.value = vals[i];
+}, TypeError);
do_check_true(d.address().constructor === t.ptr);
do_check_eq(d.address().contents, 1);
do_check_eq(d.toSource(), "ctypes." + name + "(" + d.value + ")");
do_check_eq(d.toSource(), d.toString());
// Test string autoconversion (and lack thereof).
let literal = "autoconverted";
let s = t.array()(literal);
do_check_eq(s.readString(), literal);
do_check_eq(s.constructor.length, literal.length + 1);
s = t.array(50)(literal);
do_check_eq(s.readString(), literal);
- do_check_throws(function() { t.array(3)(literal); }, TypeError);
-
- do_check_throws(function() { t.ptr(literal); }, TypeError);
+ do_check_throws(function() {
+ t.array(3)(literal);
+}, TypeError);
+
+ do_check_throws(function() {
+ t.ptr(literal);
+}, TypeError);
let p = t.ptr(s);
do_check_eq(p.readString(), literal);
// Test the function call ABI for calls involving the type,
// and check the alignment of the type against what C says.
run_basic_abi_tests(library, t, name, toprimitive,
109,
[ 0, limits[0], limits[1] ],
@@ -1169,33 +1357,39 @@ function run_char16_tests(library, t, na
do_check_eq(t.size, 2);
do_check_eq(t.toString(), "type " + name);
do_check_eq(t.toSource(), "ctypes." + name);
do_check_true(t.ptr === ctypes.PointerType(t));
do_check_eq(t.array().name, name + "[]");
do_check_eq(t.array(5).name, name + "[5]");
- function toprimitive(a) { return a.charCodeAt(0); }
+ function toprimitive(a) {
+ return a.charCodeAt(0);
+}
let d = t();
do_check_eq(d.value.length, 1);
do_check_eq(toprimitive(d.value), 0);
d.value = 5;
do_check_eq(d.value.length, 1);
do_check_eq(toprimitive(d.value), 5);
d = t(10);
do_check_eq(toprimitive(d.value), 10);
- do_check_throws(function() { d.value = -10; }, TypeError);
+ do_check_throws(function() {
+ d.value = -10;
+}, TypeError);
d = new t(20);
do_check_eq(toprimitive(d.value), 20);
d.value = ctypes.Int64(5);
do_check_eq(d.value.charCodeAt(0), 5);
- do_check_throws(function() { d.value = ctypes.Int64(-10); }, TypeError);
+ do_check_throws(function() {
+ d.value = ctypes.Int64(-10);
+}, TypeError);
d.value = ctypes.UInt64(5);
do_check_eq(d.value.charCodeAt(0), 5);
d.value = limits[0];
do_check_eq(toprimitive(d.value), limits[0]);
d.value = limits[1];
do_check_eq(toprimitive(d.value), limits[1]);
d.value = 0;
@@ -1210,36 +1404,46 @@ function run_char16_tests(library, t, na
d.value = "\0";
do_check_eq(toprimitive(d.value), 0);
d.value = "a";
do_check_eq(d.value, "a");
// don't convert anything else
let vals = [limits[0] - 1, limits[1] + 1, Infinity, -Infinity, NaN, 0.1,
null, undefined, "", "aa", {}, [], new Number(16),
- {toString() { return 7; }},
- {valueOf() { return 7; }}];
+ {toString() {
+ return 7;
+}},
+ {valueOf() {
+ return 7;
+}}];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { d.value = vals[i]; }, TypeError);
+ do_check_throws(function() {
+ d.value = vals[i];
+}, TypeError);
do_check_true(d.address().constructor === t.ptr);
do_check_eq(d.address().contents, "a");
do_check_eq(d.toSource(), "ctypes." + name + "(\"" + d.value + "\")");
do_check_eq(d.toSource(), d.toString());
// Test string autoconversion (and lack thereof).
let literal = "autoconverted";
let s = t.array()(literal);
do_check_eq(s.readString(), literal);
do_check_eq(s.constructor.length, literal.length + 1);
s = t.array(50)(literal);
do_check_eq(s.readString(), literal);
- do_check_throws(function() { t.array(3)(literal); }, TypeError);
-
- do_check_throws(function() { t.ptr(literal); }, TypeError);
+ do_check_throws(function() {
+ t.array(3)(literal);
+}, TypeError);
+
+ do_check_throws(function() {
+ t.ptr(literal);
+}, TypeError);
let p = t.ptr(s);
do_check_eq(p.readString(), literal);
// Test the function call ABI for calls involving the type,
// and check the alignment of the type against what C says.
run_basic_abi_tests(library, t, name, toprimitive,
109,
[ 0, limits[0], limits[1] ],
@@ -1263,19 +1467,23 @@ function run_type_ctor_class_tests(c, t,
// Check that 'c.prototype' has the correct properties and functions.
for (let p of props)
do_check_true(c.prototype.hasOwnProperty(p));
for (let f of fns)
do_check_true(c.prototype.hasOwnProperty(f));
// Check that the shared properties and functions on 'c.prototype' throw.
for (let p of props)
- do_check_throws(function() { c.prototype[p]; }, TypeError);
+ do_check_throws(function() {
+ c.prototype[p];
+}, TypeError);
for (let f of fns)
- do_check_throws(function() { c.prototype[f](); }, TypeError);
+ do_check_throws(function() {
+ c.prototype[f]();
+}, TypeError);
do_check_true(t.__proto__ === c.prototype);
do_check_true(t instanceof c);
// 't.prototype.__proto__' is the common ancestor of all types constructed
// from 'c'; while not available from 'c' directly, it should be identically
// equal to 't2.prototype.__proto__' where 't2' is a different CType
// constructed from 'c'.
@@ -1292,31 +1500,41 @@ function run_type_ctor_class_tests(c, t,
for (let p of instanceProps)
do_check_true(t.prototype.__proto__.hasOwnProperty(p));
for (let f of instanceFns)
do_check_true(t.prototype.__proto__.hasOwnProperty(f));
// Check that the shared properties and functions on 't.prototype.__proto__'
// (and thus also 't.prototype') throw.
for (let p of instanceProps) {
- do_check_throws(function() { t.prototype.__proto__[p]; }, TypeError);
- do_check_throws(function() { t.prototype[p]; }, TypeError);
+ do_check_throws(function() {
+ t.prototype.__proto__[p];
+}, TypeError);
+ do_check_throws(function() {
+ t.prototype[p];
+}, TypeError);
}
for (let f of instanceFns) {
- do_check_throws(function() { t.prototype.__proto__[f]() }, TypeError);
- do_check_throws(function() { t.prototype[f]() }, TypeError);
+ do_check_throws(function() {
+ t.prototype.__proto__[f]()
+}, TypeError);
+ do_check_throws(function() {
+ t.prototype[f]()
+}, TypeError);
}
// Check that 't.prototype' has the correct special properties.
for (let p of specialProps)
do_check_true(t.prototype.hasOwnProperty(p));
// Check that the shared special properties on 't.prototype' throw.
for (let p of specialProps)
- do_check_throws(function() { t.prototype[p]; }, TypeError);
+ do_check_throws(function() {
+ t.prototype[p];
+}, TypeError);
// Make sure we can access 'prototype' on a CTypeProto.
if (t instanceof ctypes.FunctionType)
do_check_true(Object.getPrototypeOf(c.prototype.prototype) === ctypes.PointerType.prototype.prototype);
else
do_check_true(Object.getPrototypeOf(c.prototype.prototype) === ctypes.CType.prototype.prototype);
// Test that an instance 'd' of 't' is a CData.
@@ -1329,20 +1547,28 @@ function run_type_ctor_class_tests(c, t,
}
function run_StructType_tests() {
run_type_ctor_class_tests(ctypes.StructType,
ctypes.StructType("s", [{"a": ctypes.int32_t}, {"b": ctypes.int64_t}]),
ctypes.StructType("t", [{"c": ctypes.int32_t}, {"d": ctypes.int64_t}]),
[ "fields" ], [ "define" ], [], [ "addressOfField" ], [ "a", "b" ]);
- do_check_throws(function() { ctypes.StructType(); }, TypeError);
- do_check_throws(function() { ctypes.StructType("a", [], 5); }, TypeError);
- do_check_throws(function() { ctypes.StructType(null, []); }, TypeError);
- do_check_throws(function() { ctypes.StructType("a", null); }, TypeError);
+ do_check_throws(function() {
+ ctypes.StructType();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.StructType("a", [], 5);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.StructType(null, []);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.StructType("a", null);
+}, TypeError);
// Check that malformed descriptors are an error.
do_check_throws(function() {
ctypes.StructType("a", [{"x":ctypes.int32_t}, {"x":ctypes.int8_t}]);
}, TypeError);
do_check_throws(function() {
ctypes.StructType("a", [5]);
}, TypeError);
@@ -1365,47 +1591,59 @@ function run_StructType_tests() {
// Check that opaque structs work.
let opaque_t = ctypes.StructType("a");
do_check_eq(opaque_t.name, "a");
do_check_eq(opaque_t.toString(), "type a");
do_check_eq(opaque_t.toSource(), 'ctypes.StructType("a")');
do_check_true(opaque_t.prototype === undefined);
do_check_true(opaque_t.fields === undefined);
do_check_true(opaque_t.size === undefined);
- do_check_throws(function() { opaque_t(); }, Error);
+ do_check_throws(function() {
+ opaque_t();
+}, Error);
let opaqueptr_t = opaque_t.ptr;
do_check_true(opaqueptr_t.targetType === opaque_t);
do_check_eq(opaqueptr_t.name, "a*");
do_check_eq(opaqueptr_t.toString(), "type a*");
do_check_eq(opaqueptr_t.toSource(), 'ctypes.StructType("a").ptr');
// Check that type checking works with opaque structs.
let opaqueptr = opaqueptr_t();
opaqueptr.value = opaqueptr_t(1);
do_check_eq(ptrValue(opaqueptr), 1);
do_check_throws(function() {
opaqueptr.value = ctypes.StructType("a").ptr();
}, TypeError);
// Check that 'define' works.
- do_check_throws(function() { opaque_t.define(); }, TypeError);
- do_check_throws(function() { opaque_t.define([], 0); }, TypeError);
- do_check_throws(function() { opaque_t.define([{}]); }, TypeError);
- do_check_throws(function() { opaque_t.define([{ a: 0 }]); }, TypeError);
+ do_check_throws(function() {
+ opaque_t.define();
+}, TypeError);
+ do_check_throws(function() {
+ opaque_t.define([], 0);
+}, TypeError);
+ do_check_throws(function() {
+ opaque_t.define([{}]);
+}, TypeError);
+ do_check_throws(function() {
+ opaque_t.define([{ a: 0 }]);
+}, TypeError);
do_check_throws(function() {
opaque_t.define([{ a: ctypes.int32_t, b: ctypes.int64_t }]);
}, TypeError);
do_check_throws(function() {
opaque_t.define([{ a: ctypes.int32_t }, { b: 0 }]);
}, TypeError);
do_check_false(opaque_t.hasOwnProperty("prototype"));
// Check that circular references work with opaque structs...
// but not crazy ones.
- do_check_throws(function() { opaque_t.define([{ b: opaque_t }]); }, TypeError);
+ do_check_throws(function() {
+ opaque_t.define([{ b: opaque_t }]);
+}, TypeError);
let circular_t = ctypes.StructType("circular", [{ a: opaqueptr_t }]);
opaque_t.define([{ b: circular_t }]);
let opaque = opaque_t();
let circular = circular_t(opaque.address());
opaque.b = circular;
do_check_eq(circular.a.toSource(), opaque.address().toSource());
do_check_eq(opaque.b.toSource(), circular.toSource());
@@ -1506,18 +1744,22 @@ function run_StructType_tests() {
}
let g = g_t();
do_check_eq(g.a, 0);
do_check_eq(g.b, 0);
g = new g_t(1, 2);
do_check_eq(g.a, 1);
do_check_eq(g.b, 2);
- do_check_throws(function() { g_t(1); }, TypeError);
- do_check_throws(function() { g_t(1, 2, 3); }, TypeError);
+ do_check_throws(function() {
+ g_t(1);
+}, TypeError);
+ do_check_throws(function() {
+ g_t(1, 2, 3);
+}, TypeError);
for (let field in g)
do_check_true(field == "a" || field == "b");
let g_a = g.address();
do_check_true(g_a.constructor === g_t.ptr);
do_check_eq(g_a.contents.a, g.a);
@@ -1532,37 +1774,55 @@ function run_StructType_tests() {
do_check_eq(g2.a, 1);
g2.a = 7;
do_check_eq(g2.a, 7);
do_check_eq(s.b.a, 7);
g_a = s.addressOfField("b");
do_check_true(g_a.constructor === g_t.ptr);
do_check_eq(g_a.contents.a, s.b.a);
- do_check_throws(function() { s.addressOfField(); }, TypeError);
- do_check_throws(function() { s.addressOfField("d"); }, TypeError);
- do_check_throws(function() { s.addressOfField("a", 2); }, TypeError);
+ do_check_throws(function() {
+ s.addressOfField();
+}, TypeError);
+ do_check_throws(function() {
+ s.addressOfField("d");
+}, TypeError);
+ do_check_throws(function() {
+ s.addressOfField("a", 2);
+}, TypeError);
do_check_eq(s.toSource(), "s_t(4, {\"a\": 7, \"b\": 2}, 10)");
do_check_eq(s.toSource(), s.toString());
var s2 = eval(s.toSource());
do_check_true(s2.constructor === s_t);
do_check_eq(s.b.b, s2.b.b);
// Test that structs can be set from an object using 'value'.
- do_check_throws(function() { s.value; }, TypeError);
+ do_check_throws(function() {
+ s.value;
+}, TypeError);
let s_init = { "a": 2, "b": { "a": 9, "b": 5 }, "c": 13 };
s.value = s_init;
do_check_eq(s.b.a, 9);
do_check_eq(s.c, 13);
- do_check_throws(function() { s.value = 5; }, TypeError);
- do_check_throws(function() { s.value = ctypes.int32_t(); }, TypeError);
- do_check_throws(function() { s.value = {}; }, TypeError);
- do_check_throws(function() { s.value = { "a": 2 }; }, TypeError);
- do_check_throws(function() { s.value = { "a": 2, "b": 5, "c": 10 }; }, TypeError);
+ do_check_throws(function() {
+ s.value = 5;
+}, TypeError);
+ do_check_throws(function() {
+ s.value = ctypes.int32_t();
+}, TypeError);
+ do_check_throws(function() {
+ s.value = {};
+}, TypeError);
+ do_check_throws(function() {
+ s.value = { "a": 2 };
+}, TypeError);
+ do_check_throws(function() {
+ s.value = { "a": 2, "b": 5, "c": 10 };
+}, TypeError);
do_check_throws(function() {
s.value = { "5": 2, "b": { "a": 9, "b": 5 }, "c": 13 };
}, TypeError);
do_check_throws(function() {
s.value = { "a": 2, "b": { "a": 9, "b": 5 }, "c": 13, "d": 17 };
}, TypeError);
do_check_throws(function() {
s.value = { "a": 2, "b": { "a": 9, "b": 5, "e": 9 }, "c": 13 };
@@ -1574,17 +1834,19 @@ function run_StructType_tests() {
do_check_eq(s.b.a, 9);
do_check_eq(s.c, 13);
let v_t = ctypes.StructType("v_t", [{ "x": ctypes.int32_t }]);
let v = v_t({ "x": 5 });
do_check_eq(v.x, 5);
v = v_t(8);
do_check_eq(v.x, 8);
let w_t = ctypes.StructType("w_t", [{ "y": v_t }]);
- do_check_throws(function() { w_t(9); }, TypeError);
+ do_check_throws(function() {
+ w_t(9);
+}, TypeError);
let w = w_t({ "x": 3 });
do_check_eq(w.y.x, 3);
w = w_t({ "y": { "x": 19 } });
do_check_eq(w.y.x, 19);
let u_t = ctypes.StructType("u_t", [{ "z": ctypes.ArrayType(ctypes.int32_t, 3) }]);
let u = u_t([1, 2, 3]);
do_check_eq(u.z[1], 2);
u = u_t({ "z": [4, 5, 6] });
@@ -1613,21 +1875,31 @@ function ptrValue(p) {
return ctypes.cast(p, ctypes.uintptr_t).value.toString();
}
function run_PointerType_tests() {
run_type_ctor_class_tests(ctypes.PointerType,
ctypes.PointerType(ctypes.int32_t), ctypes.PointerType(ctypes.int64_t),
[ "targetType" ], [], [ "contents" ], [ "isNull", "increment", "decrement" ], []);
- do_check_throws(function() { ctypes.PointerType(); }, TypeError);
- do_check_throws(function() { ctypes.PointerType(ctypes.int32_t, 5); }, TypeError);
- do_check_throws(function() { ctypes.PointerType(null); }, TypeError);
- do_check_throws(function() { ctypes.PointerType(ctypes.int32_t()); }, TypeError);
- do_check_throws(function() { ctypes.PointerType("void"); }, TypeError);
+ do_check_throws(function() {
+ ctypes.PointerType();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.PointerType(ctypes.int32_t, 5);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.PointerType(null);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.PointerType(ctypes.int32_t());
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.PointerType("void");
+}, TypeError);
let name = "g_t";
let g_t = ctypes.StructType(name, [{ a: ctypes.int32_t }, { b: ctypes.double }]);
let g = g_t(1, 2);
let p_t = ctypes.PointerType(g_t);
do_check_eq(p_t.name, name + "*");
do_check_eq(p_t.size, ctypes.uintptr_t.size);
@@ -1638,44 +1910,64 @@ function run_PointerType_tests() {
do_check_eq(p_t.toSource(),
"ctypes.StructType(\"g_t\", [{ \"a\": ctypes.int32_t }, { \"b\": ctypes.double }]).ptr");
do_check_true(p_t.ptr === ctypes.PointerType(p_t));
do_check_eq(p_t.array().name, name + "*[]");
do_check_eq(p_t.array(5).name, name + "*[5]");
// Test ExplicitConvert.
let p = p_t();
- do_check_throws(function() { p.value; }, TypeError);
+ do_check_throws(function() {
+ p.value;
+}, TypeError);
do_check_eq(ptrValue(p), 0);
- do_check_throws(function() { p.contents; }, TypeError);
- do_check_throws(function() { p.contents = g; }, TypeError);
+ do_check_throws(function() {
+ p.contents;
+}, TypeError);
+ do_check_throws(function() {
+ p.contents = g;
+}, TypeError);
p = p_t(5);
do_check_eq(ptrValue(p), 5);
p = p_t(ctypes.UInt64(10));
do_check_eq(ptrValue(p), 10);
// Test ImplicitConvert.
p.value = null;
do_check_eq(ptrValue(p), 0);
- do_check_throws(function() { p.value = 5; }, TypeError);
+ do_check_throws(function() {
+ p.value = 5;
+}, TypeError);
// Test opaque pointers.
let f_t = ctypes.StructType("FILE").ptr;
do_check_eq(f_t.name, "FILE*");
do_check_eq(f_t.toSource(), 'ctypes.StructType("FILE").ptr');
let f = new f_t();
- do_check_throws(function() { f.contents; }, TypeError);
- do_check_throws(function() { f.contents = 0; }, TypeError);
+ do_check_throws(function() {
+ f.contents;
+}, TypeError);
+ do_check_throws(function() {
+ f.contents = 0;
+}, TypeError);
f = f_t(5);
- do_check_throws(function() { f.contents = 0; }, TypeError);
+ do_check_throws(function() {
+ f.contents = 0;
+}, TypeError);
do_check_eq(f.toSource(), 'FILE.ptr(ctypes.UInt64("0x5"))');
- do_check_throws(function() { f_t(p); }, TypeError);
- do_check_throws(function() { f.value = p; }, TypeError);
- do_check_throws(function() { p.value = f; }, TypeError);
+ do_check_throws(function() {
+ f_t(p);
+}, TypeError);
+ do_check_throws(function() {
+ f.value = p;
+}, TypeError);
+ do_check_throws(function() {
+ p.value = f;
+}, TypeError);
// Test void pointers.
let v_t = ctypes.PointerType(ctypes.void_t);
do_check_true(v_t === ctypes.voidptr_t);
let v = v_t(p);
do_check_eq(ptrValue(v), ptrValue(p));
// Test 'contents'.
@@ -1703,17 +1995,19 @@ function run_PointerType_tests() {
a_p = a_p.decrement();
do_check_eq(a_p.contents.a, 1);
do_check_eq(a_p.contents.b, 2);
// Check that pointers to arrays of undefined or zero length are legal,
// but that the former cannot be dereferenced.
let z_t = ctypes.int32_t.array().ptr;
do_check_eq(ptrValue(z_t()), 0);
- do_check_throws(function() { z_t().contents }, TypeError);
+ do_check_throws(function() {
+ z_t().contents
+}, TypeError);
z_t = ctypes.int32_t.array(0).ptr;
do_check_eq(ptrValue(z_t()), 0);
let z = ctypes.int32_t.array(0)().address();
do_check_eq(z.contents.length, 0);
// TODO: Somehow, somewhere we should check that:
//
// (a) ArrayBuffer and TypedArray can be passed by pointer to a C function
@@ -1754,17 +2048,19 @@ function run_PointerType_tests() {
let number_of_items = c_arraybuffer.byteLength / item_type.size;
let array_type = item_type.array(number_of_items);
// Int8Array on unshared memory is interconvertible with Int8Array on
// shared memory, etc.
if (i % 8 != j % 8) {
do_print("Checking that typed array " + (view.constructor.name) +
" can NOT be converted to " + item_type + " array");
- do_check_throws(function() { array_type(view); }, TypeError);
+ do_check_throws(function() {
+ array_type(view);
+}, TypeError);
} else {
do_print("Checking that typed array " + (view.constructor.name) +
" can be converted to " + item_type + " array");
// Convert ArrayBuffer to array of the right size and check contents
let c_array = array_type(c_arraybuffer);
for (let k = 0; k < number_of_items; ++k) {
do_check_eq(c_array[k], view[k]);
@@ -1775,20 +2071,28 @@ function run_PointerType_tests() {
for (let k = 0; k < number_of_items; ++k) {
do_check_eq(c_array[k], view[k]);
}
// Convert typed array to array of wrong size, ensure that it fails
let array_type_too_large = item_type.array(number_of_items + 1);
let array_type_too_small = item_type.array(number_of_items - 1);
- do_check_throws(function() { array_type_too_large(c_arraybuffer); }, TypeError);
- do_check_throws(function() { array_type_too_small(c_arraybuffer); }, TypeError);
- do_check_throws(function() { array_type_too_large(view); }, TypeError);
- do_check_throws(function() { array_type_too_small(view); }, TypeError);
+ do_check_throws(function() {
+ array_type_too_large(c_arraybuffer);
+}, TypeError);
+ do_check_throws(function() {
+ array_type_too_small(c_arraybuffer);
+}, TypeError);
+ do_check_throws(function() {
+ array_type_too_large(view);
+}, TypeError);
+ do_check_throws(function() {
+ array_type_too_small(view);
+}, TypeError);
// Convert subarray of typed array to array of right size and check contents
c_array = array_type_too_small(view.subarray(1));
for (let k = 1; k < number_of_items; ++k) {
do_check_eq(c_array[k - 1], view[k]);
}
}
}
@@ -1797,32 +2101,42 @@ function run_PointerType_tests() {
// Check that you can't use a (Shared)ArrayBuffer or a typed array as a pointer
for (let i = 0; i < typed_array_samples.length; ++i) {
for (let j = 0; j < typed_array_samples.length; ++j) {
let view = typed_array_samples[i][0];
let item_type = typed_array_samples[j][1];
do_print("Checking that typed array " + (view.constructor.name) +
" can NOT be converted to " + item_type + " pointer/array");
- do_check_throws(function() { item_type.ptr(c_arraybuffer); }, TypeError);
- do_check_throws(function() { item_type.ptr(view); }, TypeError);
- do_check_throws(function() { ctypes.voidptr_t(c_arraybuffer); }, TypeError);
- do_check_throws(function() { ctypes.voidptr_t(view); }, TypeError);
+ do_check_throws(function() {
+ item_type.ptr(c_arraybuffer);
+}, TypeError);
+ do_check_throws(function() {
+ item_type.ptr(view);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.voidptr_t(c_arraybuffer);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.voidptr_t(view);
+}, TypeError);
}
}
}
function run_FunctionType_tests() {
run_type_ctor_class_tests(ctypes.FunctionType,
ctypes.FunctionType(ctypes.default_abi, ctypes.void_t),
ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, [ ctypes.int32_t ]),
[ "abi", "returnType", "argTypes", "isVariadic" ],
undefined, undefined, undefined, undefined);
- do_check_throws(function() { ctypes.FunctionType(); }, TypeError);
+ do_check_throws(function() {
+ ctypes.FunctionType();
+}, TypeError);
do_check_throws(function() {
ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, [ ctypes.void_t ]);
}, TypeError);
do_check_throws(function() {
ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, [ ctypes.void_t ], 5);
}, TypeError);
do_check_throws(function() {
ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, ctypes.void_t);
@@ -1856,39 +2170,49 @@ function run_FunctionType_tests() {
do_check_eq(fp_t.name, name);
do_check_eq(fp_t.size, ctypes.uintptr_t.size);
do_check_eq(fp_t.toString(), "type " + name);
do_check_eq(fp_t.toSource(),
"ctypes.FunctionType(ctypes.default_abi, g_t).ptr");
// Check that constructing a FunctionType CData directly throws.
- do_check_throws(function() { f_t(); }, TypeError);
+ do_check_throws(function() {
+ f_t();
+}, TypeError);
// Test ExplicitConvert.
let f = fp_t();
- do_check_throws(function() { f.value; }, TypeError);
+ do_check_throws(function() {
+ f.value;
+}, TypeError);
do_check_eq(ptrValue(f), 0);
f = fp_t(5);
do_check_eq(ptrValue(f), 5);
f = fp_t(ctypes.UInt64(10));
do_check_eq(ptrValue(f), 10);
// Test ImplicitConvert.
f.value = null;
do_check_eq(ptrValue(f), 0);
- do_check_throws(function() { f.value = 5; }, TypeError);
+ do_check_throws(function() {
+ f.value = 5;
+}, TypeError);
do_check_eq(f.toSource(),
'ctypes.FunctionType(ctypes.default_abi, g_t).ptr(ctypes.UInt64("0x0"))');
// Test ImplicitConvert from a function pointer of different type.
let f2_t = ctypes.FunctionType(ctypes.default_abi, g_t, [ ctypes.int32_t ]);
let f2 = f2_t.ptr();
- do_check_throws(function() { f.value = f2; }, TypeError);
- do_check_throws(function() { f2.value = f; }, TypeError);
+ do_check_throws(function() {
+ f.value = f2;
+}, TypeError);
+ do_check_throws(function() {
+ f2.value = f;
+}, TypeError);
// Test that converting to a voidptr_t works.
let v = ctypes.voidptr_t(f2);
do_check_eq(v.toSource(), 'ctypes.voidptr_t(ctypes.UInt64("0x0"))');
// Test some more complex names.
do_check_eq(fp_t.array().name, "g_t(*[])()");
do_check_eq(fp_t.array().ptr.name, "g_t(*(*)[])()");
@@ -1936,47 +2260,61 @@ function run_FunctionType_tests() {
}
}
function run_ArrayType_tests() {
run_type_ctor_class_tests(ctypes.ArrayType,
ctypes.ArrayType(ctypes.int32_t, 10), ctypes.ArrayType(ctypes.int64_t),
[ "elementType", "length" ], [], [ "length" ], [ "addressOfElement" ]);
- do_check_throws(function() { ctypes.ArrayType(); }, TypeError);
- do_check_throws(function() { ctypes.ArrayType(null); }, TypeError);
- do_check_throws(function() { ctypes.ArrayType(ctypes.int32_t, 1, 5); }, TypeError);
- do_check_throws(function() { ctypes.ArrayType(ctypes.int32_t, -1); }, TypeError);
+ do_check_throws(function() {
+ ctypes.ArrayType();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.ArrayType(null);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.ArrayType(ctypes.int32_t, 1, 5);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.ArrayType(ctypes.int32_t, -1);
+}, TypeError);
let name = "g_t";
let g_t = ctypes.StructType(name, [{ a: ctypes.int32_t }, { b: ctypes.double }]);
let g = g_t(1, 2);
let a_t = ctypes.ArrayType(g_t, 10);
do_check_eq(a_t.name, name + "[10]");
do_check_eq(a_t.length, 10);
do_check_eq(a_t.size, g_t.size * 10);
do_check_true(a_t.elementType === g_t);
do_check_eq(a_t.toString(), "type " + name + "[10]");
do_check_eq(a_t.toSource(),
"ctypes.StructType(\"g_t\", [{ \"a\": ctypes.int32_t }, { \"b\": ctypes.double }]).array(10)");
do_check_eq(a_t.array().name, name + "[][10]");
do_check_eq(a_t.array(5).name, name + "[5][10]");
- do_check_throws(function() { ctypes.int32_t.array().array(); }, Error);
+ do_check_throws(function() {
+ ctypes.int32_t.array().array();
+}, Error);
let a = new a_t();
do_check_eq(a[0].a, 0);
do_check_eq(a[0].b, 0);
a[0] = g;
do_check_eq(a[0].a, 1);
do_check_eq(a[0].b, 2);
- do_check_throws(function() { a[-1]; }, TypeError);
+ do_check_throws(function() {
+ a[-1];
+}, TypeError);
do_check_eq(a[9].a, 0);
- do_check_throws(function() { a[10]; }, RangeError);
+ do_check_throws(function() {
+ a[10];
+}, RangeError);
do_check_eq(a[ctypes.Int64(0)].a, 1);
do_check_eq(a[ctypes.UInt64(0)].b, 2);
let a_p = a.addressOfElement(0);
do_check_true(a_p.constructor.targetType === g_t);
do_check_true(a_p.constructor === g_t.ptr);
do_check_eq(a_p.contents.a, a[0].a);
@@ -1987,19 +2325,25 @@ function run_ArrayType_tests() {
let a2_t = ctypes.ArrayType(g_t);
do_check_eq(a2_t.name, "g_t[]");
do_check_eq(a2_t.length, undefined);
do_check_eq(a2_t.size, undefined);
let a2 = new a2_t(5);
do_check_eq(a2.constructor.length, 5);
do_check_eq(a2.length, 5);
do_check_eq(a2.constructor.size, g_t.size * 5);
- do_check_throws(function() { new a2_t(); }, TypeError);
- do_check_throws(function() { ctypes.ArrayType(ctypes.ArrayType(g_t)); }, Error);
- do_check_throws(function() { ctypes.ArrayType(ctypes.ArrayType(g_t), 5); }, Error);
+ do_check_throws(function() {
+ new a2_t();
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.ArrayType(ctypes.ArrayType(g_t));
+}, Error);
+ do_check_throws(function() {
+ ctypes.ArrayType(ctypes.ArrayType(g_t), 5);
+}, Error);
let b_t = ctypes.int8_t.array(ctypes.UInt64(0xffff));
do_check_eq(b_t.length, 0xffff);
b_t = ctypes.int8_t.array(ctypes.Int64(0xffff));
do_check_eq(b_t.length, 0xffff);
// Check that array size bounds work, and that large, but not illegal, sizes
// are OK.
@@ -2007,28 +2351,32 @@ function run_ArrayType_tests() {
do_check_throws(function() {
ctypes.ArrayType(ctypes.int8_t, 0x100000000);
}, TypeError);
do_check_throws(function() {
ctypes.ArrayType(ctypes.int16_t, 0x80000000);
}, RangeError);
let large_t = ctypes.int8_t.array(0x80000000);
- do_check_throws(function() { large_t.array(2); }, RangeError);
+ do_check_throws(function() {
+ large_t.array(2);
+}, RangeError);
} else {
do_check_throws(function() {
ctypes.ArrayType(ctypes.int8_t, ctypes.UInt64("0xffffffffffffffff"));
}, TypeError);
do_check_throws(function() {
ctypes.ArrayType(ctypes.int16_t, ctypes.UInt64("0x8000000000000000"));
}, RangeError);
let large_t = ctypes.int8_t.array(0x8000000000000000);
- do_check_throws(function() { large_t.array(2); }, RangeError);
+ do_check_throws(function() {
+ large_t.array(2);
+}, RangeError);
}
// Test that arrays ImplicitConvert to pointers.
let b = ctypes.int32_t.array(10)();
let p = ctypes.int32_t.ptr();
p.value = b;
do_check_eq(ptrValue(b.addressOfElement(0)), ptrValue(p));
p = ctypes.voidptr_t();
@@ -2043,21 +2391,31 @@ function run_ArrayType_tests() {
do_check_eq(c.toSource(), c.toString());
var c2 = eval(c.toSource());
do_check_eq(c2.constructor.name, "int32_t[6]");
do_check_eq(c2.length, 6);
do_check_eq(c2[3], c[3]);
c.value = c;
do_check_eq(c[3], 4);
- do_check_throws(function() { c.value; }, TypeError);
- do_check_throws(function() { c.value = [1, 2, 3, 4, 5]; }, TypeError);
- do_check_throws(function() { c.value = [1, 2, 3, 4, 5, 6, 7]; }, TypeError);
- do_check_throws(function() { c.value = [1, 2, 7.4, 4, 5, 6]; }, TypeError);
- do_check_throws(function() { c.value = []; }, TypeError);
+ do_check_throws(function() {
+ c.value;
+}, TypeError);
+ do_check_throws(function() {
+ c.value = [1, 2, 3, 4, 5];
+}, TypeError);
+ do_check_throws(function() {
+ c.value = [1, 2, 3, 4, 5, 6, 7];
+}, TypeError);
+ do_check_throws(function() {
+ c.value = [1, 2, 7.4, 4, 5, 6];
+}, TypeError);
+ do_check_throws(function() {
+ c.value = [];
+}, TypeError);
}
function run_type_toString_tests() {
var c = ctypes;
// Figure out whether we can create functions with ctypes.stdcall_abi and ctypes.winapi_abi.
var haveStdCallABI;
try {
@@ -2152,19 +2510,25 @@ function run_cast_tests() {
let j = ctypes.cast(i, ctypes.int16_t);
do_check_eq(ptrValue(i.address()), ptrValue(j.address()));
do_check_eq(i.value, j.value);
let k = ctypes.cast(i, ctypes.uint32_t);
do_check_eq(ptrValue(i.address()), ptrValue(k.address()));
do_check_eq(i.value, k.value);
// Test casting to a type of undefined or larger size.
- do_check_throws(function() { ctypes.cast(i, ctypes.void_t); }, TypeError);
- do_check_throws(function() { ctypes.cast(i, ctypes.int32_t.array()); }, TypeError);
- do_check_throws(function() { ctypes.cast(i, ctypes.int64_t); }, TypeError);
+ do_check_throws(function() {
+ ctypes.cast(i, ctypes.void_t);
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.cast(i, ctypes.int32_t.array());
+}, TypeError);
+ do_check_throws(function() {
+ ctypes.cast(i, ctypes.int64_t);
+}, TypeError);
// Test casting between special types.
let g_t = ctypes.StructType("g_t", [{ a: ctypes.int32_t }, { b: ctypes.double }]);
let a_t = ctypes.ArrayType(g_t, 4);
let f_t = ctypes.FunctionType(ctypes.default_abi, ctypes.void_t).ptr;
let a = a_t();
a[0] = { a: 5, b: 7.5 };
@@ -2212,19 +2576,23 @@ function run_void_tests(library) {
}
function run_string_tests(library) {
let test_ansi_len = library.declare("test_ansi_len", ctypes.default_abi, ctypes.int32_t, ctypes.char.ptr);
do_check_eq(test_ansi_len(""), 0);
do_check_eq(test_ansi_len("hello world"), 11);
// don't convert anything else to a string
- let vals = [true, 0, 1 / 3, undefined, {}, {toString() { return "bad"; }}, []];
+ let vals = [true, 0, 1 / 3, undefined, {}, {toString() {
+ return "bad";
+}}, []];
for (let i = 0; i < vals.length; i++)
- do_check_throws(function() { test_ansi_len(vals[i]); }, TypeError);
+ do_check_throws(function() {
+ test_ansi_len(vals[i]);
+}, TypeError);
let test_wide_len = library.declare("test_wide_len", ctypes.default_abi, ctypes.int32_t, ctypes.char16_t.ptr);
do_check_eq(test_wide_len("hello world"), 11);
let test_ansi_ret = library.declare("test_ansi_ret", ctypes.default_abi, ctypes.char.ptr);
do_check_eq(test_ansi_ret().readString(), "success");
let test_wide_ret = library.declare("test_wide_ret", ctypes.default_abi, ctypes.char16_t.ptr);
@@ -2495,18 +2863,22 @@ function run_function_tests(library) {
// Test that we can call via call and apply
/* eslint-disable no-useless-call */
do_check_eq(ptr.call(null, "function pointers rule!"), 23);
do_check_eq(ptr.apply(null, ["function pointers rule!"]), 23);
// Test that we cannot call non-function pointers via call and apply
let p_t = ctypes.PointerType(ctypes.int32_t);
let p = p_t();
- do_check_throws(function() { p.call(null, "woo"); }, TypeError);
- do_check_throws(function() { p.apply(null, ["woo"]); }, TypeError);
+ do_check_throws(function() {
+ p.call(null, "woo");
+}, TypeError);
+ do_check_throws(function() {
+ p.apply(null, ["woo"]);
+}, TypeError);
/* eslint-enable no-useless-call */
// Test the function pointers still behave as regular pointers
do_check_false(ptr.isNull(), "PointerType methods should still be valid");
// Test that library.declare() returns data of type FunctionType.ptr, and that
// it is immutable.
do_check_true(test_ansi_len.constructor.targetType.__proto__ ===
@@ -2533,17 +2905,19 @@ function run_closure_tests(library) {
if ("winLastError" in ctypes) {
run_single_closure_tests(library, ctypes.stdcall_abi, "stdcall");
// Check that attempting to construct a ctypes.winapi_abi closure throws.
function closure_fn() {
return 1;
}
let fn_t = ctypes.FunctionType(ctypes.winapi_abi, ctypes.int32_t, []).ptr;
- do_check_throws(function() { fn_t(closure_fn) }, Error);
+ do_check_throws(function() {
+ fn_t(closure_fn)
+}, Error);
}
}
function run_single_closure_tests(library, abi, suffix) {
let b = 23;
function closure_fn(i) {
if (i == 42)
@@ -2592,17 +2966,19 @@ function run_single_closure_tests(librar
var fn_v_t = ctypes.FunctionType(ctypes.default_abi, ctypes.void_t, []).ptr;
fn_v_t(function() {})(); // Don't crash
// Code evaluated in a sandbox uses (and pushes) a separate JSContext.
// Make sure that we don't run into an assertion caused by a cx stack
// mismatch with the cx stashed in the closure.
try {
var sb = Components.utils.Sandbox("http://www.example.com");
- sb.fn = fn_v_t(function() { sb.foo = {}; });
+ sb.fn = fn_v_t(function() {
+ sb.foo = {};
+});
Components.utils.evalInSandbox("fn();", sb);
} catch (e) {} // Components not available in workers.
// Make sure that a void callback can't return an error sentinel.
var sentinelThrew = false;
try {
fn_v_t(function() {}, null, -1);
} catch (e) {
--- a/toolkit/components/filepicker/content/filepicker.js
+++ b/toolkit/components/filepicker/content/filepicker.js
@@ -604,17 +604,19 @@ function populateAncestorList(directory)
var menuList = document.getElementById("lookInMenuList");
menuList.selectedIndex = 0;
}
function goUp() {
try {
var parent = sfile.parent;
- } catch (ex) { dump("can't get parent directory\n"); }
+ } catch (ex) {
+ dump("can't get parent directory\n");
+}
if (parent) {
gotoDirectory(parent);
}
}
function goHome() {
gotoDirectory(homeDir);
--- a/toolkit/components/filepicker/nsFilePicker.js
+++ b/toolkit/components/filepicker/nsFilePicker.js
@@ -83,20 +83,24 @@ nsFilePicker.prototype = {
},
get displayDirectory() {
return this.mDisplayDirectory &&
this.mDisplayDirectory.clone()
.QueryInterface(nsILocalFile);
},
/* readonly attribute nsILocalFile file; */
- get file() { return this.mFilesEnumerator.mFiles[0]; },
+ get file() {
+ return this.mFilesEnumerator.mFiles[0];
+},
/* readonly attribute nsISimpleEnumerator files; */
- get files() { return this.mFilesEnumerator; },
+ get files() {
+ return this.mFilesEnumerator;
+},
/* we don't support directories, yet */
get domFileOrDirectory() {
let enumerator = this.domFileOrDirectoryEnumerator;
return enumerator ? enumerator.mFiles[0] : null;
},
/* readonly attribute nsISimpleEnumerator domFileOrDirectoryEnumerator; */
@@ -146,33 +150,47 @@ nsFilePicker.prototype = {
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
return this.mFileURL = ioService.newFileURI(this.file);
},
/* attribute wstring defaultString; */
- set defaultString(a) { this.mDefaultString = a; },
- get defaultString() { return this.mDefaultString; },
+ set defaultString(a) {
+ this.mDefaultString = a;
+},
+ get defaultString() {
+ return this.mDefaultString;
+},
/* attribute wstring defaultExtension */
set defaultExtension(ext) { },
- get defaultExtension() { return ""; },
+ get defaultExtension() {
+ return "";
+},
/* attribute long filterIndex; */
- set filterIndex(a) { this.mFilterIndex = a; },
- get filterIndex() { return this.mFilterIndex; },
+ set filterIndex(a) {
+ this.mFilterIndex = a;
+},
+ get filterIndex() {
+ return this.mFilterIndex;
+},
/* attribute boolean addToRecentDocs; */
set addToRecentDocs(a) {},
- get addToRecentDocs() { return false; },
+ get addToRecentDocs() {
+ return false;
+},
/* readonly attribute short mode; */
- get mode() { return this.mMode; },
+ get mode() {
+ return this.mMode;
+},
/* members */
mFilesEnumerator: undefined,
mDOMFilesEnumerator: undefined,
mParentWindow: null,
/* methods */
init(parent, title, mode) {
@@ -276,24 +294,28 @@ nsFilePicker.prototype = {
"chrome,modal,titlebar,resizable=yes,dependent=yes",
o);
this.mFilterIndex = o.retvals.filterIndex;
this.mFilesEnumerator = o.retvals.files;
this.mFileURL = o.retvals.fileURL;
lastDirectory = o.retvals.directory;
return o.retvals.buttonStatus;
- } catch (ex) { dump("unable to open file picker\n" + ex + "\n"); }
+ } catch (ex) {
+ dump("unable to open file picker\n" + ex + "\n");
+}
return null;
}
}
if (DEBUG)
- debug = function(s) { dump("-*- filepicker: " + s + "\n"); };
+ debug = function(s) {
+ dump("-*- filepicker: " + s + "\n");
+};
else
debug = function(s) {};
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsFilePicker]);
/* crap from strres.js that I want to use for string bundles since I can't include another .js file.... */
var strBundleService = null;
--- a/toolkit/components/formautofill/FormAutofillStartup.js
+++ b/toolkit/components/formautofill/FormAutofillStartup.js
@@ -44,17 +44,19 @@ FormAutofillStartup.prototype = {
},
// nsIFrameMessageListener
receiveMessage(aMessage) {
// Process the "FormAutofill:RequestAutocomplete" message. Any exception
// raised in the parent process is caught and serialized into the reply
// message that is sent to the requesting child process.
FormAutofill.processRequestAutocomplete(aMessage.data)
- .catch(ex => { return { exception: ex } })
+ .catch(ex => {
+ return { exception: ex }
+})
.then(result => {
// The browser message manager in the parent will send the reply to the
// associated frame message manager in the child.
let browserMM = aMessage.target.messageManager;
browserMM.sendAsyncMessage("FormAutofill:RequestAutocompleteResult",
result);
})
.catch(Cu.reportError);
--- a/toolkit/components/formautofill/test/xpcshell/test_integration.js
+++ b/toolkit/components/formautofill/test/xpcshell/test_integration.js
@@ -41,17 +41,19 @@ add_task(function* test_integration_over
/**
* Registers an integration override function that throws an exception, and
* ensures that this does not block other functions from being registered.
*/
add_task(function* test_integration_override_error() {
let overrideCalled = false;
- let errorIntegrationFn = base => { throw "Expected error." };
+ let errorIntegrationFn = base => {
+ throw "Expected error."
+};
let newIntegrationFn = base => ({
createRequestAutocompleteUI: Task.async(function* () {
overrideCalled = true;
return yield base.createRequestAutocompleteUI.apply(this, arguments);
}),
});
--- a/toolkit/components/perfmonitoring/PerformanceStats.jsm
+++ b/toolkit/components/perfmonitoring/PerformanceStats.jsm
@@ -329,17 +329,19 @@ var Probes = {
* Note that this probe is always active.
*
* Data provided by this probe uses the following format:
* @type {number} ticks The number of times execution has entered
* this performance group.
*/
ticks: new Probe("ticks", {
set isActive(x) { /* this probe cannot be deactivated */ },
- get isActive() { return true; },
+ get isActive() {
+ return true;
+},
extract(xpcom) {
return {
ticks: xpcom.ticks
};
},
isEqual(a, b) {
return a.ticks == b.ticks;
},
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -928,17 +928,19 @@ function updateBookmark(info, item, newP
yield addSyncChangesForBookmarksInFolder(db, item, syncChangeDelta);
}
yield db.executeCached(
`UPDATE moz_bookmarks
SET ${Array.from(tuples.keys()).map(v => tuples.get(v).fragment || `${v} = :${v}`).join(", ")}
WHERE guid = :guid
`, Object.assign({ guid: info.guid },
- [...tuples.entries()].reduce((p, c) => { p[c[0]] = c[1].value; return p; }, {})));
+ [...tuples.entries()].reduce((p, c) => {
+ p[c[0]] = c[1].value; return p;
+}, {})));
if (newParent) {
// Remove the Sync orphan annotation from reparented items. We don't
// notify annotation observers about this because this is a temporary,
// internal anno that's only used by Sync.
yield db.executeCached(
`DELETE FROM moz_items_annos
WHERE anno_attribute_id = (SELECT id FROM moz_anno_attributes
--- a/toolkit/components/places/PlacesTransactions.jsm
+++ b/toolkit/components/places/PlacesTransactions.jsm
@@ -630,17 +630,19 @@ var TransactionsManager = {
// Updates commands in the undo group of the active window commands.
// Inactive windows commands will be updated on focus.
_updateCommandsOnActiveWindow() {
// Updating "undo" will cause a group update including "redo".
try {
let win = Services.focus.activeWindow;
if (win)
win.updateCommands("undo");
- } catch (ex) { console.error(ex, "Couldn't update undo commands"); }
+ } catch (ex) {
+ console.error(ex, "Couldn't update undo commands");
+}
}
};
/**
* Internal helper for defining the standard transactions and their input.
* It takes the required and optional properties, and generates the public
* constructor (which takes the input in the form of a plain object) which,
* when called, creates the argument-less "public" |execute| method by binding
@@ -1236,17 +1238,19 @@ PT.Move.prototype = Object.seal({
* Required Input Properties: guid, title.
*/
PT.EditTitle = DefineTransaction(["guid", "title"]);
PT.EditTitle.prototype = Object.seal({
*execute(aGuid, aTitle) {
let itemId = yield PlacesUtils.promiseItemId(aGuid),
oldTitle = PlacesUtils.bookmarks.getItemTitle(itemId);
PlacesUtils.bookmarks.setItemTitle(itemId, aTitle);
- this.undo = () => { PlacesUtils.bookmarks.setItemTitle(itemId, oldTitle); };
+ this.undo = () => {
+ PlacesUtils.bookmarks.setItemTitle(itemId, oldTitle);
+};
}
});
/**
* Transaction for setting the URI for an item.
*
* Required Input Properties: guid, url.
*/
@@ -1503,17 +1507,19 @@ PT.Tag = DefineTransaction(["urls", "tag
PT.Tag.prototype = {
*execute(aURIs, aTags) {
let onUndo = [], onRedo = [];
for (let uri of aURIs) {
let promiseIsBookmarked = function* () {
let deferred = Promise.defer();
PlacesUtils.asyncGetBookmarkIds(
- uri, ids => { deferred.resolve(ids.length > 0); });
+ uri, ids => {
+ deferred.resolve(ids.length > 0);
+});
return deferred.promise;
};
if (yield promiseIsBookmarked(uri)) {
// Tagging is only allowed for bookmarked URIs (but see 424160).
let createTxn = TransactionsHistory.getRawTransaction(
PT.NewBookmark({ url: uri
, tags: aTags
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -642,17 +642,19 @@ this.PlacesUtils = {
// edit-item panel, the last transaction on the undo stack would be the
// initial createItem transaction, or even worse, the batched editing of
// some other item.
// DO NOT MOVE this to the window scope, that would leak (bug 490068)!
this.transactionManager.doTransaction({ doTransaction() {},
undoTransaction() {},
redoTransaction() {},
isTransient: false,
- merge() { return false; }
+ merge() {
+ return false;
+}
});
},
willDo: function PU_willDo() {},
willUndo: function PU_willUndo() {},
willRedo: function PU_willRedo() {},
willBeginBatch: function PU_willBeginBatch() {},
willEndBatch: function PU_willEndBatch() {},
@@ -1483,17 +1485,19 @@ this.PlacesUtils = {
yield conn.executeCached(QUERY_STR, { url: spec }, aRow => {
if (abort)
throw StopIteration;
itemIds.push(aRow.getResultByIndex(0));
});
if (!abort)
aCallback(itemIds, aURI);
}.bind(this)).then(null, Cu.reportError);
- return { cancel: () => { abort = true; } };
+ return { cancel: () => {
+ abort = true;
+} };
},
/**
* Lazily adds a bookmarks observer, waiting for the bookmarks service to be
* alive before registering the observer. This is especially useful in the
* startup path, to avoid initializing the service just to add an observer.
*
* @param aObserver
--- a/toolkit/components/places/tests/bookmarks/test_448584.js
+++ b/toolkit/components/places/tests/bookmarks/test_448584.js
@@ -95,17 +95,19 @@ add_task(function*() {
// clean
tests.forEach(function(aTest) {
aTest.clean();
});
// restore json file
try {
yield BookmarkJSONUtils.importFromFile(jsonFile, true);
- } catch (ex) { do_throw("couldn't import the exported file: " + ex); }
+ } catch (ex) {
+ do_throw("couldn't import the exported file: " + ex);
+}
// validate
tests.forEach(function(aTest) {
aTest.validate(1);
});
// clean up
yield OS.File.remove(jsonFile);
--- a/toolkit/components/places/tests/expiration/test_analyze_runs.js
+++ b/toolkit/components/places/tests/expiration/test_analyze_runs.js
@@ -58,21 +58,27 @@ add_task(function* init_tests() {
title: TEST_TITLE,
url: TEST_URI
});
yield PlacesTestUtils.addVisits(TEST_URI);
let thing = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput,
Ci.nsIAutoCompletePopup,
Ci.nsIAutoCompleteController]),
- get popup() { return thing; },
- get controller() { return thing; },
+ get popup() {
+ return thing;
+},
+ get controller() {
+ return thing;
+},
popupOpen: true,
selectedIndex: 0,
- getValueAt() { return TEST_URI.spec; },
+ getValueAt() {
+ return TEST_URI.spec;
+},
searchString: TEST_TITLE,
};
Services.obs.notifyObservers(thing, TOPIC_AUTOCOMPLETE_FEEDBACK_INCOMING,
null);
});
add_task(function* test_timed() {
clearAnalyzeData();
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconData.js
@@ -18,17 +18,19 @@ var originalFavicon = {
var uniqueFaviconId = 0;
function createFavicon(fileName) {
let tempdir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
// remove any existing file at the path we're about to copy to
let outfile = tempdir.clone();
outfile.append(fileName);
- try { outfile.remove(false); } catch (e) {}
+ try {
+ outfile.remove(false);
+} catch (e) {}
originalFavicon.file.copyToFollowingLinks(tempdir, fileName);
let stream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
stream.init(outfile, 0x02 | 0x08 | 0x10, 0o600, 0);
// append some data that sniffers/encoders will ignore that will distinguish
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
@@ -17,17 +17,19 @@ var originalFavicon = {
var uniqueFaviconId = 0;
function createFavicon(fileName) {
let tempdir = Services.dirsvc.get("TmpD", Ci.nsILocalFile);
// remove any existing file at the path we're about to copy to
let outfile = tempdir.clone();
outfile.append(fileName);
- try { outfile.remove(false); } catch (e) {}
+ try {
+ outfile.remove(false);
+} catch (e) {}
originalFavicon.file.copyToFollowingLinks(tempdir, fileName);
let stream = Cc["@mozilla.org/network/file-output-stream;1"]
.createInstance(Ci.nsIFileOutputStream);
stream.init(outfile, 0x02 | 0x08 | 0x10, 0o600, 0);
// append some data that sniffers/encoders will ignore that will distinguish
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -234,17 +234,19 @@ function compareArrays(aArray1, aArray2)
* Deletes a previously created sqlite file from the profile folder.
*/
function clearDB() {
try {
let file = Services.dirsvc.get('ProfD', Ci.nsIFile);
file.append("places.sqlite");
if (file.exists())
file.remove(false);
- } catch (ex) { dump("Exception: " + ex); }
+ } catch (ex) {
+ dump("Exception: " + ex);
+}
}
/**
* Dumps the rows of a table out to the console.
*
* @param aName
* The name of the table or view to output.
@@ -822,17 +824,19 @@ function promiseIsURIVisited(aURI) {
* @param aIconURI
* The URI of the favicon to be set.
*/
function promiseSetIconForPage(aPageURI, aIconURI) {
let deferred = Promise.defer();
PlacesUtils.favicons.setAndFetchFaviconForPage(
aPageURI, aIconURI, true,
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
- () => { deferred.resolve(); },
+ () => {
+ deferred.resolve();
+},
Services.scriptSecurityManager.getSystemPrincipal());
return deferred.promise;
}
function checkBookmarkObject(info) {
do_check_valid_places_guid(info.guid);
do_check_valid_places_guid(info.parentGuid);
Assert.ok(typeof info.index == "number", "index should be a number");
--- a/toolkit/components/places/tests/history/test_insert.js
+++ b/toolkit/components/places/tests/history/test_insert.js
@@ -172,17 +172,19 @@ add_task(function* test_insert_multiple_
() => PlacesUtils.history.insertMany([validPageInfo, {}]),
/TypeError: PageInfo object must have a url property/,
"passing a second invalid PageInfo object to History.insertMany should throw a TypeError"
);
});
add_task(function* test_history_insertMany() {
const BAD_URLS = ["about:config", "chrome://browser/content/browser.xul"];
- const GOOD_URLS = [1, 2, 3].map(x => { return `http://mozilla.com/${x}`; });
+ const GOOD_URLS = [1, 2, 3].map(x => {
+ return `http://mozilla.com/${x}`;
+});
let makePageInfos = Task.async(function*(urls, filter = x => x) {
let pageInfos = [];
for (let url of urls) {
let uri = NetUtil.newURI(url);
let pageInfo = {
title: `Visit to ${url}`,
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -251,17 +251,19 @@ queryData.prototype = { }
function compareArrayToResult(aArray, aRoot) {
do_print("Comparing Array to Results");
var wasOpen = aRoot.containerOpen;
if (!wasOpen)
aRoot.containerOpen = true;
// check expected number of results against actual
- var expectedResultCount = aArray.filter(function(aEl) { return aEl.isInQuery; }).length;
+ var expectedResultCount = aArray.filter(function(aEl) {
+ return aEl.isInQuery;
+}).length;
if (expectedResultCount != aRoot.childCount) {
// Debugging code for failures.
dump_table("moz_places");
dump_table("moz_historyvisits");
do_print("Found children:");
for (let i = 0; i < aRoot.childCount; i++) {
do_print(aRoot.getChild(i).uri);
}
--- a/toolkit/components/places/tests/queries/test_transitions.js
+++ b/toolkit/components/places/tests/queries/test_transitions.js
@@ -101,17 +101,19 @@ add_task(function* test_transitions() {
visitDate: timeNow++ * 1000,
title: item.title
});
}
// dump_table("moz_places");
// dump_table("moz_historyvisits");
- var numSortFunc = function(a, b) { return (a - b); };
+ var numSortFunc = function(a, b) {
+ return (a - b);
+};
var arrs = testDataTyped.concat(testDataDownload).concat(testDataBookmark)
.sort(numSortFunc);
// Four tests which compare the result of a query to an expected set.
var data = arrs.filter(function(index) {
return (testData[index].uri.match(/arewefastyet\.com/) &&
testData[index].transType ==
Ci.nsINavHistoryService.TRANSITION_DOWNLOAD);
--- a/toolkit/components/places/tests/unit/test_408221.js
+++ b/toolkit/components/places/tests/unit/test_408221.js
@@ -112,22 +112,34 @@ function ensure_tag_results(uris, search
var uri1 = uri("http://site.tld/1");
var uri2 = uri("http://site.tld/2");
var uri3 = uri("http://site.tld/3");
var uri4 = uri("http://site.tld/4");
var uri5 = uri("http://site.tld/5");
var uri6 = uri("http://site.tld/6");
-var tests = [function() { ensure_tag_results([uri1, uri2, uri3], "foo"); },
- function() { ensure_tag_results([uri1, uri2, uri3], "Foo"); },
- function() { ensure_tag_results([uri1, uri2, uri3], "foO"); },
- function() { ensure_tag_results([uri4, uri5, uri6], "bar mud"); },
- function() { ensure_tag_results([uri4, uri5, uri6], "BAR MUD"); },
- function() { ensure_tag_results([uri4, uri5, uri6], "Bar Mud"); }];
+var tests = [function() {
+ ensure_tag_results([uri1, uri2, uri3], "foo");
+},
+ function() {
+ ensure_tag_results([uri1, uri2, uri3], "Foo");
+},
+ function() {
+ ensure_tag_results([uri1, uri2, uri3], "foO");
+},
+ function() {
+ ensure_tag_results([uri4, uri5, uri6], "bar mud");
+},
+ function() {
+ ensure_tag_results([uri4, uri5, uri6], "BAR MUD");
+},
+ function() {
+ ensure_tag_results([uri4, uri5, uri6], "Bar Mud");
+}];
/**
* Properly tags a uri adding it to bookmarks.
*
* @param aURI
* The nsIURI to tag.
* @param aTags
* The tags to add.
--- a/toolkit/components/places/tests/unit/test_adaptive_bug527311.js
+++ b/toolkit/components/places/tests/unit/test_adaptive_bug527311.js
@@ -107,18 +107,22 @@ function addAdaptiveFeedback(aUrl, aSear
}
};
os.addObserver(observer, PLACES_AUTOCOMPLETE_FEEDBACK_UPDATED_TOPIC, false);
let thing = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput,
Ci.nsIAutoCompletePopup,
Ci.nsIAutoCompleteController]),
- get popup() { return thing; },
- get controller() { return thing; },
+ get popup() {
+ return thing;
+},
+ get controller() {
+ return thing;
+},
popupOpen: true,
selectedIndex: 0,
getValueAt: () => aUrl,
searchString: aSearch
};
os.notifyObservers(thing, "autocomplete-will-enter-text", null);
}
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -1554,17 +1554,19 @@ add_task(function* test_array_input_for_
Assert.equal((yield PlacesUtils.promiseBookmarksTree(folderGuid)), null);
// Cleanup
yield PT.clearTransactionsHistory();
});
add_task(function* test_copy_excluding_annotations() {
let folderInfo = createTestFolderInfo();
- let anno = n => { return { name: n, value: 1 } };
+ let anno = n => {
+ return { name: n, value: 1 }
+};
folderInfo.annotations = [anno("a"), anno("b"), anno("c")];
let folderGuid = yield PT.NewFolder(folderInfo).transact();
let ensureAnnosSet = function* (guid, ...expectedAnnoNames) {
let tree = yield PlacesUtils.promiseBookmarksTree(guid);
let annoNames = "annos" in tree ?
tree.annos.map(a => a.name).sort() : [];
Assert.deepEqual(annoNames, expectedAnnoNames);
--- a/toolkit/components/places/tests/unit/test_history_sidebar.js
+++ b/toolkit/components/places/tests/unit/test_history_sidebar.js
@@ -71,17 +71,19 @@ var containers = [
{ label: "" , offset: -days_for_x_months_ago(nowObj, 2) , visible: true },
{ label: "" , offset: -days_for_x_months_ago(nowObj, 3) , visible: true },
{ label: "" , offset: -days_for_x_months_ago(nowObj, 4) , visible: true },
{ label: "Older than 6 months" , offset: -days_for_x_months_ago(nowObj, 5) , visible: true },
];
/* eslint-enable comma-spacing */
var visibleContainers = containers.filter(
- function(aContainer) { return aContainer.visible });
+ function(aContainer) {
+ return aContainer.visible
+});
/**
* Asynchronous task that fills history and checks containers' labels.
*/
function* task_fill_history() {
print("\n\n*** TEST Fill History\n");
// We can't use "now" because our hardcoded offsets would be invalid for some
// date. So we hardcode a date.
--- a/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
+++ b/toolkit/components/places/tests/unit/test_promiseBookmarksTree.js
@@ -8,17 +8,19 @@ function* check_has_child(aParentGuid, a
do_check_true(parentTree.children.find( e => e.guid == aChildGuid ) != null);
}
function* compareToNode(aItem, aNode, aIsRootItem, aExcludedGuids = []) {
// itemId==-1 indicates a non-bookmark node, which is unexpected.
do_check_neq(aNode.itemId, -1);
function check_unset(...aProps) {
- aProps.forEach( p => { do_check_false(p in aItem); } );
+ aProps.forEach( p => {
+ do_check_false(p in aItem);
+} );
}
function strict_eq_check(v1, v2) {
dump("v1: " + v1 + " v2: " + v2 + "\n");
do_check_eq(typeof v1, typeof v2);
do_check_eq(v1, v2);
}
function compare_prop(aItemProp, aNodeProp = aItemProp, aOptional = false) {
if (aOptional && aNode[aNodeProp] === null)
--- a/toolkit/components/places/tests/unit/test_tag_autocomplete_search.js
+++ b/toolkit/components/places/tests/unit/test_tag_autocomplete_search.js
@@ -106,25 +106,43 @@ function ensure_tag_results(results, sea
};
controller.startSearch(searchTerm);
}
var uri1 = uri("http://site.tld/1");
var tests = [
- function test1() { ensure_tag_results(["bar", "Baz", "boo"], "b"); },
- function test2() { ensure_tag_results(["bar", "Baz"], "ba"); },
- function test3() { ensure_tag_results(["bar", "Baz"], "Ba"); },
- function test4() { ensure_tag_results(["bar"], "bar"); },
- function test5() { ensure_tag_results(["Baz"], "Baz"); },
- function test6() { ensure_tag_results([], "barb"); },
- function test7() { ensure_tag_results([], "foo"); },
- function test8() { ensure_tag_results(["first tag, bar", "first tag, Baz"], "first tag, ba"); },
- function test9() { ensure_tag_results(["first tag; bar", "first tag; Baz"], "first tag; ba"); }
+ function test1() {
+ ensure_tag_results(["bar", "Baz", "boo"], "b");
+},
+ function test2() {
+ ensure_tag_results(["bar", "Baz"], "ba");
+},
+ function test3() {
+ ensure_tag_results(["bar", "Baz"], "Ba");
+},
+ function test4() {
+ ensure_tag_results(["bar"], "bar");
+},
+ function test5() {
+ ensure_tag_results(["Baz"], "Baz");
+},
+ function test6() {
+ ensure_tag_results([], "barb");
+},
+ function test7() {
+ ensure_tag_results([], "foo");
+},
+ function test8() {
+ ensure_tag_results(["first tag, bar", "first tag, Baz"], "first tag, ba");
+},
+ function test9() {
+ ensure_tag_results(["first tag; bar", "first tag; Baz"], "first tag; ba");
+}
];
/**
* Test tag autocomplete
*/
function run_test() {
// Search is asynchronous, so don't let the test finish immediately
do_test_pending();
--- a/toolkit/components/printing/content/printPageSetup.js
+++ b/toolkit/components/printing/content/printPageSetup.js
@@ -325,17 +325,19 @@ function loadDialog() {
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_orientation"))
gDialog.orientation.removeAttribute("disabled");
else
gDialog.orientation.setAttribute("disabled", "true");
}
// Give initial focus to the orientation radio group.
// Done on a timeout due to to bug 103197.
- setTimeout( function() { gDialog.orientation.focus(); }, 0 );
+ setTimeout( function() {
+ gDialog.orientation.focus();
+}, 0 );
}
// ---------------------------------------------------
function onLoad() {
// Init gDialog.
initDialog();
if (window.arguments[0] != null) {
--- a/toolkit/components/printing/content/printPreviewProgress.js
+++ b/toolkit/components/printing/content/printPreviewProgress.js
@@ -117,27 +117,31 @@ function getString(stringId) {
var elem = document.getElementById( "dialog.strings." + stringId);
try {
if (elem && elem.childNodes && elem.childNodes[0] &&
elem.childNodes[0].nodeValue)
dialog.strings[stringId] = elem.childNodes[0].nodeValue;
// If unable to fetch string, use an empty string.
else
dialog.strings[stringId] = "";
- } catch (e) { dialog.strings[stringId] = ""; }
+ } catch (e) {
+ dialog.strings[stringId] = "";
+}
}
return dialog.strings[stringId];
}
// If the user presses cancel, tell the app launcher and close the dialog...
function onCancel() {
// Cancel app launcher.
try {
printProgress.processCanceledByUser = true;
- } catch (e) { return true; }
+ } catch (e) {
+ return true;
+}
// don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted.
return false;
}
function doneIniting() {
// called by function timeout in onLoad
printProgress.doneIniting();
--- a/toolkit/components/printing/content/printProgress.js
+++ b/toolkit/components/printing/content/printProgress.js
@@ -165,17 +165,19 @@ function getString( stringId ) {
elem.childNodes[0]
&&
elem.childNodes[0].nodeValue ) {
dialog.strings[stringId] = elem.childNodes[0].nodeValue;
} else {
// If unable to fetch string, use an empty string.
dialog.strings[stringId] = "";
}
- } catch (e) { dialog.strings[stringId] = ""; }
+ } catch (e) {
+ dialog.strings[stringId] = "";
+}
}
return dialog.strings[stringId];
}
function loadDialog() {
}
function replaceInsert( text, index, value ) {
@@ -240,17 +242,19 @@ function onUnload() {
}
}
// If the user presses cancel, tell the app launcher and close the dialog...
function onCancel() {
// Cancel app launcher.
try {
printProgress.processCanceledByUser = true;
- } catch ( exception ) { return true; }
+ } catch ( exception ) {
+ return true;
+}
// don't Close up dialog by returning false, the backend will close the dialog when everything will be aborted.
return false;
}
function doneIniting() {
printProgress.doneIniting();
}
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -460,17 +460,19 @@ var PrintUtils = {
return printSettings;
},
// This observer is called once the progress dialog has been "opened"
_obsPP:
{
observe(aSubject, aTopic, aData) {
// delay the print preview to show the content of the progress dialog
- setTimeout(function() { PrintUtils.enterPrintPreview(); }, 0);
+ setTimeout(function() {
+ PrintUtils.enterPrintPreview();
+}, 0);
},
QueryInterface(iid) {
if (iid.equals(Components.interfaces.nsIObserver) ||
iid.equals(Components.interfaces.nsISupportsWeakReference) ||
iid.equals(Components.interfaces.nsISupports))
return this;
throw Components.results.NS_NOINTERFACE;
--- a/toolkit/components/printing/content/printdialog.js
+++ b/toolkit/components/printing/content/printdialog.js
@@ -132,17 +132,19 @@ function getPrinters() {
selectElement.clearList();
var printerEnumerator;
try {
printerEnumerator =
Components.classes["@mozilla.org/gfx/printerenumerator;1"]
.getService(Components.interfaces.nsIPrinterEnumerator)
.printerNameList;
- } catch (e) { printerEnumerator = null; }
+ } catch (e) {
+ printerEnumerator = null;
+}
selectElement.appendPrinterNames(printerEnumerator);
selectElement.listElement.value = printService.defaultPrinterName;
// make sure we load the prefs for the initially selected printer
setPrinterDefaultsForSelectedPrinter();
}
--- a/toolkit/components/prompts/src/SharedPromptUtils.jsm
+++ b/toolkit/components/prompts/src/SharedPromptUtils.jsm
@@ -129,17 +129,19 @@ this.EnableDelayHelper.prototype = {
startOnFocusDelay() {
if (this._focusTimer)
return;
this._focusTimer = Cc["@mozilla.org/timer;1"]
.createInstance(Ci.nsITimer);
this._focusTimer.initWithCallback(
- () => { this.onFocusTimeout(); },
+ () => {
+ this.onFocusTimeout();
+},
this.delayTime,
Ci.nsITimer.TYPE_ONE_SHOT
);
},
onFocusTimeout() {
this._focusTimer = null;
this.enableDialog();
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -102,19 +102,25 @@ const DAY_IN_MS = 86400000; // 1 day in
const MAX_SEARCH_TOKENS = 10;
const NOOP = function noop() {};
var supportsDeletedTable = AppConstants.platform == "android";
var Prefs = {
initialized: false,
- get debug() { this.ensureInitialized(); return this._debug; },
- get enabled() { this.ensureInitialized(); return this._enabled; },
- get expireDays() { this.ensureInitialized(); return this._expireDays; },
+ get debug() {
+ this.ensureInitialized(); return this._debug;
+},
+ get enabled() {
+ this.ensureInitialized(); return this._enabled;
+},
+ get expireDays() {
+ this.ensureInitialized(); return this._expireDays;
+},
ensureInitialized() {
if (this.initialized)
return;
this.initialized = true;
this._debug = Services.prefs.getBoolPref("browser.formfill.debug");
@@ -1104,13 +1110,15 @@ this.FormHistory = {
expireOldEntriesDeletion(expireTime, aBeginningCount);
},
handleError(aError) {
log("expireStartCountFailure");
}
});
},
- shutdown: function shutdown() { dbClose(true); }
+ shutdown: function shutdown() {
+ dbClose(true);
+}
};
// Prevent add-ons from redefining this API
Object.freeze(FormHistory);
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -416,17 +416,19 @@ FormAutoComplete.prototype = {
// Start with an empty list.
let result = aDatalistResult ?
new FormAutoCompleteResult(client, [], aInputName, aUntrimmedSearchString, null) :
emptyResult;
let processEntry = (aEntries) => {
if (aField && aField.maxLength > -1) {
result.entries =
- aEntries.filter(function(el) { return el.text.length <= aField.maxLength; });
+ aEntries.filter(function(el) {
+ return el.text.length <= aField.maxLength;
+});
} else {
result.entries = aEntries;
}
if (aDatalistResult && aDatalistResult.matchCount > 0) {
result = this.mergeResults(result, aDatalistResult);
}
--- a/toolkit/components/satchel/nsFormHistory.js
+++ b/toolkit/components/satchel/nsFormHistory.js
@@ -853,17 +853,19 @@ FormHistory.prototype = {
let connectionDescriptor = Object.getOwnPropertyDescriptor(FormHistory.prototype, "dbConnection");
// Return if the database hasn't been opened.
if (!connectionDescriptor || connectionDescriptor.value === undefined)
return;
let completed = false;
try {
- this.dbConnection.asyncClose(function() { completed = true; });
+ this.dbConnection.asyncClose(function() {
+ completed = true;
+});
} catch (e) {
completed = true;
Components.utils.reportError(e);
}
let thread = Services.tm.currentThread;
while (aBlocking && !completed) {
thread.processNextEvent(true);
--- a/toolkit/components/satchel/test/browser/browser_privbrowsing_perwindowpb.js
+++ b/toolkit/components/satchel/test/browser/browser_privbrowsing_perwindowpb.js
@@ -40,17 +40,19 @@ add_task(function* test() {
doneCounting.resolve();
}
});
yield doneCounting.promise;
}
function testOnWindow(aOptions, aCallback) {
return BrowserTestUtils.openNewBrowserWindow(aOptions)
- .then(win => { windowsToClose.push(win); return win; });
+ .then(win => {
+ windowsToClose.push(win); return win;
+});
}
yield testOnWindow({private: true}).then((aWin) => {
return Task.spawn(doTest(false, aWin));
});
// Test when not on private mode after visiting a site on private
--- a/toolkit/components/satchel/test/parent_utils.js
+++ b/toolkit/components/satchel/test/parent_utils.js
@@ -46,17 +46,19 @@ var ParentUtils = {
let obj = {};
if (name)
obj.fieldname = name;
if (value)
obj.value = value;
let count = 0;
let listener = {
- handleResult(result) { count = result },
+ handleResult(result) {
+ count = result
+},
handleError(error) {
assert.ok(false, error);
sendAsyncMessage("entriesCounted", { ok: false });
},
handleCompletion(reason) {
if (!reason) {
sendAsyncMessage("entriesCounted", { ok: true, count });
}
--- a/toolkit/components/satchel/test/satchel_common.js
+++ b/toolkit/components/satchel/test/satchel_common.js
@@ -134,17 +134,19 @@ function checkForSave(name, value, messa
function getFormSubmitButton(formNum) {
var form = $("form" + formNum); // by id, not name
ok(form != null, "getting form " + formNum);
// we can't just call form.submit(), because that doesn't seem to
// invoke the form onsubmit handler.
var button = form.firstChild;
- while (button && button.type != "submit") { button = button.nextSibling; }
+ while (button && button.type != "submit") {
+ button = button.nextSibling;
+}
ok(button != null, "getting form submit button");
return button;
}
// Count the number of entries with the given name and value, and call then(number)
// when done. If name or value is null, then the value of that field does not matter.
function countEntries(name, value, then = null) {
--- a/toolkit/components/satchel/test/unit/head_satchel.js
+++ b/toolkit/components/satchel/test/unit/head_satchel.js
@@ -38,17 +38,19 @@ const isGUID = /[A-Za-z0-9\+\/]{16}/;
// Find form history entries.
function searchEntries(terms, params, iter) {
let results = [];
FormHistory.search(terms, params, { handleResult: result => results.push(result),
handleError(error) {
do_throw("Error occurred searching form history: " + error);
},
- handleCompletion(reason) { if (!reason) iter.next(results); }
+ handleCompletion(reason) {
+ if (!reason) iter.next(results);
+}
});
}
// Count the number of entries with the given name and value, and call then(number)
// when done. If name or value is null, then the value of that field does not matter.
function countEntries(name, value, then) {
var obj = {};
if (name !== null)
@@ -56,17 +58,19 @@ function countEntries(name, value, then)
if (value !== null)
obj.value = value;
let count = 0;
FormHistory.count(obj, { handleResult: result => count = result,
handleError(error) {
do_throw("Error occurred searching form history: " + error);
},
- handleCompletion(reason) { if (!reason) then(count); }
+ handleCompletion(reason) {
+ if (!reason) then(count);
+}
});
}
// Perform a single form history update and call then() when done.
function updateEntry(op, name, value, then) {
var obj = { op };
if (name !== null)
obj.fieldname = name;
@@ -82,17 +86,19 @@ function addEntry(name, value, then) {
firstUsed: now, lastUsed: now }, then);
}
// Wrapper around FormHistory.update which handles errors. Calls then() when done.
function updateFormHistory(changes, then) {
FormHistory.update(changes, { handleError(error) {
do_throw("Error occurred updating form history: " + error);
},
- handleCompletion(reason) { if (!reason) then(); },
+ handleCompletion(reason) {
+ if (!reason) then();
+},
});
}
/**
* Logs info to the console in the standard way (includes the filename).
*
* @param aMessage
* The message to log to the console.
--- a/toolkit/components/satchel/test/unit/test_async_expire.js
+++ b/toolkit/components/satchel/test/unit/test_async_expire.js
@@ -7,18 +7,22 @@ var currentTestIndex = 0;
function triggerExpiration() {
// We can't easily fake a "daily idle" event, so for testing purposes form
// history listens for another notification to trigger an immediate
// expiration.
Services.obs.notifyObservers(null, "formhistory-expire-now", null);
}
-var checkExists = function(num) { do_check_true(num > 0); next_test(); }
-var checkNotExists = function(num) { do_check_true(!num); next_test(); }
+var checkExists = function(num) {
+ do_check_true(num > 0); next_test();
+}
+var checkNotExists = function(num) {
+ do_check_true(!num); next_test();
+}
var TestObserver = {
QueryInterface : XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
observe(subject, topic, data) {
do_check_eq(topic, "satchel-storage-changed");
if (data == "formhistory-expireoldentries") {
@@ -61,17 +65,19 @@ function* tests() {
testfile.copyTo(profileDir, "formhistory.sqlite");
do_check_true(dbFile.exists());
// We're going to clear this at the end, so it better have the default value now.
do_check_false(Services.prefs.prefHasUserValue("browser.formfill.expire_days"));
// Sanity check initial state
- yield countEntries(null, null, function(num) { do_check_eq(508, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(508, num); next_test();
+});
yield countEntries("name-A", "value-A", checkExists); // lastUsed == distant past
yield countEntries("name-B", "value-B", checkExists); // lastUsed == distant future
do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
// Add a new entry
yield countEntries("name-C", "value-C", checkNotExists);
yield addEntry("name-C", "value-C", next_test);
@@ -106,59 +112,73 @@ function* tests() {
yield updateFormHistory(updateLastUsed(results, 11), next_test);
results = yield searchEntries(["guid"], { lastUsed: 9 }, iter);
yield updateFormHistory(updateLastUsed(results, 9), next_test);
yield countEntries("name-A", "value-A", checkExists);
yield countEntries("181DaysOld", "foo", checkExists);
yield countEntries("179DaysOld", "foo", checkExists);
- yield countEntries(null, null, function(num) { do_check_eq(509, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(509, num); next_test();
+});
// 2 entries are expected to expire.
triggerExpiration();
yield;
yield countEntries("name-A", "value-A", checkNotExists);
yield countEntries("181DaysOld", "foo", checkNotExists);
yield countEntries("179DaysOld", "foo", checkExists);
- yield countEntries(null, null, function(num) { do_check_eq(507, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(507, num); next_test();
+});
// And again. No change expected.
triggerExpiration();
yield;
- yield countEntries(null, null, function(num) { do_check_eq(507, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(507, num); next_test();
+});
// Set formfill pref to 30 days.
Services.prefs.setIntPref("browser.formfill.expire_days", 30);
yield countEntries("179DaysOld", "foo", checkExists);
yield countEntries("bar", "31days", checkExists);
yield countEntries("bar", "29days", checkExists);
- yield countEntries(null, null, function(num) { do_check_eq(507, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(507, num); next_test();
+});
triggerExpiration();
yield;
yield countEntries("179DaysOld", "foo", checkNotExists);
yield countEntries("bar", "31days", checkNotExists);
yield countEntries("bar", "29days", checkExists);
- yield countEntries(null, null, function(num) { do_check_eq(505, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(505, num); next_test();
+});
// Set override pref to 10 days and expire. This expires a large batch of
// entries, and should trigger a VACCUM to reduce file size.
Services.prefs.setIntPref("browser.formfill.expire_days", 10);
yield countEntries("bar", "29days", checkExists);
yield countEntries("9DaysOld", "foo", checkExists);
- yield countEntries(null, null, function(num) { do_check_eq(505, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(505, num); next_test();
+});
triggerExpiration();
yield;
yield countEntries("bar", "29days", checkNotExists);
yield countEntries("9DaysOld", "foo", checkExists);
yield countEntries("name-B", "value-B", checkExists);
yield countEntries("name-C", "value-C", checkExists);
- yield countEntries(null, null, function(num) { do_check_eq(3, num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_eq(3, num); next_test();
+});
test_finished();
}
--- a/toolkit/components/satchel/test/unit/test_db_update_v999a.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v999a.js
@@ -34,23 +34,29 @@ function* tests() {
var destFile = profileDir.clone();
destFile.append("formhistory.sqlite");
if (destFile.exists())
destFile.remove(false);
testfile.copyTo(profileDir, "formhistory.sqlite");
do_check_eq(999, getDBVersion(testfile));
- let checkZero = function(num) { do_check_eq(num, 0); next_test(); }
- let checkOne = function(num) { do_check_eq(num, 1); next_test(); }
+ let checkZero = function(num) {
+ do_check_eq(num, 0); next_test();
+}
+ let checkOne = function(num) {
+ do_check_eq(num, 1); next_test();
+}
// ===== 1 =====
testnum++;
// Check for expected contents.
- yield countEntries(null, null, function(num) { do_check_true(num > 0); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_true(num > 0); next_test();
+});
yield countEntries("name-A", "value-A", checkOne);
yield countEntries("name-B", "value-B", checkOne);
yield countEntries("name-C", "value-C1", checkOne);
yield countEntries("name-C", "value-C2", checkOne);
yield countEntries("name-E", "value-E", checkOne);
// check for downgraded schema.
do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
--- a/toolkit/components/satchel/test/unit/test_db_update_v999b.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v999b.js
@@ -39,35 +39,41 @@ function* tests() {
var bakFile = profileDir.clone();
bakFile.append("formhistory.sqlite.corrupt");
if (bakFile.exists())
bakFile.remove(false);
testfile.copyTo(profileDir, "formhistory.sqlite");
do_check_eq(999, getDBVersion(testfile));
- let checkZero = function(num) { do_check_eq(num, 0); next_test(); }
- let checkOne = function(num) { do_check_eq(num, 1); next_test(); }
+ let checkZero = function(num) {
+ do_check_eq(num, 0); next_test();
+}
+ let checkOne = function(num) {
+ do_check_eq(num, 1); next_test();
+}
// ===== 1 =====
testnum++;
// Open the DB, ensure that a backup of the corrupt DB is made.
// DB init is done lazily so the DB shouldn't be created yet.
do_check_false(bakFile.exists());
// Doing any request to the DB should create it.
yield countEntries("", "", next_test);
do_check_true(bakFile.exists());
bakFile.remove(false);
// ===== 2 =====
testnum++;
// File should be empty
- yield countEntries(null, null, function(num) { do_check_false(num); next_test(); });
+ yield countEntries(null, null, function(num) {
+ do_check_false(num); next_test();
+});
yield countEntries("name-A", "value-A", checkZero);
// check for current schema.
do_check_eq(CURRENT_SCHEMA, FormHistory.schemaVersion);
// ===== 3 =====
testnum++;
// Try adding an entry
yield updateEntry("add", "name-A", "value-A", next_test);
--- a/toolkit/components/satchel/test/unit/test_history_api.js
+++ b/toolkit/components/satchel/test/unit/test_history_api.js
@@ -76,24 +76,28 @@ function promiseSearchEntries(terms, par
let deferred = Promise.defer();
let results = [];
FormHistory.search(terms, params,
{ handleResult: result => results.push(result),
handleError(error) {
do_throw("Error occurred searching form history: " + error);
deferred.reject(error);
},
- handleCompletion(reason) { if (!reason) deferred.resolve(results); }
+ handleCompletion(reason) {
+ if (!reason) deferred.resolve(results);
+}
});
return deferred.promise;
}
function promiseCountEntries(name, value, checkFn) {
let deferred = Promise.defer();
- countEntries(name, value, function(result) { checkFn(result); deferred.resolve(); } );
+ countEntries(name, value, function(result) {
+ checkFn(result); deferred.resolve();
+} );
return deferred.promise;
}
add_task(function* () {
let oldSupportsDeletedTable = FormHistory._supportsDeletedTable;
FormHistory._supportsDeletedTable = true;
try {
@@ -105,18 +109,22 @@ add_task(function* () {
// Cleanup from any previous tests or failures.
var destFile = profileDir.clone();
destFile.append("formhistory.sqlite");
if (destFile.exists())
destFile.remove(false);
testfile.copyTo(profileDir, "formhistory.sqlite");
- function checkExists(num) { do_check_true(num > 0); }
- function checkNotExists(num) { do_check_true(num == 0); }
+ function checkExists(num) {
+ do_check_true(num > 0);
+}
+ function checkNotExists(num) {
+ do_check_true(num == 0);
+}
// ===== 1 =====
// Check initial state is as expected
testnum++;
yield promiseCountEntries("name-A", null, checkExists);
yield promiseCountEntries("name-B", null, checkExists);
yield promiseCountEntries("name-C", null, checkExists);
yield promiseCountEntries("name-D", null, checkExists);
@@ -162,17 +170,19 @@ add_task(function* () {
// Cannot use promiseCountEntries when name and value are null because it treats null values as not set
// and here a search should be done explicity for null.
deferred = Promise.defer();
yield FormHistory.count({ fieldname: null, value: null },
{ handleResult: result => checkNotExists(result),
handleError(error) {
do_throw("Error occurred searching form history: " + error);
},
- handleCompletion(reason) { if (!reason) deferred.resolve() }
+ handleCompletion(reason) {
+ if (!reason) deferred.resolve()
+}
});
yield deferred.promise;
// ===== 3 =====
// Test removeEntriesForName with a single matching value
testnum++;
yield promiseUpdateEntry("remove", "name-A", null);
@@ -407,33 +417,41 @@ add_task(function* () {
// Check update fails if form history is disabled and the operation is not a
// pure removal.
testnum++;
Services.prefs.setBoolPref("browser.formfill.enable", false);
// Cannot use arrow functions, see bug 1237961.
Assert.rejects(promiseUpdate(
{ op : "bump", fieldname: "field5", value: "value5" }),
- function(err) { return err.result == Ci.mozIStorageError.MISUSE; },
+ function(err) {
+ return err.result == Ci.mozIStorageError.MISUSE;
+},
"bumping when form history is disabled should fail");
Assert.rejects(promiseUpdate(
{ op : "add", fieldname: "field5", value: "value5" }),
- function(err) { return err.result == Ci.mozIStorageError.MISUSE; },
+ function(err) {
+ return err.result == Ci.mozIStorageError.MISUSE;
+},
"Adding when form history is disabled should fail");
Assert.rejects(promiseUpdate([
{ op : "update", fieldname: "field5", value: "value5" },
{ op : "remove", fieldname: "field5", value: "value5" }
]),
- function(err) { return err.result == Ci.mozIStorageError.MISUSE; },
+ function(err) {
+ return err.result == Ci.mozIStorageError.MISUSE;
+},
"mixed operations when form history is disabled should fail");
Assert.rejects(promiseUpdate([
null, undefined, "", 1, {},
{ op : "remove", fieldname: "field5", value: "value5" }
]),
- function(err) { return err.result == Ci.mozIStorageError.MISUSE; },
+ function(err) {
+ return err.result == Ci.mozIStorageError.MISUSE;
+},
"Invalid entries when form history is disabled should fail");
// Remove should work though.
yield promiseUpdate([{ op: "remove", fieldname: "field5", value: null },
{ op: "remove", fieldname: null, value: null }]);
Services.prefs.clearUserPref("browser.formfill.enable");
} catch (e) {
--- a/toolkit/components/satchel/test/unit/test_notify.js
+++ b/toolkit/components/satchel/test/unit/test_notify.js
@@ -54,57 +54,65 @@ var testdesc = "Setup of test form histo
var entry1 = ["entry1", "value1"];
/* ========== 1 ========== */
testnum = 1;
testdesc = "Initial connection to storage module"
yield updateEntry("remove", null, null, next_test);
-yield countEntries(null, null, function(num) { do_check_false(num, "Checking initial DB is empty"); next_test(); });
+yield countEntries(null, null, function(num) {
+ do_check_false(num, "Checking initial DB is empty"); next_test();
+});
// Add the observer
var os = Cc["@mozilla.org/observer-service;1"].
getService(Ci.nsIObserverService);
os.addObserver(TestObserver, "satchel-storage-changed", false);
/* ========== 2 ========== */
testnum++;
testdesc = "addEntry";
expectedNotification = "formhistory-add";
expectedData = entry1;
yield updateEntry("add", entry1[0], entry1[1], next_test);
do_check_eq(expectedNotification, null); // check that observer got a notification
-yield countEntries(entry1[0], entry1[1], function(num) { do_check_true(num > 0); next_test(); });
+yield countEntries(entry1[0], entry1[1], function(num) {
+ do_check_true(num > 0); next_test();
+});
/* ========== 3 ========== */
testnum++;
testdesc = "modifyEntry";
expectedNotification = "formhistory-update";
expectedData = entry1;
// will update previous entry
yield updateEntry("update", entry1[0], entry1[1], next_test);
-yield countEntries(entry1[0], entry1[1], function(num) { do_check_true(num > 0); next_test(); });
+yield countEntries(entry1[0], entry1[1], function(num) {
+ do_check_true(num > 0); next_test();
+});
do_check_eq(expectedNotification, null);
/* ========== 4 ========== */
testnum++;
testdesc = "removeEntry";
expectedNotification = "formhistory-remove";
expectedData = entry1;
yield updateEntry("remove", entry1[0], entry1[1], next_test);
do_check_eq(expectedNotification, null);
-yield countEntries(entry1[0], entry1[1], function(num) { do_check_false(num, "doesn't exist after remove"); next_test(); });
+yield countEntries(entry1[0], entry1[1], function(num) {
+ do_check_false(num, "doesn't exist after remove"); next_test();
+});
/* ========== 5 ========== */
testnum++;
testdesc = "removeAllEntries";
expectedNotification = "formhistory-remove";
expectedData = null; // no data expected
yield updateEntry("remove", null, null, next_test);
@@ -134,17 +142,19 @@ do_check_eq(expectedNotification, null);
/* ========== 8 ========== */
testnum++;
testdesc = "removeEntriesByTimeframe";
expectedNotification = "formhistory-remove";
expectedData = [10, 99999999999];
yield FormHistory.update({ op: "remove", firstUsedStart: expectedData[0], firstUsedEnd: expectedData[1] },
- { handleCompletion(reason) { if (!reason) next_test() },
+ { handleCompletion(reason) {
+ if (!reason) next_test()
+},
handleErrors(error) {
do_throw("Error occurred updating form history: " + error);
}
});
do_check_eq(expectedNotification, null);
os.removeObserver(TestObserver, "satchel-storage-changed", false);
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -3785,17 +3785,19 @@ SearchService.prototype = {
addedEngines[engine.name] = engine;
} else {
// We need to call _saveSortedEngineList so this gets sorted out.
needToSaveEngineList = true;
}
}
// Filter out any nulls for engines that may have been removed
- var filteredEngines = this.__sortedEngines.filter(function(a) { return !!a; });
+ var filteredEngines = this.__sortedEngines.filter(function(a) {
+ return !!a;
+});
if (this.__sortedEngines.length != filteredEngines.length)
needToSaveEngineList = true;
this.__sortedEngines = filteredEngines;
if (needToSaveEngineList)
this._saveSortedEngineList();
} else {
// The DB isn't being used, so just read the engine order from the prefs
@@ -4163,17 +4165,19 @@ SearchService.prototype = {
for (let name in this._engines) {
let e = this._engines[name];
// Unhide all default engines
if (e.hidden && e._isDefault)
e.hidden = false;
}
},
- get defaultEngine() { return this.currentEngine; },
+ get defaultEngine() {
+ return this.currentEngine;
+},
set defaultEngine(val) {
this.currentEngine = val;
},
get currentEngine() {
this._ensureInitialized();
if (!this._currentEngine) {
--- a/toolkit/components/telemetry/TelemetryEnvironment.jsm
+++ b/toolkit/components/telemetry/TelemetryEnvironment.jsm
@@ -431,17 +431,19 @@ EnvironmentAddonBuilder.prototype = {
try {
AddonManager.shutdown.addBlocker("EnvironmentAddonBuilder",
() => this._shutdownBlocker());
} catch (err) {
return Promise.reject(err);
}
this._pendingTask = this._updateAddons().then(
- () => { this._pendingTask = null; },
+ () => {
+ this._pendingTask = null;
+},
(err) => {
this._environment._log.error("init - Exception in _updateAddons", err);
this._pendingTask = null;
}
);
return this._pendingTask;
},
--- a/toolkit/components/telemetry/TelemetryStorage.jsm
+++ b/toolkit/components/telemetry/TelemetryStorage.jsm
@@ -647,18 +647,22 @@ var TelemetryStorageImpl = {
* Save an archived ping to disk.
*
* @param {object} ping The ping data to archive.
* @return {promise} Promise that is resolved when the ping is successfully archived.
*/
saveArchivedPing(ping) {
let promise = this._saveArchivedPingTask(ping);
this._activelyArchiving.add(promise);
- promise.then((r) => { this._activelyArchiving.delete(promise); },
- (e) => { this._activelyArchiving.delete(promise); });
+ promise.then((r) => {
+ this._activelyArchiving.delete(promise);
+},
+ (e) => {
+ this._activelyArchiving.delete(promise);
+});
return promise;
},
_saveArchivedPingTask: Task.async(function*(ping) {
const creationDate = new Date(ping.creationDate);
if (this._archivedPings.has(ping.id)) {
const data = this._archivedPings.get(ping.id);
if (data.timestampCreated > creationDate.getTime()) {
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -180,19 +180,25 @@ function checkPingFormat(aPing, aType, a
Assert.equal("clientId" in aPing, aHasClientId);
Assert.equal("environment" in aPing, aHasEnvironment);
}
function checkPayloadInfo(data) {
const ALLOWED_REASONS = [
"environment-change", "shutdown", "daily", "saved-session", "test-ping"
];
- let numberCheck = arg => { return (typeof arg == "number"); };
- let positiveNumberCheck = arg => { return numberCheck(arg) && (arg >= 0); };
- let stringCheck = arg => { return (typeof arg == "string") && (arg != ""); };
+ let numberCheck = arg => {
+ return (typeof arg == "number");
+};
+ let positiveNumberCheck = arg => {
+ return numberCheck(arg) && (arg >= 0);
+};
+ let stringCheck = arg => {
+ return (typeof arg == "string") && (arg != "");
+};
let revisionCheck = arg => {
return (Services.appinfo.isOfficial) ? stringCheck(arg) : (typeof arg == "string");
};
let uuidCheck = arg => {
return UUID_REGEX.test(arg);
};
let isoDateCheck = arg => {
// We expect use of this version of the ISO format:
@@ -204,18 +210,22 @@ function checkPayloadInfo(data) {
const EXPECTED_INFO_FIELDS_TYPES = {
reason: stringCheck,
revision: revisionCheck,
timezoneOffset: numberCheck,
sessionId: uuidCheck,
subsessionId: uuidCheck,
// Special cases: previousSessionId and previousSubsessionId are null on first run.
- previousSessionId: (arg) => { return (arg) ? uuidCheck(arg) : true; },
- previousSubsessionId: (arg) => { return (arg) ? uuidCheck(arg) : true; },
+ previousSessionId: (arg) => {
+ return (arg) ? uuidCheck(arg) : true;
+},
+ previousSubsessionId: (arg) => {
+ return (arg) ? uuidCheck(arg) : true;
+},
subsessionCounter: positiveNumberCheck,
profileSubsessionCounter: positiveNumberCheck,
sessionStartDate: isoDateCheck,
subsessionStartDate: isoDateCheck,
subsessionLength: positiveNumberCheck,
};
for (let f in EXPECTED_INFO_FIELDS_TYPES) {
--- a/toolkit/components/viewconfig/content/config.js
+++ b/toolkit/components/viewconfig/content/config.js
@@ -34,53 +34,79 @@ var gPrefArray = [];
var gPrefView = gPrefArray; // share the JS array
var gSortedColumn = "prefCol";
var gSortFunction = null;
var gSortDirection = 1; // 1 is ascending; -1 is descending
var gConfigBundle = null;
var gFilter = null;
var view = {
- get rowCount() { return gPrefView.length; },
+ get rowCount() {
+ return gPrefView.length;
+},
getCellText(index, col) {
if (!(index in gPrefView))
return "";
var value = gPrefView[index][col.id];
switch (col.id) {
case "lockCol":
return gLockStrs[value];
case "typeCol":
return gTypeStrs[value];
default:
return value;
}
},
- getRowProperties(index) { return ""; },
+ getRowProperties(index) {
+ return "";
+},
getCellProperties(index, col) {
if (index in gPrefView)
return gLockProps[gPrefView[index].lockCol];
return "";
},
- getColumnProperties(col) { return ""; },
+ getColumnProperties(col) {
+ return "";
+},
treebox : null,
selection : null,
- isContainer(index) { return false; },
- isContainerOpen(index) { return false; },
- isContainerEmpty(index) { return false; },
- isSorted() { return true; },
- canDrop(index, orientation) { return false; },
+ isContainer(index) {
+ return false;
+},
+ isContainerOpen(index) {
+ return false;
+},
+ isContainerEmpty(index) {
+ return false;
+},
+ isSorted() {
+ return true;
+},
+ canDrop(index, orientation) {
+ return false;
+},
drop(row, orientation) {},
- setTree(out) { this.treebox = out; },
- getParentIndex(rowIndex) { return -1; },
- hasNextSibling(rowIndex, afterIndex) { return false; },
- getLevel(index) { return 1; },
- getImageSrc(row, col) { return ""; },
+ setTree(out) {
+ this.treebox = out;
+},
+ getParentIndex(rowIndex) {
+ return -1;
+},
+ hasNextSibling(rowIndex, afterIndex) {
+ return false;
+},
+ getLevel(index) {
+ return 1;
+},
+ getImageSrc(row, col) {
+ return "";
+},
toggleOpenState(index) {},
cycleHeader(col) {
var index = this.selection.currentIndex;
if (col.id == gSortedColumn) {
gSortDirection = -gSortDirection;
gPrefArray.reverse();
if (gPrefView != gPrefArray)
gPrefView.reverse();
@@ -104,24 +130,30 @@ var view = {
this.treebox.invalidate();
if (index >= 0) {
this.selection.select(index);
this.treebox.ensureRowIsVisible(index);
}
},
selectionChanged() {},
cycleCell(row, col) {},
- isEditable(row, col) { return false; },
- isSelectable(row, col) { return false; },
+ isEditable(row, col) {
+ return false;
+},
+ isSelectable(row, col) {
+ return false;
+},
setCellValue(row, col, value) {},
setCellText(row, col, value) {},
performAction(action) {},
performActionOnRow(action, row) {},
performActionOnCell(action, row, col) {},
- isSeparator(index) { return false; }
+ isSeparator(index) {
+ return false;
+}
};
// find the index in gPrefView of a pref object
// or -1 if it does not exist in the filtered view
function getViewIndexOfPref(pref) {
var low = -1, high = gPrefView.length;
var index = (low + high) >> 1;
while (index > low) {
--- a/toolkit/components/viewsource/content/viewSourceUtils.js
+++ b/toolkit/components/viewsource/content/viewSourceUtils.js
@@ -477,20 +477,28 @@ var gViewSourceUtils = {
// we failed loading it with the external editor.
Components.utils.reportError(ex);
gViewSourceUtils.handleCallBack(this.callBack, false, this.data);
} finally {
this.destroy();
}
},
- onLocationChange() { return 0; },
- onProgressChange() { return 0; },
- onStatusChange() { return 0; },
- onSecurityChange() { return 0; },
+ onLocationChange() {
+ return 0;
+},
+ onProgressChange() {
+ return 0;
+},
+ onStatusChange() {
+ return 0;
+},
+ onSecurityChange() {
+ return 0;
+},
webShell: null,
editor: null,
callBack: null,
data: null,
file: null
},
--- a/toolkit/content/aboutProfiles.js
+++ b/toolkit/content/aboutProfiles.js
@@ -71,20 +71,24 @@ function refreshUI() {
isDefault: profile == defaultProfile,
isCurrentProfile: profile == currentProfile });
}
let createButton = document.getElementById('create-button');
createButton.onclick = createProfileWizard;
let restartSafeModeButton = document.getElementById('restart-in-safe-mode-button');
- restartSafeModeButton.onclick = function() { restart(true); }
+ restartSafeModeButton.onclick = function() {
+ restart(true);
+}
let restartNormalModeButton = document.getElementById('restart-button');
- restartNormalModeButton.onclick = function() { restart(false); }
+ restartNormalModeButton.onclick = function() {
+ restart(false);
+}
}
function openDirectory(dir) {
let nsLocalFile = Components.Constructor("@mozilla.org/file/local;1",
"nsILocalFile", "initWithPath");
new nsLocalFile(dir).reveal();
}
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -1515,18 +1515,22 @@ let AutoCompletePopup = {
if (this._input) {
this._input.focus();
}
break;
}
}
},
- get input() { return this._input; },
- get overrideValue() { return null; },
+ get input() {
+ return this._input;
+},
+ get overrideValue() {
+ return null;
+},
set selectedIndex(index) {
sendAsyncMessage("FormAutoComplete:SetSelectedIndex", { index });
},
get selectedIndex() {
// selectedIndex getter must be synchronous because we need the
// correct value when the controller is in controller::HandleEnter.
// We can't easily just let the parent inform us the new value every
// time it changes because not every action that can change the
--- a/toolkit/content/contentAreaUtils.js
+++ b/toolkit/content/contentAreaUtils.js
@@ -1254,20 +1254,28 @@ function openURL(aURL) {
iid.equals(Components.interfaces.nsISupportsWeakReference))
return this;
throw Components.results.NS_ERROR_NO_INTERFACE;
}
}
loadgroup.groupObserver = loadListener;
var uriListener = {
- onStartURIOpen(uri) { return false; },
- doContent(ctype, preferred, request, handler) { return false; },
- isPreferred(ctype, desired) { return false; },
- canHandleContent(ctype, preferred, desired) { return false; },
+ onStartURIOpen(uri) {
+ return false;
+},
+ doContent(ctype, preferred, request, handler) {
+ return false;
+},
+ isPreferred(ctype, desired) {
+ return false;
+},
+ canHandleContent(ctype, preferred, desired) {
+ return false;
+},
loadCookie: null,
parentContentListener: null,
getInterface(iid) {
if (iid.equals(Components.interfaces.nsIURIContentListener))
return this;
if (iid.equals(Components.interfaces.nsILoadGroup))
return loadgroup;
throw Components.results.NS_ERROR_NO_INTERFACE;
--- a/toolkit/content/findUtils.js
+++ b/toolkit/content/findUtils.js
@@ -9,32 +9,40 @@ Components.utils.import("resource://gre/
var gFindBundle;
function nsFindInstData() {}
nsFindInstData.prototype =
{
// set the next three attributes on your object to override the defaults
browser : null,
- get rootSearchWindow() { return this._root || this.window.content; },
- set rootSearchWindow(val) { this._root = val; },
+ get rootSearchWindow() {
+ return this._root || this.window.content;
+},
+ set rootSearchWindow(val) {
+ this._root = val;
+},
get currentSearchWindow() {
if (this._current)
return this._current;
var focusedWindow = this.window.document.commandDispatcher.focusedWindow;
if (!focusedWindow || focusedWindow == this.window)
focusedWindow = this.window.content;
return focusedWindow;
},
- set currentSearchWindow(val) { this._current = val; },
+ set currentSearchWindow(val) {
+ this._current = val;
+},
- get webBrowserFind() { return this.browser.webBrowserFind; },
+ get webBrowserFind() {
+ return this.browser.webBrowserFind;
+},
init() {
var findInst = this.webBrowserFind;
// set up the find to search the focussedWindow, bounded by the content window.
var findInFrames = findInst.QueryInterface(Components.interfaces.nsIWebBrowserFindInFrames);
findInFrames.rootSearchFrame = this.rootSearchWindow;
findInFrames.currentSearchFrame = this.currentSearchWindow;
--- a/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
+++ b/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
@@ -4,17 +4,19 @@
function waitForCondition(condition, nextTest) {
var tries = 0;
var interval = setInterval(function() {
if (condition() || tries >= 30) {
moveOn();
}
tries++;
}, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
+ var moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
function nsDoTestsForAutoCompleteWithComposition(aDescription,
aWindow,
aTarget,
aAutoCompleteController,
aIsFunc,
aGetTargetValueFunc,
@@ -39,17 +41,19 @@ function nsDoTestsForAutoCompleteWithCom
nsDoTestsForAutoCompleteWithComposition.prototype = {
_window: null,
_target: null,
_controller: null,
_DefaultCompleteDefaultIndex: false,
_description: "",
_is: null,
- _getTargetValue() { return "not initialized"; },
+ _getTargetValue() {
+ return "not initialized";
+},
_onFinish: null,
_doTests() {
if (++this._testingIndex == this._tests.length) {
this._controller.input.completeDefaultIndex =
this._DefaultCompleteDefaultIndex;
this._onFinish();
return;
--- a/toolkit/content/tests/chrome/popup_trigger.js
+++ b/toolkit/content/tests/chrome/popup_trigger.js
@@ -75,64 +75,92 @@ var popupTests = [
compareEdge(gTrigger, gMenuPopup, "after_start", 0, 0, testname);
}
},
{
// check that pressing cursor down while there is no selection
// highlights the first item
testname: "cursor down no selection",
events: [ "DOMMenuItemActive item1" ],
- test() { synthesizeKey("VK_DOWN", { }); },
- result(testname) { checkActive(gMenuPopup, "item1", testname); }
+ test() {
+ synthesizeKey("VK_DOWN", { });
+},
+ result(testname) {
+ checkActive(gMenuPopup, "item1", testname);
+}
},
{
// check that pressing cursor up wraps and highlights the last item
testname: "cursor up wrap",
events() {
// No wrapping on menus on Mac
return platformIsMac() ? [] : [ "DOMMenuItemInactive item1", "DOMMenuItemActive last" ]
},
- test() { synthesizeKey("VK_UP", { }); },
+ test() {
+ synthesizeKey("VK_UP", { });
+},
result(testname) {
checkActive(gMenuPopup, platformIsMac() ? "item1" : "last", testname);
}
},
{
// check that pressing cursor down wraps and highlights the first item
testname: "cursor down wrap",
- condition() { return !platformIsMac() },
+ condition() {
+ return !platformIsMac()
+},
events: ["DOMMenuItemInactive last", "DOMMenuItemActive item1" ],
- test() { synthesizeKey("VK_DOWN", { }); },
- result(testname) { checkActive(gMenuPopup, "item1", testname); }
+ test() {
+ synthesizeKey("VK_DOWN", { });
+},
+ result(testname) {
+ checkActive(gMenuPopup, "item1", testname);
+}
},
{
// check that pressing cursor down highlights the second item
testname: "cursor down",
events: [ "DOMMenuItemInactive item1", "DOMMenuItemActive item2" ],
- test() { synthesizeKey("VK_DOWN", { }); },
- result(testname) { checkActive(gMenuPopup, "item2", testname); }
+ test() {
+ synthesizeKey("VK_DOWN", { });
+},
+ result(testname) {
+ checkActive(gMenuPopup, "item2", testname);
+}
},
{
// check that pressing cursor up highlights the second item
testname: "cursor up",
events: [ "DOMMenuItemInactive item2", "DOMMenuItemActive item1" ],
- test() { synthesizeKey("VK_UP", { }); },
- result(testname) { checkActive(gMenuPopup, "item1", testname); }
+ test() {
+ synthesizeKey("VK_UP", { });
+},
+ result(testname) {
+ checkActive(gMenuPopup, "item1", testname);
+}
},
{
// cursor left should not do anything
testname: "cursor left",
- test() { synthesizeKey("VK_LEFT", { }); },
- result(testname) { checkActive(gMenuPopup, "item1", testname); }
+ test() {
+ synthesizeKey("VK_LEFT", { });
+},
+ result(testname) {
+ checkActive(gMenuPopup, "item1", testname);
+}
},
{
// cursor right should not do anything
testname: "cursor right",
- test() { synthesizeKey("VK_RIGHT", { }); },
- result(testname) { checkActive(gMenuPopup, "item1", testname); }
+ test() {
+ synthesizeKey("VK_RIGHT", { });
+},
+ result(testname) {
+ checkActive(gMenuPopup, "item1", testname);
+}
},
{
// check cursor down when a disabled item exists in the menu
testname: "cursor down disabled",
events() {
// On Windows, disabled items are included when navigating, but on
// other platforms, disabled items are skipped over
if (navigator.platform.indexOf("Win") == 0) {
@@ -322,17 +350,19 @@ var popupTests = [
autohide: "thepopup",
steps: ["before_start", "before_end", "after_start", "after_end",
"start_before", "start_after", "end_before", "end_after", "after_pointer", "overlap",
"topcenter topleft", "topright bottomright", "leftcenter topright"],
test(testname, step) {
gMenuPopup.setAttribute("position", step);
gMenuPopup.openPopup(gTrigger, "", 0, 0, false, false);
},
- result(testname, step) { compareEdge(gTrigger, gMenuPopup, step, 0, 0, testname); }
+ result(testname, step) {
+ compareEdge(gTrigger, gMenuPopup, step, 0, 0, testname);
+}
},
{
// this test checks to ensure that the attributes override flag to openPopup
// can be used to override the popup's position. This test also passes an
// event to openPopup to check the trigger node.
testname: "open popup anchored with override",
events: [ "popupshowing thepopup 0010", "popupshown thepopup" ],
test(testname, step) {
@@ -363,17 +393,19 @@ var popupTests = [
testname: "open popup anchored with offsets",
events: [ "popupshowing thepopup", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
// attribute is empty so does not override
gMenuPopup.setAttribute("position", "");
gMenuPopup.openPopup(gTrigger, "before_start", 5, 10, true, true);
},
- result(testname, step) { compareEdge(gTrigger, gMenuPopup, "before_start", 5, 10, testname); }
+ result(testname, step) {
+ compareEdge(gTrigger, gMenuPopup, "before_start", 5, 10, testname);
+}
},
{
// these tests check to ensure that passing an anchor and position
// puts the popup in the right place
testname: "show popup anchored",
condition() {
// only perform this test for popups not in a menu, such as those using
// the popup attribute, as the showPopup implementation in popup.xml
@@ -399,17 +431,19 @@ var popupTests = [
compareEdge(gTrigger, gMenuPopup, pos, 0, 0, testname);
gMenuPopup.removeAttribute("popupanchor");
gMenuPopup.removeAttribute("popupalign");
gMenuPopup.removeAttribute("position");
}
},
{
testname: "show popup with position",
- condition() { return !gIsMenu; },
+ condition() {
+ return !gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
gMenuPopup.showPopup(gTrigger, gScreenX + 60, gScreenY + 15,
"context", "topleft", "bottomright");
},
result(testname, step) {
var rect = gMenuPopup.getBoundingClientRect();
@@ -420,39 +454,47 @@ var popupTests = [
ok(rect.bottom, testname + " bottom is " + rect.bottom);
}
},
{
// if no anchor is supplied to openPopup, it should be opened relative
// to the viewport.
testname: "open popup unanchored",
events: [ "popupshowing thepopup", "popupshown thepopup" ],
- test(testname, step) { gMenuPopup.openPopup(null, "after_start", 6, 8, false); },
+ test(testname, step) {
+ gMenuPopup.openPopup(null, "after_start", 6, 8, false);
+},
result(testname, step) {
var rect = gMenuPopup.getBoundingClientRect();
ok(rect.left == 6 && rect.top == 8 && rect.right && rect.bottom, testname);
}
},
{
testname: "activate menuitem with mouse",
events: [ "DOMMenuInactive thepopup", "command item3",
"popuphiding thepopup", "popuphidden thepopup",
"DOMMenuItemInactive item3" ],
test(testname, step) {
var item3 = document.getElementById("item3");
synthesizeMouse(item3, 4, 4, { });
},
- result(testname, step) { checkClosed("trigger", testname); }
+ result(testname, step) {
+ checkClosed("trigger", testname);
+}
},
{
testname: "close popup",
- condition() { return false; },
+ condition() {
+ return false;
+},
events: [ "popuphiding thepopup", "popuphidden thepopup",
"DOMMenuInactive thepopup" ],
- test(testname, step) { gMenuPopup.hidePopup(); }
+ test(testname, step) {
+ gMenuPopup.hidePopup();
+}
},
{
testname: "open popup at screen",
events: [ "popupshowing thepopup", "popupshown thepopup" ],
test(testname, step) {
gExpectedTriggerNode = "notset";
gMenuPopup.openPopupAtScreen(gScreenX + 24, gScreenY + 20, false);
},
@@ -473,18 +515,22 @@ var popupTests = [
// the menuitem with the M accesskey overrides the earlier menuitem that
// begins with M.
testname: "menuitem accelerator",
events: [ "DOMMenuItemActive amenu", "DOMMenuItemInactive amenu",
"DOMMenuInactive thepopup",
"command amenu", "popuphiding thepopup", "popuphidden thepopup",
"DOMMenuItemInactive amenu"
],
- test() { synthesizeKey("M", { }); },
- result(testname) { checkClosed("trigger", testname); }
+ test() {
+ synthesizeKey("M", { });
+},
+ result(testname) {
+ checkClosed("trigger", testname);
+}
},
{
testname: "open context popup at screen",
events: [ "popupshowing thepopup 0010", "popupshown thepopup" ],
test(testname, step) {
gExpectedTriggerNode = gCachedEvent.target;
gMenuPopup.openPopupAtScreen(gScreenX + 8, gScreenY + 16, true, gCachedEvent);
},
@@ -519,82 +565,94 @@ var popupTests = [
}
},
{
// pressing a letter that doesn't correspond to an accelerator, but does
// correspond to the first letter in a menu's label. The menu should not
// close because there is more than one item corresponding to that letter
testname: "menuitem with non accelerator",
events: [ "DOMMenuItemActive one" ],
- test() { synthesizeKey("O", { }); },
+ test() {
+ synthesizeKey("O", { });
+},
result(testname) {
checkOpen("trigger", testname);
checkActive(gMenuPopup, "one", testname);
}
},
{
// pressing the letter again should select the next one that starts with
// that letter
testname: "menuitem with non accelerator again",
events: [ "DOMMenuItemInactive one", "DOMMenuItemActive submenu" ],
- test() { synthesizeKey("O", { }); },
+ test() {
+ synthesizeKey("O", { });
+},
result(testname) {
// 'submenu' is a menu but it should not be open
checkOpen("trigger", testname);
checkClosed("submenu", testname);
checkActive(gMenuPopup, "submenu", testname);
}
},
{
// open the submenu with the cursor right key
testname: "open submenu with cursor right",
events: [ "popupshowing submenupopup", "DOMMenuItemActive submenuitem",
"popupshown submenupopup" ],
- test() { synthesizeKey("VK_RIGHT", { }); },
+ test() {
+ synthesizeKey("VK_RIGHT", { });
+},
result(testname) {
checkOpen("trigger", testname);
checkOpen("submenu", testname);
checkActive(gMenuPopup, "submenu", testname);
checkActive(document.getElementById("submenupopup"), "submenuitem", testname);
}
},
{
// close the submenu with the cursor left key
testname: "close submenu with cursor left",
events: [ "popuphiding submenupopup", "popuphidden submenupopup",
"DOMMenuItemInactive submenuitem", "DOMMenuInactive submenupopup",
"DOMMenuItemActive submenu" ],
- test() { synthesizeKey("VK_LEFT", { }); },
+ test() {
+ synthesizeKey("VK_LEFT", { });
+},
result(testname) {
checkOpen("trigger", testname);
checkClosed("submenu", testname);
checkActive(gMenuPopup, "submenu", testname);
checkActive(document.getElementById("submenupopup"), "", testname);
}
},
{
// open the submenu with the enter key
testname: "open submenu with enter",
events: [ "popupshowing submenupopup", "DOMMenuItemActive submenuitem",
"popupshown submenupopup" ],
- test() { synthesizeKey("VK_RETURN", { }); },
+ test() {
+ synthesizeKey("VK_RETURN", { });
+},
result(testname) {
checkOpen("trigger", testname);
checkOpen("submenu", testname);
checkActive(gMenuPopup, "submenu", testname);
checkActive(document.getElementById("submenupopup"), "submenuitem", testname);
}
},
{
// close the submenu with the escape key
testname: "close submenu with escape",
events: [ "popuphiding submenupopup", "popuphidden submenupopup",
"DOMMenuItemInactive submenuitem", "DOMMenuInactive submenupopup",
"DOMMenuItemActive submenu" ],
- test() { synthesizeKey("VK_ESCAPE", { }); },
+ test() {
+ synthesizeKey("VK_ESCAPE", { });
+},
result(testname) {
checkOpen("trigger", testname);
checkClosed("submenu", testname);
checkActive(gMenuPopup, "submenu", testname);
checkActive(document.getElementById("submenupopup"), "", testname);
}
},
{
@@ -605,69 +663,79 @@ var popupTests = [
events() {
if (navigator.platform.indexOf("Win") == 0) {
return [ "DOMMenuItemInactive submenu", "DOMMenuItemActive other",
"DOMMenuItemInactive other", "DOMMenuItemActive item1" ];
}
return [ "DOMMenuItemInactive submenu", "DOMMenuItemActive last",
"DOMMenuItemInactive last", "DOMMenuItemActive item1" ];
},
- test() { synthesizeKey("O", { }); synthesizeKey("F", { }); },
+ test() {
+ synthesizeKey("O", { }); synthesizeKey("F", { });
+},
result(testname) {
checkActive(gMenuPopup, "item1", testname);
}
},
{
// pressing a letter that doesn't correspond to an accelerator nor the
// first letter of a menu. This should have no effect.
testname: "menuitem with keypress no accelerator found",
- test() { synthesizeKey("G", { }); },
+ test() {
+ synthesizeKey("G", { });
+},
result(testname) {
checkOpen("trigger", testname);
checkActive(gMenuPopup, "item1", testname);
}
},
{
// when only one menuitem starting with that letter exists, it should be
// selected and the menu closed
testname: "menuitem with non accelerator single",
events: [ "DOMMenuItemInactive item1", "DOMMenuItemActive amenu",
"DOMMenuItemInactive amenu", "DOMMenuInactive thepopup",
"command amenu", "popuphiding thepopup", "popuphidden thepopup",
"DOMMenuItemInactive amenu",
],
- test() { synthesizeKey("M", { }); },
+ test() {
+ synthesizeKey("M", { });
+},
result(testname) {
checkClosed("trigger", testname);
checkActive(gMenuPopup, "", testname);
}
},
{
testname: "open context popup at screen with all modifiers set",
events: [ "popupshowing thepopup 1111", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
gMenuPopup.openPopupAtScreen(gScreenX + 8, gScreenY + 16, true, gCachedEvent2);
}
},
{
testname: "open popup with open property",
events: [ "popupshowing thepopup", "popupshown thepopup" ],
- test(testname, step) { openMenu(gTrigger); },
+ test(testname, step) {
+ openMenu(gTrigger);
+},
result(testname, step) {
checkOpen("trigger", testname);
if (gIsMenu)
compareEdge(gTrigger, gMenuPopup, "after_start", 0, 0, testname);
}
},
{
testname: "open submenu with open property",
events: [ "popupshowing submenupopup", "DOMMenuItemActive submenu",
"popupshown submenupopup" ],
- test(testname, step) { openMenu(document.getElementById("submenu")); },
+ test(testname, step) {
+ openMenu(document.getElementById("submenu"));
+},
result(testname, step) {
checkOpen("trigger", testname);
checkOpen("submenu", testname);
// XXXndeakin
// getBoundingClientRect doesn't seem to working right for submenus
// so disable this test for now
// compareEdge(document.getElementById("submenu"),
// document.getElementById("submenupopup"), "end_before", 0, 0, testname);
@@ -675,154 +743,184 @@ var popupTests = [
},
{
testname: "hidePopup hides entire chain",
events: [ "popuphiding submenupopup", "popuphidden submenupopup",
"popuphiding thepopup", "popuphidden thepopup",
"DOMMenuInactive submenupopup",
"DOMMenuItemInactive submenu", "DOMMenuItemInactive submenu",
"DOMMenuInactive thepopup", ],
- test() { gMenuPopup.hidePopup(); },
+ test() {
+ gMenuPopup.hidePopup();
+},
result(testname, step) {
checkClosed("trigger", testname);
checkClosed("submenu", testname);
}
},
{
testname: "open submenu with open property without parent open",
- test(testname, step) { openMenu(document.getElementById("submenu")); },
+ test(testname, step) {
+ openMenu(document.getElementById("submenu"));
+},
result(testname, step) {
checkClosed("trigger", testname);
checkClosed("submenu", testname);
}
},
{
testname: "open popup with open property and position",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
test(testname, step) {
gMenuPopup.setAttribute("position", "before_start");
openMenu(gTrigger);
},
result(testname, step) {
compareEdge(gTrigger, gMenuPopup, "before_start", 0, 0, testname);
}
},
{
testname: "close popup with open property",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popuphiding thepopup", "popuphidden thepopup",
"DOMMenuInactive thepopup" ],
- test(testname, step) { closeMenu(gTrigger, gMenuPopup); },
- result(testname, step) { checkClosed("trigger", testname); }
+ test(testname, step) {
+ closeMenu(gTrigger, gMenuPopup);
+},
+ result(testname, step) {
+ checkClosed("trigger", testname);
+}
},
{
testname: "open popup with open property, position, anchor and alignment",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
gMenuPopup.setAttribute("position", "start_after");
gMenuPopup.setAttribute("popupanchor", "topright");
gMenuPopup.setAttribute("popupalign", "bottomright");
openMenu(gTrigger);
},
result(testname, step) {
compareEdge(gTrigger, gMenuPopup, "start_after", 0, 0, testname);
}
},
{
testname: "open popup with open property, anchor and alignment",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
gMenuPopup.removeAttribute("position");
gMenuPopup.setAttribute("popupanchor", "bottomright");
gMenuPopup.setAttribute("popupalign", "topright");
openMenu(gTrigger);
},
result(testname, step) {
compareEdge(gTrigger, gMenuPopup, "after_end", 0, 0, testname);
gMenuPopup.removeAttribute("popupanchor");
gMenuPopup.removeAttribute("popupalign");
}
},
{
testname: "focus and cursor down on trigger",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
gTrigger.focus();
synthesizeKey("VK_DOWN", { altKey: !platformIsMac() });
},
result(testname, step) {
checkOpen("trigger", testname);
checkActive(gMenuPopup, "", testname);
}
},
{
testname: "focus and cursor up on trigger",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
test(testname, step) {
gTrigger.focus();
synthesizeKey("VK_UP", { altKey: !platformIsMac() });
},
result(testname, step) {
checkOpen("trigger", testname);
checkActive(gMenuPopup, "", testname);
}
},
{
testname: "select and enter on menuitem",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "DOMMenuItemActive item1", "DOMMenuItemInactive item1",
"DOMMenuInactive thepopup", "command item1",
"popuphiding thepopup", "popuphidden thepopup",
"DOMMenuItemInactive item1" ],
test(testname, step) {
synthesizeKey("VK_DOWN", { });
synthesizeKey("VK_RETURN", { });
},
- result(testname, step) { checkClosed("trigger", testname); }
+ result(testname, step) {
+ checkClosed("trigger", testname);
+}
},
{
testname: "focus trigger and key to open",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
events: [ "popupshowing thepopup", "popupshown thepopup" ],
autohide: "thepopup",
test(testname, step) {
gTrigger.focus();
synthesizeKey(platformIsMac() ? " " : "VK_F4", { });
},
result(testname, step) {
checkOpen("trigger", testname);
checkActive(gMenuPopup, "", testname);
}
},
{
// the menu should only open when the meta or alt key is not pressed
testname: "focus trigger and key wrong modifier",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
test(testname, step) {
gTrigger.focus();
if (platformIsMac())
synthesizeKey("VK_F4", { altKey: true });
else
synthesizeKey("", { metaKey: true });
},
result(testname, step) {
checkClosed("trigger", testname);
}
},
{
testname: "mouse click on disabled menu",
- condition() { return gIsMenu; },
+ condition() {
+ return gIsMenu;
+},
test(testname, step) {
gTrigger.setAttribute("disabled", "true");
synthesizeMouse(gTrigger, 4, 4, { });
},
result(testname, step) {
checkClosed("trigger", testname);
gTrigger.removeAttribute("disabled");
}
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/BrowserView.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/BrowserView.js
@@ -239,20 +239,28 @@ function() {
} else
this._viewportChanged(false, false);
},
getVisibleRect: function getVisibleRect() {
return this._visibleRect.clone();
},
- getVisibleRectX: function getVisibleRectX() { return this._visibleRect.x; },
- getVisibleRectY: function getVisibleRectY() { return this._visibleRect.y; },
- getVisibleRectWidth: function getVisibleRectWidth() { return this._visibleRect.width; },
- getVisibleRectHeight: function getVisibleRectHeight() { return this._visibleRect.height; },
+ getVisibleRectX: function getVisibleRectX() {
+ return this._visibleRect.x;
+},
+ getVisibleRectY: function getVisibleRectY() {
+ return this._visibleRect.y;
+},
+ getVisibleRectWidth: function getVisibleRectWidth() {
+ return this._visibleRect.width;
+},
+ getVisibleRectHeight: function getVisibleRectHeight() {
+ return this._visibleRect.height;
+},
setViewportDimensions: function setViewportDimensions(width, height, causedByZoom) {
let bvs = this._browserViewportState;
if (!bvs)
return;
// [width, height] = clampViewportWH(width, height, vis);
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/FooScript.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/FooScript.js
@@ -49,18 +49,22 @@ BrowserView.prototype = {
// _rightbar
// _topbar
// _browser
// _tileManager
// _viewportRect
// _viewportInnerBoundsRect
//
- get tileManager() { return this._tileManager; },
- get scrollbox() { return this._scrollbox; },
+ get tileManager() {
+ return this._tileManager;
+},
+ get scrollbox() {
+ return this._scrollbox;
+},
init: function init() {
let scrollbox = document.getElementById("scrollbox").boxObject;
this._scrollbox = scrollbox;
let leftbar = document.getElementById("left_sidebar");
let rightbar = document.getElementById("right_sidebar");
let topbar = document.getElementById("top_urlbar");
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js
@@ -49,17 +49,19 @@ function TileManager(appendTile, removeT
this._browserView = browserView;
// callbacks to append / remove a tile to / from the parent
this._appendTile = appendTile;
this._removeTile = removeTile;
// tile cache holds tile objects and pools them under a given capacity
let self = this;
- this._tileCache = new TileManager.TileCache(function(tile) { self._removeTileSafe(tile); },
+ this._tileCache = new TileManager.TileCache(function(tile) {
+ self._removeTileSafe(tile);
+},
-1, -1, 110);
// Rectangle within the viewport that is visible to the user. It is "critical"
// in the sense that it must be rendered as soon as it becomes dirty
this._criticalRect = null;
// Current <browser> DOM element, holding the content we wish to render.
// This is null when no browser is attached
@@ -83,17 +85,19 @@ function TileManager(appendTile, removeT
this._pageLoadMaxBottom = 0;
// Tells us to pan to top before first draw
this._needToPanToTop = false;
}
TileManager.prototype = {
- setBrowser: function setBrowser(b) { this._browser = b; },
+ setBrowser: function setBrowser(b) {
+ this._browser = b;
+},
// This is the callback fired by our client whenever the viewport
// changed somehow (or didn't change but someone asked it to update).
viewportChangeHandler: function viewportChangeHandler(viewportRect,
criticalRect,
boundsSizeChanged,
dirtyAll) {
// !!! --- DEBUG BEGIN -----
@@ -433,29 +437,35 @@ TileManager.TileCache = function TileCac
this._onBeforeTileDetach = onBeforeTileDetach;
this.iBound = iBound;
this.jBound = jBound;
};
TileManager.TileCache.prototype = {
- get size() { return this._nTiles; },
- get numFree() { return this._numFree; },
+ get size() {
+ return this._nTiles;
+},
+ get numFree() {
+ return this._numFree;
+},
// A comparison function that will compare all free tiles as greater
// than all non-free tiles. Useful because, for instance, to shrink
// the tile pool when capacity is lowered, we want to remove all tiles
// at the new cap and beyond, favoring removal of free tiles first.
evictionCmp: function freeTilesLast(a, b) {
if (a.free == b.free) return (a.j == b.j) ? b.i - a.i : b.j - a.j;
return (a.free) ? 1 : -1;
},
- getCapacity: function getCapacity() { return this._capacity; },
+ getCapacity: function getCapacity() {
+ return this._capacity;
+},
setCapacity: function setCapacity(newCap, skipEvictionQueueSort) {
if (newCap < 0)
throw "Cannot set a negative tile cache capacity";
if (newCap == Infinity) {
this._capacity = Infinity;
return;
@@ -745,30 +755,40 @@ TileManager.Tile.prototype = {
// We keep tile objects around after their use for later reuse, so this
// flags true for an unused pooled tile. We don't actually care about
// this from within the Tile prototype, it is here for the cache to use.
this.free = true;
},
// viewport coordinates
- get x() { return this.boundRect.left; },
- get y() { return this.boundRect.top; },
+ get x() {
+ return this.boundRect.left;
+},
+ get y() {
+ return this.boundRect.top;
+},
// the actual canvas that holds the most recently rendered image of this
// canvas
- getContentImage: function getContentImage() { return this._canvas; },
+ getContentImage: function getContentImage() {
+ return this._canvas;
+},
- isDirty: function isDirty() { return this._dirtyTileCanvas; },
+ isDirty: function isDirty() {
+ return this._dirtyTileCanvas;
+},
/**
* Mark this entire tile as dirty (i.e. the whole tile needs to be rendered
* on next render).
*/
- markDirty: function markDirty() { this.updateDirtyRegion(); },
+ markDirty: function markDirty() {
+ this.updateDirtyRegion();
+},
unmarkDirty: function unmarkDirty() {
this._dirtyTileCanvasRect = null;
this._dirtyTileCanvas = false;
},
/**
* This will mark dirty at least everything in dirtyRect (which must be
@@ -844,18 +864,22 @@ TileManager.Tile.prototype = {
"dirty=" + this.isDirty(),
"boundRect=" + this.boundRect].join(', ')
+ ')';
}
return 'Tile(' + this.i + ', ' + this.j + ')';
},
- _hold: function hold() { this.free = false; },
- _release: function release() { this.free = true; }
+ _hold: function hold() {
+ this.free = false;
+},
+ _release: function release() {
+ this.free = true;
+}
};
/**
* A CrawlIterator is in charge of creating and returning subsequent tiles "crawled"
* over as we render tiles lazily. It supports iterator semantics so you can use
* CrawlIterator objects in for..in loops.
@@ -878,17 +902,19 @@ TileManager.CrawlIterator = function Cra
this._stepRect = startRect;
// used to remember tiles that we've reused during this crawl
this._visited = {};
// filters the tiles we've already reused once from being considered victims
// for reuse when we ask the tile cache to create a new tile
let visited = this._visited;
- this._notVisited = function(tile) { return !visited[tile]; };
+ this._notVisited = function(tile) {
+ return !visited[tile];
+};
// a generator that generates tile indices corresponding to tiles intersecting
// the boundary of an expanding rectangle
this._crawlIndices = !startRect ? null : (function indicesGenerator(rect, tc) {
let outOfBounds = false;
while (!outOfBounds) {
// expand rect
rect.left -= kTileWidth;
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/WidgetStack.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/WidgetStack.js
@@ -80,32 +80,44 @@ function wsRect(x, y, w, h) {
this.left = x;
this.top = y;
this.right = x + w;
this.bottom = y + h;
}
wsRect.prototype = {
- get x() { return this.left; },
- get y() { return this.top; },
- get width() { return this.right - this.left; },
- get height() { return this.bottom - this.top; },
+ get x() {
+ return this.left;
+},
+ get y() {
+ return this.top;
+},
+ get width() {
+ return this.right - this.left;
+},
+ get height() {
+ return this.bottom - this.top;
+},
set x(v) {
let diff = this.left - v;
this.left = v;
this.right -= diff;
},
set y(v) {
let diff = this.top - v;
this.top = v;
this.bottom -= diff;
},
- set width(v) { this.right = this.left + v; },
- set height(v) { this.bottom = this.top + v; },
+ set width(v) {
+ this.right = this.left + v;
+},
+ set height(v) {
+ this.bottom = this.top + v;
+},
setRect(x, y, w, h) {
this.left = x;
this.top = y;
this.right = x + w;
this.bottom = y + h;
return this;
@@ -734,17 +746,19 @@ WidgetStack.prototype = {
this._dragCoordsFromClient(clientX, clientY);
let panned = this._dragUpdate();
if (this._viewportUpdateInterval != -1) {
if (this._viewportUpdateTimeout != -1)
clearTimeout(this._viewportUpdateTimeout);
let self = this;
- this._viewportUpdateTimeout = setTimeout(function() { self._viewportDragUpdate(); }, this._viewportUpdateInterval);
+ this._viewportUpdateTimeout = setTimeout(function() {
+ self._viewportDragUpdate();
+}, this._viewportUpdateInterval);
}
return panned;
},
// dragBy: process a mouse move by dx,dy for an ongoing drag
dragBy: function dragBy(dx, dy) {
return this.dragMove(this._dragState.outerCurX + dx, this._dragState.outerCurY + dy);
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/overlay.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/overlay.js
@@ -7,9 +7,11 @@ var tile = {
onMenuItemCommand(e) {
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
promptService.alert(window, this.strings.getString("helloMessageTitle"),
this.strings.getString("helloMessage"));
},
};
-window.addEventListener("load", function(e) { tile.onLoad(e); }, false);
+window.addEventListener("load", function(e) {
+ tile.onLoad(e);
+}, false);
--- a/toolkit/content/tests/widgets/head.js
+++ b/toolkit/content/tests/widgets/head.js
@@ -14,17 +14,19 @@ function waitForCondition(condition, nex
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;
}, 100);
- var moveOn = function() { clearInterval(interval); nextTest(); };
+ var moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
function getAnonElementWithinVideoByAttribute(video, aName, aValue) {
const domUtils = SpecialPowers.Cc["@mozilla.org/inspector/dom-utils;1"].
getService(SpecialPowers.Ci.inIDOMUtils);
const videoControl = domUtils.getChildrenForNode(video, true)[1];
return SpecialPowers.wrap(videoControl.ownerDocument)
--- a/toolkit/content/tests/widgets/tree_shared.js
+++ b/toolkit/content/tests/widgets/tree_shared.js
@@ -884,35 +884,65 @@ function testtag_tree_TreeView_rows(tree
var r;
var columns = tree.columns;
var view = tree.view;
var length = rowInfo.rows.length;
// methods to test along with the functions which determine the expected value
var checkRowMethods =
{
- isContainer(row) { return row.container },
- isContainerOpen(row) { return false },
- isContainerEmpty(row) { return (row.children != null && row.children.rows.length == 0) },
- isSeparator(row) { return row.separator },
- getRowProperties(row) { return row.properties },
- getLevel(row) { return row.level },
- getParentIndex(row) { return row.parent },
- hasNextSibling(row) { return r < startRow + length - 1; }
+ isContainer(row) {
+ return row.container
+},
+ isContainerOpen(row) {
+ return false
+},
+ isContainerEmpty(row) {
+ return (row.children != null && row.children.rows.length == 0)
+},
+ isSeparator(row) {
+ return row.separator
+},
+ getRowProperties(row) {
+ return row.properties
+},
+ getLevel(row) {
+ return row.level
+},
+ getParentIndex(row) {
+ return row.parent
+},
+ hasNextSibling(row) {
+ return r < startRow + length - 1;
+}
};
var checkCellMethods =
{
- getCellText(row, cell) { return cell.label },
- getCellValue(row, cell) { return cell.value },
- getCellProperties(row, cell) { return cell.properties },
- isEditable(row, cell) { return cell.editable },
- isSelectable(row, cell) { return cell.selectable },
- getImageSrc(row, cell) { return cell.image },
- getProgressMode(row, cell) { return cell.mode }
+ getCellText(row, cell) {
+ return cell.label
+},
+ getCellValue(row, cell) {
+ return cell.value
+},
+ getCellProperties(row, cell) {
+ return cell.properties
+},
+ isEditable(row, cell) {
+ return cell.editable
+},
+ isSelectable(row, cell) {
+ return cell.selectable
+},
+ getImageSrc(row, cell) {
+ return cell.image
+},
+ getProgressMode(row, cell) {
+ return cell.mode
+}
};
var failedMethods = { };
var checkMethod, actual, expected;
var toggleOpenStateOK = true;
for (r = startRow; r < length; r++) {
var row = rowInfo.rows[r];
--- a/toolkit/content/tests/widgets/videocontrols_direction_test.js
+++ b/toolkit/content/tests/widgets/videocontrols_direction_test.js
@@ -80,10 +80,12 @@ function runTest(index) {
var refCanvas = new RemoteCanvas(currentTest.ref, "ref-" + index);
refCanvas.load(testCallback);
}
SimpleTest.waitForExplicitFinish();
SimpleTest.requestCompleteLog();
window.addEventListener("load", function() {
- SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function() { runTest(0); });
+ SpecialPowers.pushPrefEnv({"set": [["media.cache_size", 40000]]}, function() {
+ runTest(0);
+});
}, true);
--- a/toolkit/content/treeUtils.js
+++ b/toolkit/content/treeUtils.js
@@ -52,17 +52,19 @@ var gTreeUtils = {
sort(aTree, aView, aDataSet, aColumn, aComparator,
aLastSortColumn, aLastSortAscending) {
var ascending = (aColumn == aLastSortColumn) ? !aLastSortAscending : true;
if (aDataSet.length == 0)
return ascending;
var sortFunction = null;
if (aComparator) {
- sortFunction = function(a, b) { return aComparator(a[aColumn], b[aColumn]); };
+ sortFunction = function(a, b) {
+ return aComparator(a[aColumn], b[aColumn]);
+};
}
aDataSet.sort(sortFunction);
if (!ascending)
aDataSet.reverse();
aTree.view.selection.clearSelection();
aTree.view.selection.select(0);
aTree.treeBoxObject.invalidate();
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -331,17 +331,19 @@ Submitter.prototype = {
let p = Promise.resolve();
let id = this.id;
if (this.recordSubmission) {
p = manager.ensureCrashIsPresent(id).then(() => {
return manager.addSubmissionAttempt(id, submissionID, new Date());
});
}
- p.then(() => { xhr.send(formData); });
+ p.then(() => {
+ xhr.send(formData);
+});
return true;
},
notifyStatus: function Submitter_notify(status, ret) {
let propBag = Cc["@mozilla.org/hash-property-bag;1"].
createInstance(Ci.nsIWritablePropertyBag2);
propBag.setPropertyAsAString("minidumpID", this.id);
if (status == SUCCESS) {
@@ -486,17 +488,19 @@ this.CrashSubmit = {
* @param id
* Filename (minus .dmp extension) of the report to ignore
*/
ignore: function CrashSubmit_ignore(id) {
let [dump /* , extra, memory */] = getPendingMinidump(id);
return OS.File.open(dump.path + ".ignore", {create: true},
{unixFlags: OS.Constants.libc.O_CREAT})
- .then((file) => { file.close(); });
+ .then((file) => {
+ file.close();
+});
},
/**
* Get the list of pending crash IDs.
*
* @return an array of string, each being an ID as
* expected to be passed to submit()
*/
--- a/toolkit/crashreporter/test/browser/browser_bug471404.js
+++ b/toolkit/crashreporter/test/browser/browser_bug471404.js
@@ -10,19 +10,25 @@ function check_clear_visible(browser, aV
visible = true;
}
Assert.equal(visible, aVisible,
"clear reports button is " + (aVisible ? "visible" : "hidden"));
});
}
// each test here has a setup (run before loading about:crashes) and onload (run after about:crashes loads)
-var _tests = [{setup: null, onload(browser) { return check_clear_visible(browser, false); }},
- {setup(crD) { return add_fake_crashes(crD, 1); },
- onload(browser) { return check_clear_visible(browser, true); }}
+var _tests = [{setup: null, onload(browser) {
+ return check_clear_visible(browser, false);
+}},
+ {setup(crD) {
+ return add_fake_crashes(crD, 1);
+},
+ onload(browser) {
+ return check_clear_visible(browser, true);
+}}
];
add_task(function* test() {
let appD = make_fake_appdir();
let crD = appD.clone();
crD.append("Crash Reports");
yield BrowserTestUtils.withNewTab({ gBrowser, url: "about:blank" }, function* (browser) {
--- a/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js
+++ b/toolkit/crashreporter/test/unit/crasher_subprocess_tail.js
@@ -1,14 +1,16 @@
// Let the event loop process a bit before crashing.
if (shouldDelay) {
let shouldCrashNow = false;
let thr = Components.classes["@mozilla.org/thread-manager;1"]
.getService().currentThread;
- thr.dispatch({ run: () => { shouldCrashNow = true; } },
+ thr.dispatch({ run: () => {
+ shouldCrashNow = true;
+} },
Components.interfaces.nsIThread.DISPATCH_NORMAL);
while (!shouldCrashNow) {
thr.processNextEvent(true);
}
}
// now actually crash
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -447,17 +447,19 @@ FinderHighlighter.prototype = {
if (dict.animations) {
for (animation of dict.animations)
animation.finish();
}
dict.animations = [];
for (let i = dict.previousRangeRectsAndTexts.rectList.length - 1; i >= 0; --i) {
animation = outlineNode.setAnimationForElement(kModalOutlineId + i,
Cu.cloneInto(kModalOutlineAnim.keyframes, window), kModalOutlineAnim.duration);
- animation.onfinish = function(idx) { dict.animations.splice(idx, 1); }.bind(null, i);
+ animation.onfinish = function(idx) {
+ dict.animations.splice(idx, 1);
+}.bind(null, i);
dict.animations.push(animation);
}
}
if (this._highlightAll)
this.highlight(true, data.searchString, data.linksOnly);
},
--- a/toolkit/modules/FinderIterator.jsm
+++ b/toolkit/modules/FinderIterator.jsm
@@ -31,17 +31,19 @@ this.FinderIterator = {
_previousRanges: [],
_spawnId: 0,
_timeout: Services.prefs.getIntPref(kTimeoutPref),
_timer: null,
ranges: [],
running: false,
// Expose `kIterationSizeMax` to the outside world for unit tests to use.
- get kIterationSizeMax() { return kIterationSizeMax },
+ get kIterationSizeMax() {
+ return kIterationSizeMax
+},
get params() {
if (!this._currentParams && !this._previousParams)
return null;
return Object.assign({}, this._currentParams || this._previousParams);
},
/**
--- a/toolkit/modules/Geometry.jsm
+++ b/toolkit/modules/Geometry.jsm
@@ -90,32 +90,44 @@ this.Rect = function Rect(x, y, w, h) {
this.bottom = y + h;
};
Rect.fromRect = function fromRect(r) {
return new Rect(r.left, r.top, r.right - r.left, r.bottom - r.top);
};
Rect.prototype = {
- get x() { return this.left; },
- get y() { return this.top; },
- get width() { return this.right - this.left; },
- get height() { return this.bottom - this.top; },
+ get x() {
+ return this.left;
+},
+ get y() {
+ return this.top;
+},
+ get width() {
+ return this.right - this.left;
+},
+ get height() {
+ return this.bottom - this.top;
+},
set x(v) {
let diff = this.left - v;
this.left = v;
this.right -= diff;
},
set y(v) {
let diff = this.top - v;
this.top = v;
this.bottom -= diff;
},
- set width(v) { this.right = this.left + v; },
- set height(v) { this.bottom = this.top + v; },
+ set width(v) {
+ this.right = this.left + v;
+},
+ set height(v) {
+ this.bottom = this.top + v;
+},
isEmpty: function isEmpty() {
return this.left >= this.right || this.top >= this.bottom;
},
setRect(x, y, w, h) {
this.left = x;
this.top = y;
--- a/toolkit/modules/InlineSpellChecker.jsm
+++ b/toolkit/modules/InlineSpellChecker.jsm
@@ -148,17 +148,21 @@ InlineSpellChecker.prototype = {
this.mSpellSuggestions.push(suggestion);
var item = menu.ownerDocument.createElement("menuitem");
this.mSuggestionItems.push(item);
item.setAttribute("label", suggestion);
item.setAttribute("value", suggestion);
// this function thing is necessary to generate a callback with the
// correct binding of "val" (the index in this loop).
- var callback = function(me, val) { return function(evt) { me.replaceMisspelling(val); } };
+ var callback = function(me, val) {
+ return function(evt) {
+ me.replaceMisspelling(val);
+}
+};
item.addEventListener("command", callback(this, i), true);
item.setAttribute("class", "spell-suggestion");
menu.insertBefore(item, insertBefore);
}
return this.mSpellSuggestions.length;
},
// undoes the work of addSuggestionsToMenu for the same menu
@@ -497,20 +501,28 @@ var SpellCheckHelper = {
};
function RemoteSpellChecker(aSpellInfo) {
this._spellInfo = aSpellInfo;
this._suggestionGenerator = null;
}
RemoteSpellChecker.prototype = {
- get canSpellCheck() { return this._spellInfo.canSpellCheck; },
- get spellCheckPending() { return this._spellInfo.initialSpellCheckPending; },
- get overMisspelling() { return this._spellInfo.overMisspelling; },
- get enableRealTimeSpell() { return this._spellInfo.enableRealTimeSpell; },
+ get canSpellCheck() {
+ return this._spellInfo.canSpellCheck;
+},
+ get spellCheckPending() {
+ return this._spellInfo.initialSpellCheckPending;
+},
+ get overMisspelling() {
+ return this._spellInfo.overMisspelling;
+},
+ get enableRealTimeSpell() {
+ return this._spellInfo.enableRealTimeSpell;
+},
GetSuggestedWord() {
if (!this._suggestionGenerator) {
this._suggestionGenerator = (function*(spellInfo) {
for (let i of spellInfo.spellSuggestions)
yield i;
})(this._spellInfo);
}
@@ -518,30 +530,36 @@ RemoteSpellChecker.prototype = {
let next = this._suggestionGenerator.next();
if (next.done) {
this._suggestionGenerator = null;
return "";
}
return next.value;
},
- get currentDictionary() { return this._spellInfo.currentDictionary },
- get dictionaryList() { return this._spellInfo.dictionaryList.slice(); },
+ get currentDictionary() {
+ return this._spellInfo.currentDictionary
+},
+ get dictionaryList() {
+ return this._spellInfo.dictionaryList.slice();
+},
selectDictionary(index) {
this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:selectDictionary",
{ index });
},
replaceMisspelling(index) {
this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:replaceMisspelling",
{ index });
},
- toggleEnabled() { this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:toggleEnabled", {}); },
+ toggleEnabled() {
+ this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:toggleEnabled", {});
+},
addToDictionary() {
// This is really ugly. There is an nsISpellChecker somewhere in the
// parent that corresponds to our current element's spell checker in the
// child, but it's hard to access it. However, we know that
// addToDictionary adds the word to the singleton personal dictionary, so
// we just do that here.
// NB: We also rely on the fact that we only ever pass an empty string in
// as the "lang".
@@ -561,10 +579,12 @@ RemoteSpellChecker.prototype = {
},
ignoreWord() {
let dictionary = Cc["@mozilla.org/spellchecker/personaldictionary;1"]
.getService(Ci.mozIPersonalDictionary);
dictionary.ignoreWord(this._spellInfo.misspelling);
this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:recheck", {});
},
- uninit() { this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:uninit", {}); }
+ uninit() {
+ this._spellInfo.target.sendAsyncMessage("InlineSpellChecker:uninit", {});
+}
};
--- a/toolkit/modules/Memory.jsm
+++ b/toolkit/modules/Memory.jsm
@@ -33,17 +33,19 @@ this.Memory = {
*/
summary() {
if (!this._pendingPromise) {
this._pendingPromise = new Promise((resolve) => {
this._pendingResolve = resolve;
this._summaries = {};
Services.ppmm.broadcastAsyncMessage("Memory:GetSummary");
Services.ppmm.addMessageListener("Memory:Summary", this);
- this._pendingTimeout = setTimeout(() => { this.finish(); }, TIMEOUT_INTERVAL);
+ this._pendingTimeout = setTimeout(() => {
+ this.finish();
+}, TIMEOUT_INTERVAL);
});
}
return this._pendingPromise;
},
receiveMessage(msg) {
if (msg.name != "Memory:Summary" || !this._pendingResolve) {
return;
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -1251,17 +1251,19 @@ var Links = {
/**
* Implements the nsIObserver interface to get notified about browser history
* sanitization.
*/
observe: function Links_observe(aSubject, aTopic, aData) {
// Make sure to update open about:newtab instances. If there are no opened
// pages we can just wait for the next new tab to populate the cache again.
if (AllPages.length && AllPages.enabled)
- this.populateCache(function() { AllPages.update() }, true);
+ this.populateCache(function() {
+ AllPages.update()
+}, true);
else
this.resetCache();
},
_callObservers(methodName, ...args) {
for (let obs of this._observers) {
if (typeof(obs[methodName]) == "function") {
try {
--- a/toolkit/modules/Preferences.jsm
+++ b/toolkit/modules/Preferences.jsm
@@ -195,17 +195,19 @@ Preferences.isSet = function(prefName) {
return (this.has(prefName) && this._prefBranch.prefHasUserValue(prefName));
},
/**
* Whether or not the given pref has a user-set value. Use isSet instead,
* which is equivalent.
* @deprecated
*/
-Preferences.modified = function(prefName) { return this.isSet(prefName) },
+Preferences.modified = function(prefName) {
+ return this.isSet(prefName)
+},
Preferences.reset = function(prefName) {
if (Array.isArray(prefName)) {
prefName.map(v => this.reset(v));
return;
}
this._prefBranch.clearUserPref(prefName);
--- a/toolkit/modules/ProfileAge.jsm
+++ b/toolkit/modules/ProfileAge.jsm
@@ -19,17 +19,19 @@ Cu.import("resource://services-common/ut
* This is separate from the provider to simplify testing and enable extraction
* to a shared location in the future.
*/
this.ProfileAge = function(profile, log) {
this.profilePath = profile || OS.Constants.Path.profileDir;
if (!this.profilePath) {
throw new Error("No profile directory.");
}
- this._log = log || {"debug": function(s) { dump(s + "\n"); }};
+ this._log = log || {"debug": function(s) {
+ dump(s + "\n");
+}};
}
this.ProfileAge.prototype = {
/**
* There are three ways we can get our creation time:
*
* 1. From our own saved value (to avoid redundant work).
* 2. From the on-disk JSON file.
* 3. By calculating it from the filesystem.
--- a/toolkit/modules/RemoteSecurityUI.jsm
+++ b/toolkit/modules/RemoteSecurityUI.jsm
@@ -15,19 +15,25 @@ function RemoteSecurityUI() {
this._SSLStatus = null;
this._state = 0;
}
RemoteSecurityUI.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsISSLStatusProvider, Ci.nsISecureBrowserUI]),
// nsISSLStatusProvider
- get SSLStatus() { return this._SSLStatus; },
+ get SSLStatus() {
+ return this._SSLStatus;
+},
// nsISecureBrowserUI
- get state() { return this._state; },
- get tooltipText() { return ""; },
+ get state() {
+ return this._state;
+},
+ get tooltipText() {
+ return "";
+},
_update(aStatus, aState) {
this._SSLStatus = aStatus;
this._state = aState;
}
};
--- a/toolkit/modules/RemoteWebProgress.jsm
+++ b/toolkit/modules/RemoteWebProgress.jsm
@@ -22,18 +22,22 @@ function RemoteWebProgressRequest(spec,
this._uri = newURI(spec);
this._originalURI = newURI(originalSpec);
this._requestCPOW = requestCPOW;
}
RemoteWebProgressRequest.prototype = {
QueryInterface : XPCOMUtils.generateQI([Ci.nsIChannel]),
- get URI() { return this._uri.clone(); },
- get originalURI() { return this._originalURI.clone(); }
+ get URI() {
+ return this._uri.clone();
+},
+ get originalURI() {
+ return this._originalURI.clone();
+}
};
function RemoteWebProgress(aManager, aIsTopLevel) {
this.wrappedJSObject = this;
this._manager = aManager;
this._isLoadingDocument = false;
@@ -51,21 +55,31 @@ RemoteWebProgress.prototype = {
NOTIFY_STATE_ALL: 0x0000000f,
NOTIFY_PROGRESS: 0x00000010,
NOTIFY_STATUS: 0x00000020,
NOTIFY_SECURITY: 0x00000040,
NOTIFY_LOCATION: 0x00000080,
NOTIFY_REFRESH: 0x00000100,
NOTIFY_ALL: 0x000001ff,
- get isLoadingDocument() { return this._isLoadingDocument },
- get DOMWindow() { return this._DOMWindow; },
- get DOMWindowID() { return this._DOMWindowID; },
- get isTopLevel() { return this._isTopLevel },
- get loadType() { return this._loadType; },
+ get isLoadingDocument() {
+ return this._isLoadingDocument
+},
+ get DOMWindow() {
+ return this._DOMWindow;
+},
+ get DOMWindowID() {
+ return this._DOMWindowID;
+},
+ get isTopLevel() {
+ return this._isTopLevel
+},
+ get loadType() {
+ return this._loadType;
+},
addProgressListener(aListener) {
this._manager.addProgressListener(aListener);
},
removeProgressListener(aListener) {
this._manager.removeProgressListener(aListener);
}
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -640,17 +640,19 @@ ConnectionData.prototype = Object.freeze
let timeoutPromise = new Promise((resolve, reject) => {
setTimeout(() => reject(new Error("Transaction timeout, most likely caused by unresolved pending work.")),
TRANSACTIONS_QUEUE_TIMEOUT_MS);
});
return Promise.race([transactionPromise, timeoutPromise]);
});
// Atomically update the queue before anyone else has a chance to enqueue
// further transactions.
- this._transactionQueue = promise.catch(ex => { console.error(ex) });
+ this._transactionQueue = promise.catch(ex => {
+ console.error(ex)
+});
// Make sure that we do not shutdown the connection during a transaction.
this._barrier.client.addBlocker(`Transaction (${this._getOperationId()})`,
this._transactionQueue);
return promise;
},
shrinkMemory() {
--- a/toolkit/modules/WindowDraggingUtils.jsm
+++ b/toolkit/modules/WindowDraggingUtils.jsm
@@ -14,17 +14,19 @@ this.WindowDraggingElement = function Wi
if (HAVE_CSS_WINDOW_DRAG_SUPPORT && !this.isPanel()) {
return;
}
this._elem.addEventListener("mousedown", this, false);
};
WindowDraggingElement.prototype = {
- mouseDownCheck(e) { return true; },
+ mouseDownCheck(e) {
+ return true;
+},
dragTags: ["box", "hbox", "vbox", "spacer", "label", "statusbarpanel", "stack",
"toolbaritem", "toolbarseparator", "toolbarspring", "toolbarspacer",
"radiogroup", "deck", "scrollbox", "arrowscrollbox", "tabs"],
shouldDrag(aEvent) {
if (aEvent.button != 0 ||
this._window.fullScreen ||
!this.mouseDownCheck.call(this._elem, aEvent) ||
aEvent.defaultPrevented)
--- a/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
+++ b/toolkit/modules/secondscreen/SimpleServiceDiscovery.jsm
@@ -42,18 +42,22 @@ const SSDP_TRANSMISSION_INTERVAL = 1000;
const EVENT_SERVICE_FOUND = "ssdp-service-found";
const EVENT_SERVICE_LOST = "ssdp-service-lost";
/*
* SimpleServiceDiscovery manages any discovered SSDP services. It uses a UDP
* broadcast to locate available services on the local network.
*/
var SimpleServiceDiscovery = {
- get EVENT_SERVICE_FOUND() { return EVENT_SERVICE_FOUND; },
- get EVENT_SERVICE_LOST() { return EVENT_SERVICE_LOST; },
+ get EVENT_SERVICE_FOUND() {
+ return EVENT_SERVICE_FOUND;
+},
+ get EVENT_SERVICE_LOST() {
+ return EVENT_SERVICE_LOST;
+},
_devices: new Map(),
_services: new Map(),
_searchSocket: null,
_searchInterval: 0,
_searchTimestamp: 0,
_searchTimeout: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
_searchRepeat: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer),
--- a/toolkit/modules/tests/browser/browser_WebNavigation.js
+++ b/toolkit/modules/tests/browser/browser_WebNavigation.js
@@ -62,17 +62,19 @@ function gotEvent(event, details) {
function loadViaFrameScript(url, event, script) {
// Loading via a frame script ensures that the chrome process never
// "gets ahead" of frame scripts in non-e10s mode.
received = [];
waitingURL = url;
waitingEvent = event;
expectedBrowser.messageManager.loadFrameScript("data:," + script, false);
- return new Promise(resolve => { completedResolve = resolve; });
+ return new Promise(resolve => {
+ completedResolve = resolve;
+});
}
add_task(function* webnav_ordering() {
let listeners = {};
for (let event of EVENTS) {
listeners[event] = gotEvent.bind(null, event);
WebNavigation[event].addListener(listeners[event]);
}
--- a/toolkit/modules/tests/xpcshell/test_DeferredTask.js
+++ b/toolkit/modules/tests/xpcshell/test_DeferredTask.js
@@ -67,17 +67,19 @@ add_test(function test_arm_delay_respect
/**
* Checks that calling "arm" again does not introduce further delay.
*/
add_test(function test_arm_delay_notrestarted() {
let executed = false;
// Create a task that will run later.
- let deferredTask = new DeferredTask(() => { executed = true; }, 4 * T);
+ let deferredTask = new DeferredTask(() => {
+ executed = true;
+}, 4 * T);
deferredTask.arm();
// Before the task starts, call "arm" again.
do_timeout(2 * T, () => deferredTask.arm());
// The "arm" call should not have introduced further delays.
do_timeout(5 * T, function() {
do_check_true(executed);
@@ -203,17 +205,19 @@ add_test(function test_disarm() {
});
/**
* Checks that calling "disarm" allows the delay to be restarted.
*/
add_test(function test_disarm_delay_restarted() {
let executed = false;
- let deferredTask = new DeferredTask(() => { executed = true; }, 4 * T);
+ let deferredTask = new DeferredTask(() => {
+ executed = true;
+}, 4 * T);
deferredTask.arm();
do_timeout(2 * T, function() {
deferredTask.disarm();
deferredTask.arm();
});
do_timeout(5 * T, function() {
@@ -312,17 +316,19 @@ add_test(function test_finalize() {
let timePassed = false;
let deferredTask = new DeferredTask(function() {
do_check_false(timePassed);
executed = true;
}, 2 * T);
deferredTask.arm();
- do_timeout(1 * T, () => { timePassed = true; });
+ do_timeout(1 * T, () => {
+ timePassed = true;
+});
// This should trigger the immediate execution of the task.
deferredTask.finalize().then(function() {
do_check_true(executed);
run_next_test();
});
});
@@ -351,17 +357,19 @@ add_test(function test_finalize_executes
run_next_test();
});
// The second execution triggered by the finalization waits 1*T for the
// current task to finish (see the timeout below), but then it must not
// wait for the 2*T specified on construction as normal task delay. The
// second execution will finish after the timeout below has passed again,
// for a total of 2*T of wait time.
- do_timeout(3 * T, () => { timePassed = true; });
+ do_timeout(3 * T, () => {
+ timePassed = true;
+});
}
yield promiseTimeout(1 * T);
// Just before finishing, indicate if we completed the second execution.
if (executed) {
do_check_true(deferredTask.isRunning);
executedAgain = true;
--- a/toolkit/modules/tests/xpcshell/test_FinderIterator.js
+++ b/toolkit/modules/tests/xpcshell/test_FinderIterator.js
@@ -21,17 +21,19 @@ function FakeRange(textContent, startsIn
var gMockWindow = {
setTimeout(cb, delay) {
Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
.initWithCallback(cb, delay, Ci.nsITimer.TYPE_ONE_SHOT);
}
};
var gMockFinder = {
- _getWindow() { return gMockWindow; }
+ _getWindow() {
+ return gMockWindow;
+}
};
function prepareIterator(findText, rangeCount) {
gFindResults = [];
for (let i = rangeCount; --i >= 0;)
gFindResults.push(new FakeRange(findText));
}
@@ -67,78 +69,90 @@ add_task(function* test_valid_arguments(
prepareIterator(findText, rangeCount);
let count = 0;
yield FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
});
let params = FinderIterator._previousParams;
Assert.ok(!params.linksOnly, "Default for linksOnly is false");
Assert.ok(!params.useCache, "Default for useCache is false");
Assert.equal(params.word, findText, "Words should match");
count = 0;
Assert.throws(() => FinderIterator.start({
entireWord: false,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
}), /Missing required option 'caseSensitive'/, "Should throw when missing an argument");
FinderIterator.reset();
Assert.throws(() => FinderIterator.start({
caseSensitive: false,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
}), /Missing required option 'entireWord'/, "Should throw when missing an argument");
FinderIterator.reset();
Assert.throws(() => FinderIterator.start({
caseSensitive: false,
entireWord: false,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
}), /Missing required option 'finder'/, "Should throw when missing an argument");
FinderIterator.reset();
Assert.throws(() => FinderIterator.start({
caseSensitive: true,
entireWord: false,
finder: gMockFinder,
word: findText
}), /Missing valid, required option 'listener'/, "Should throw when missing an argument");
FinderIterator.reset();
Assert.throws(() => FinderIterator.start({
caseSensitive: false,
entireWord: true,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
}), /Missing required option 'word'/, "Should throw when missing an argument");
FinderIterator.reset();
Assert.equal(count, 0, "No ranges should've been counted");
});
add_task(function* test_stop() {
let findText = "bar";
let rangeCount = 120;
prepareIterator(findText, rangeCount);
let count = 0;
let whenDone = FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
});
FinderIterator.stop();
yield whenDone;
Assert.equal(count, 0, "Number of ranges should be 0");
@@ -151,17 +165,19 @@ add_task(function* test_reset() {
let rangeCount = 142;
prepareIterator(findText, rangeCount);
let count = 0;
let whenDone = FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
});
Assert.ok(FinderIterator.running, "Yup, running we are");
Assert.equal(count, 0, "Number of ranges should match 0");
Assert.equal(FinderIterator.ranges.length, 0, "Number of ranges should match 0");
FinderIterator.reset();
@@ -181,29 +197,33 @@ add_task(function* test_parallel_starts(
prepareIterator(findText, rangeCount);
// Start off the iterator.
let count = 0;
let whenDone = FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
});
yield new Promise(resolve => gMockWindow.setTimeout(resolve, 120));
Assert.ok(FinderIterator.running, "We ought to be running here");
let count2 = 0;
let whenDone2 = FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count2; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count2;
+} },
word: findText
});
// Let the iterator run for a little while longer before we assert the world.
yield new Promise(resolve => gMockWindow.setTimeout(resolve, 10));
FinderIterator.stop();
Assert.ok(!FinderIterator.running, "Stop means stop");
@@ -227,36 +247,42 @@ add_task(function* test_allowDistance()
prepareIterator(findText, rangeCount);
// Start off the iterator.
let count = 0;
let whenDone = FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count;
+} },
word: findText
});
let count2 = 0;
let whenDone2 = FinderIterator.start({
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count2; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count2;
+} },
word: "gu"
});
let count3 = 0;
let whenDone3 = FinderIterator.start({
allowDistance: 1,
caseSensitive: false,
entireWord: false,
finder: gMockFinder,
- listener: { onIteratorRangeFound(range) { ++count3; } },
+ listener: { onIteratorRangeFound(range) {
+ ++count3;
+} },
word: "gu"
});
yield Promise.all([whenDone, whenDone2, whenDone3]);
Assert.equal(count, rangeCount, "The first iterator invocation should yield all results");
Assert.equal(count2, 0, "The second iterator invocation should yield _no_ results");
Assert.equal(count3, rangeCount, "The first iterator invocation should yield all results");
--- a/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
+++ b/toolkit/modules/tests/xpcshell/test_GMPInstallManager.js
@@ -683,29 +683,55 @@ xhr.prototype = {
} else {
this._notify(["error", "loadend"]);
}
} catch (ex) {
do_throw(ex);
}
}.bind(this));
},
- set onabort(aValue) { this._onabort = makeHandler(aValue); },
- get onabort() { return this._onabort; },
- set onprogress(aValue) { this._onprogress = makeHandler(aValue); },
- get onprogress() { return this._onprogress; },
- set onerror(aValue) { this._onerror = makeHandler(aValue); },
- get onerror() { return this._onerror; },
- set onload(aValue) { this._onload = makeHandler(aValue); },
- get onload() { return this._onload; },
- set onloadend(aValue) { this._onloadend = makeHandler(aValue); },
- get onloadend() { return this._onloadend; },
- set ontimeout(aValue) { this._ontimeout = makeHandler(aValue); },
- get ontimeout() { return this._ontimeout; },
- set timeout(aValue) { this._timeout = aValue; },
+ set onabort(aValue) {
+ this._onabort = makeHandler(aValue);
+},
+ get onabort() {
+ return this._onabort;
+},
+ set onprogress(aValue) {
+ this._onprogress = makeHandler(aValue);
+},
+ get onprogress() {
+ return this._onprogress;
+},
+ set onerror(aValue) {
+ this._onerror = makeHandler(aValue);
+},
+ get onerror() {
+ return this._onerror;
+},
+ set onload(aValue) {
+ this._onload = makeHandler(aValue);
+},
+ get onload() {
+ return this._onload;
+},
+ set onloadend(aValue) {
+ this._onloadend = makeHandler(aValue);
+},
+ get onloadend() {
+ return this._onloadend;
+},
+ set ontimeout(aValue) {
+ this._ontimeout = makeHandler(aValue);
+},
+ get ontimeout() {
+ return this._ontimeout;
+},
+ set timeout(aValue) {
+ this._timeout = aValue;
+},
_notify(events) {
if (this._notified) {
return;
}
this._notified = true;
for (let item of events) {
let k = "on" + item;
if (this[k]) {
@@ -739,17 +765,19 @@ xhr.prototype = {
throw Cr.NS_ERROR_NO_AGGREGATION;
},
QueryInterface(aIID) {
if (aIID.equals(Ci.nsIClassInfo) ||
aIID.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
- get wrappedJSObject() { return this; }
+ get wrappedJSObject() {
+ return this;
+}
};
/**
* Helper used to overrideXHR requests (no matter to what URL) with the
* specified status and response.
* @param status The status you want to get back when an XHR request is made
* @param response The response you want to get back when an XHR request is made
*/
--- a/toolkit/modules/tests/xpcshell/test_Integration.js
+++ b/toolkit/modules/tests/xpcshell/test_Integration.js
@@ -164,17 +164,19 @@ add_task(function* test_override_super_m
yield assertCurrentCombinedResults(0);
});
/**
* Registers an integration override function that throws an exception, and
* ensures that this does not block other functions from being registered.
*/
add_task(function* test_override_error() {
- let errorOverrideFn = base => { throw "Expected error." };
+ let errorOverrideFn = base => {
+ throw "Expected error."
+};
Integration.testModule.register(errorOverrideFn);
Integration.testModule.register(overrideFn);
yield assertCurrentCombinedResults(1);
Integration.testModule.unregister(errorOverrideFn);
Integration.testModule.unregister(overrideFn);
yield assertCurrentCombinedResults(0);
--- a/toolkit/modules/tests/xpcshell/test_Log.js
+++ b/toolkit/modules/tests/xpcshell/test_Log.js
@@ -368,33 +368,41 @@ add_task(function* log_message_with_para
'Missing object is ${missing}');
// Make sure we don't treat the parameter name 'false' as a falsey value.
do_check_eq(formatMessage("False is ${false}", {false: true}),
'False is true');
// If an object has a .toJSON method, the formatter uses it.
let ob = function() {};
- ob.toJSON = function() {return {sneaky: "value"}};
+ ob.toJSON = function() {
+return {sneaky: "value"}
+};
do_check_eq(formatMessage("JSON is ${sub}", {sub: ob}),
'JSON is {"sneaky":"value"}');
// Fall back to .toSource() if JSON.stringify() fails on an object.
ob = function() {};
- ob.toJSON = function() {throw "oh noes JSON"};
+ ob.toJSON = function() {
+throw "oh noes JSON"
+};
do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}),
'Fail is (function () {})');
// Fall back to .toString if both .toJSON and .toSource fail.
- ob.toSource = function() {throw "oh noes SOURCE"};
+ ob.toSource = function() {
+throw "oh noes SOURCE"
+};
do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}),
'Fail is function () {}');
// Fall back to '[object]' if .toJSON, .toSource and .toString fail.
- ob.toString = function() {throw "oh noes STRING"};
+ ob.toString = function() {
+throw "oh noes STRING"
+};
do_check_eq(formatMessage("Fail is ${sub}", {sub: ob}),
'Fail is [object]');
// If params are passed but there are no substitution in the text
// we JSON format and append the entire parameters object.
do_check_eq(formatMessage("Text with no subs", {a: "b", c: "d"}),
'Text with no subs: {"a":"b","c":"d"}');
@@ -444,17 +452,19 @@ add_task(function* log_message_with_para
do_check_true(str.startsWith('[Exception... "test exception"'));
// If the text is null and 'params' is a String object, the message is exactly that string.
str = formatMessage(null, new String("String in place of params"));
do_check_eq(str, "String in place of params");
// We use object.valueOf() internally; make sure a broken valueOf() method
// doesn't cause the logger to fail.
/* eslint-disable object-shorthand */
- let vOf = {a: 1, valueOf: function() {throw "oh noes valueOf"}};
+ let vOf = {a: 1, valueOf: function() {
+throw "oh noes valueOf"
+}};
do_check_eq(formatMessage("Broken valueOf ${}", vOf),
'Broken valueOf ({a:1, valueOf:(function () {throw "oh noes valueOf"})})');
/* eslint-enable object-shorthand */
// Test edge cases of bad data to formatter:
// If 'params' is not an object, format it as a basic type.
do_check_eq(formatMessage("non-object no subst", 1),
'non-object no subst: 1');
--- a/toolkit/modules/tests/xpcshell/test_Log_stackTrace.js
+++ b/toolkit/modules/tests/xpcshell/test_Log_stackTrace.js
@@ -1,12 +1,18 @@
print("Define some functions in well defined line positions for the test");
-function foo(v) { return bar(v + 1); } // line 2
-function bar(v) { return baz(v + 1); } // line 3
-function baz(v) { throw new Error(v + 1); } // line 4
+function foo(v) {
+ return bar(v + 1);
+} // line 2
+function bar(v) {
+ return baz(v + 1);
+} // line 3
+function baz(v) {
+ throw new Error(v + 1);
+} // line 4
print("Make sure lazy constructor calling/assignment works");
Components.utils.import("resource://gre/modules/Log.jsm");
function run_test() {
print("Make sure functions, arguments, files are pretty printed in the trace");
let trace = "";
try {
--- a/toolkit/modules/tests/xpcshell/test_ObjectUtils.js
+++ b/toolkit/modules/tests/xpcshell/test_ObjectUtils.js
@@ -54,17 +54,19 @@ add_task(function* test_deepEqual() {
a1.a = "test";
a1.b = true;
a2.b = true;
a2.a = "test";
Assert.ok(!deepEqual(Object.keys(a1), Object.keys(a2)));
Assert.ok(deepEqual(a1, a2));
let nbRoot = {
- toString() { return this.first + " " + this.last; }
+ toString() {
+ return this.first + " " + this.last;
+}
};
function nameBuilder(first, last) {
this.first = first;
this.last = last;
return this;
}
nameBuilder.prototype = nbRoot;
--- a/toolkit/modules/tests/xpcshell/test_Preferences.js
+++ b/toolkit/modules/tests/xpcshell/test_Preferences.js
@@ -202,17 +202,19 @@ add_test(function test_reset_nonexistent
add_test(function test_reset_nonexistent_pref_branch() {
Preferences.resetBranch("test_reset_nonexistent_pref_branch.");
run_next_test();
});
add_test(function test_observe_prefs_function() {
let observed = false;
- let observer = function() { observed = !observed };
+ let observer = function() {
+ observed = !observed
+};
Preferences.observe("test_observe_prefs_function", observer);
Preferences.set("test_observe_prefs_function", "something");
do_check_true(observed);
Preferences.ignore("test_observe_prefs_function", observer);
Preferences.set("test_observe_prefs_function", "something else");
do_check_true(observed);
@@ -283,30 +285,34 @@ add_test(function test_observe_exact_pre
Preferences.ignore("test_observe_exact_pref", observer);
Preferences.reset("test_observe_exact_pref.sub-pref");
run_next_test();
});
*/
add_test(function test_observe_value_of_set_pref() {
- let observer = function(newVal) { do_check_eq(newVal, "something") };
+ let observer = function(newVal) {
+ do_check_eq(newVal, "something")
+};
Preferences.observe("test_observe_value_of_set_pref", observer);
Preferences.set("test_observe_value_of_set_pref", "something");
// Clean up.
Preferences.ignore("test_observe_value_of_set_pref", observer);
Preferences.reset("test_observe_value_of_set_pref");
run_next_test();
});
add_test(function test_observe_value_of_reset_pref() {
- let observer = function(newVal) { do_check_true(typeof newVal == "undefined") };
+ let observer = function(newVal) {
+ do_check_true(typeof newVal == "undefined")
+};
Preferences.set("test_observe_value_of_reset_pref", "something");
Preferences.observe("test_observe_value_of_reset_pref", observer);
Preferences.reset("test_observe_value_of_reset_pref");
// Clean up.
Preferences.ignore("test_observe_value_of_reset_pref", observer);
--- a/toolkit/modules/tests/xpcshell/test_Promise.js
+++ b/toolkit/modules/tests/xpcshell/test_Promise.js
@@ -941,17 +941,19 @@ tests.push(
do_print("Setting wait for first promise");
promise1.then(value => {
do_print("Starting event loop");
event_loop();
}, null);
do_print("Setting wait for second promise");
- return promise2.catch(error => { return 3; })
+ return promise2.catch(error => {
+ return 3;
+})
.then(
count => {
shouldExitNestedEventLoop = true;
});
}));
function wait_for_uncaught(aMustAppear, aTimeout = undefined) {
let remaining = new Set();
--- a/toolkit/mozapps/downloads/DownloadLastDir.jsm
+++ b/toolkit/mozapps/downloads/DownloadLastDir.jsm
@@ -100,18 +100,22 @@ this.DownloadLastDir = function Download
};
}
DownloadLastDir.prototype = {
isPrivate: function DownloadLastDir_isPrivate() {
return this.fakeContext.usePrivateBrowsing;
},
// compat shims
- get file() { return this._getLastFile(); },
- set file(val) { this.setFile(null, val); },
+ get file() {
+ return this._getLastFile();
+},
+ set file(val) {
+ this.setFile(null, val);
+},
cleanupPrivateFile() {
gDownloadLastDirFile = null;
},
// This function is now deprecated as it uses the sync nsIContentPrefService
// interface. New consumers should use the getFileAsync function.
getFile(aURI) {
let Deprecated = Components.utils.import("resource://gre/modules/Deprecated.jsm", {}).Deprecated;
Deprecated.warning("DownloadLastDir.getFile is deprecated. Please use getFileAsync instead.",
--- a/toolkit/mozapps/extensions/AddonManager.jsm
+++ b/toolkit/mozapps/extensions/AddonManager.jsm
@@ -656,17 +656,19 @@ const weblistener = {
onWebInstallOriginBlocked(aBrowser, aUri, aInstall) {
installNotifyObservers("addon-install-origin-blocked", aBrowser, aUri, aInstall);
return false;
},
onWebInstallBlocked(aBrowser, aUri, aInstall) {
installNotifyObservers("addon-install-blocked", aBrowser, aUri, aInstall,
- function() { new Installer(this.browser, this.originatingURI, aInstall); });
+ function() {
+ new Installer(this.browser, this.originatingURI, aInstall);
+});
return false;
},
onWebInstallRequested(aBrowser, aUri, aInstall) {
new Installer(aBrowser, aUri, aInstall);
},
};
@@ -1646,17 +1648,19 @@ var AddonManagerInternal = {
AddonManager.shouldAutoUpdate(aAddon)) {
// XXX we really should resolve when this install is done,
// not when update-available check completes, no?
logger.debug(`Starting upgrade install of ${aAddon.id}`);
aInstall.install();
}
},
- onUpdateFinished: aAddon => { logger.debug("onUpdateFinished for ${id}", aAddon); resolve(); }
+ onUpdateFinished: aAddon => {
+ logger.debug("onUpdateFinished for ${id}", aAddon); resolve();
+}
}, AddonManager.UPDATE_WHEN_PERIODIC_UPDATE);
}));
}
yield Promise.all(updates);
}
if (checkHotfix) {
var hotfixVersion = "";
--- a/toolkit/mozapps/extensions/DeferredSave.jsm
+++ b/toolkit/mozapps/extensions/DeferredSave.jsm
@@ -208,17 +208,19 @@ this.DeferredSave.prototype = {
this.logger.error("Deferred save dataProvider failed", e);
writing.then(null, error => {})
.then(count => {
pending.reject(e);
});
return;
}
- writing.then(null, error => { return 0; })
+ writing.then(null, error => {
+ return 0;
+})
.then(count => {
this.logger.debug("Starting write");
this.totalSaves++;
this.writeInProgress = true;
OS.File.writeAtomic(this._path, toSave, {tmpPath: this._path + ".tmp"})
.then(
result => {
--- a/toolkit/mozapps/extensions/internal/AddonRepository.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonRepository.jsm
@@ -1694,17 +1694,19 @@ var AddonDatabase = {
* This is a deferred task writer that is used
* to batch operations done within 50ms of each
* other and thus generating only one write to disk
*/
get Writer() {
delete this.Writer;
this.Writer = new DeferredSave(
this.jsonFile,
- () => { return JSON.stringify(this); },
+ () => {
+ return JSON.stringify(this);
+},
DB_BATCH_TIMEOUT_MS
);
return this.Writer;
},
/**
* Flush any pending I/O on the addons.json file
* @return: Promise{null}
--- a/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
+++ b/toolkit/mozapps/extensions/internal/AddonTestUtils.jsm
@@ -347,18 +347,22 @@ var AddonTestUtils = {
* @returns {*} The promise's resolution value.
* @throws The promise's rejection value, if it rejects.
*/
awaitPromise(promise) {
let done = false;
let result;
let error;
promise.then(
- val => { result = val; },
- err => { error = err; }
+ val => {
+ result = val;
+},
+ err => {
+ error = err;
+}
).then(() => {
done = true;
});
while (!done)
Services.tm.mainThread.processNextEvent(true);
if (error !== undefined)
--- a/toolkit/mozapps/extensions/internal/GMPProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/GMPProvider.jsm
@@ -139,38 +139,58 @@ function GMPWrapper(aPluginInfo) {
GMPWrapper.prototype = {
// An active task that checks for plugin updates and installs them.
_updateTask: null,
_gmpPath: null,
_isUpdateCheckPending: false,
optionsType: AddonManager.OPTIONS_TYPE_INLINE,
- get optionsURL() { return this._plugin.optionsURL; },
+ get optionsURL() {
+ return this._plugin.optionsURL;
+},
- set gmpPath(aPath) { this._gmpPath = aPath; },
+ set gmpPath(aPath) {
+ this._gmpPath = aPath;
+},
get gmpPath() {
if (!this._gmpPath && this.isInstalled) {
this._gmpPath = OS.Path.join(OS.Constants.Path.profileDir,
this._plugin.id,
GMPPrefs.get(GMPPrefs.KEY_PLUGIN_VERSION,
null, this._plugin.id));
}
return this._gmpPath;
},
- get id() { return this._plugin.id; },
- get type() { return "plugin"; },
- get isGMPlugin() { return true; },
- get name() { return this._plugin.name; },
- get creator() { return null; },
- get homepageURL() { return this._plugin.homepageURL; },
+ get id() {
+ return this._plugin.id;
+},
+ get type() {
+ return "plugin";
+},
+ get isGMPlugin() {
+ return true;
+},
+ get name() {
+ return this._plugin.name;
+},
+ get creator() {
+ return null;
+},
+ get homepageURL() {
+ return this._plugin.homepageURL;
+},
- get description() { return this._plugin.description; },
- get fullDescription() { return this._plugin.fullDescription; },
+ get description() {
+ return this._plugin.description;
+},
+ get fullDescription() {
+ return this._plugin.fullDescription;
+},
get version() {
return GMPPrefs.get(GMPPrefs.KEY_PLUGIN_VERSION, null,
this._plugin.id);
},
get isActive() {
return !this.appDisabled &&
@@ -189,22 +209,32 @@ GMPWrapper.prototype = {
return !GMPPrefs.get(GMPPrefs.KEY_PLUGIN_ENABLED, true, this._plugin.id);
},
set userDisabled(aVal) {
GMPPrefs.set(GMPPrefs.KEY_PLUGIN_ENABLED,
aVal === false,
this._plugin.id);
},
- get blocklistState() { return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; },
- get size() { return 0; },
- get scope() { return AddonManager.SCOPE_APPLICATION; },
- get pendingOperations() { return AddonManager.PENDING_NONE; },
+ get blocklistState() {
+ return Ci.nsIBlocklistService.STATE_NOT_BLOCKED;
+},
+ get size() {
+ return 0;
+},
+ get scope() {
+ return AddonManager.SCOPE_APPLICATION;
+},
+ get pendingOperations() {
+ return AddonManager.PENDING_NONE;
+},
- get operationsRequiringRestart() { return AddonManager.OP_NEEDS_RESTART_NONE },
+ get operationsRequiringRestart() {
+ return AddonManager.OP_NEEDS_RESTART_NONE
+},
get permissions() {
let permissions = 0;
if (!this.appDisabled) {
permissions |= AddonManager.PERM_CAN_UPGRADE;
permissions |= this.userDisabled ? AddonManager.PERM_CAN_ENABLE :
AddonManager.PERM_CAN_DISABLE;
}
@@ -314,17 +344,19 @@ GMPWrapper.prototype = {
this._updateTask = null;
}
return true;
}.bind(this));
return this._updateTask;
},
- get pluginMimeTypes() { return []; },
+ get pluginMimeTypes() {
+ return [];
+},
get pluginLibraries() {
if (this.isInstalled) {
let path = this.version;
return [path];
}
return [];
},
get pluginFullpath() {
@@ -529,17 +561,19 @@ GMPWrapper.prototype = {
return {
installed: true,
valid: filesOnDisk
};
},
};
var GMPProvider = {
- get name() { return "GMPProvider"; },
+ get name() {
+ return "GMPProvider";
+},
_plugins: null,
startup() {
configureLogging();
this._log = Log.repository.getLoggerWithMessagePrefix("Toolkit.GMP",
"GMPProvider.");
this.buildPluginList();
--- a/toolkit/mozapps/extensions/internal/XPIProvider.jsm
+++ b/toolkit/mozapps/extensions/internal/XPIProvider.jsm
@@ -3933,17 +3933,19 @@ this.XPIProvider = {
browser: aBrowser,
name: aName,
icons: aIcons,
version: aVersion,
};
if (url instanceof Ci.nsIFileURL) {
let install = new LocalAddonInstall(location, url, options);
- install.init().then(() => { aCallback(install.wrapper); });
+ install.init().then(() => {
+ aCallback(install.wrapper);
+});
} else {
let install = new DownloadAddonInstall(location, url, options);
aCallback(install.wrapper);
}
},
/**
* Called to get an AddonInstall to install an add-on from a local file.
@@ -5433,17 +5435,19 @@ class AddonInstall {
/**
* Adds an InstallListener for this instance if the listener is not already
* registered.
*
* @param aListener
* The InstallListener to add
*/
addListener(aListener) {
- if (!this.listeners.some(function(i) { return i == aListener; }))
+ if (!this.listeners.some(function(i) {
+ return i == aListener;
+}))
this.listeners.push(aListener);
}
/**
* Removes an InstallListener for this instance if it is registered.
*
* @param aListener
* The InstallListener to remove
--- a/toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
+++ b/toolkit/mozapps/extensions/test/AddonManagerTesting.jsm
@@ -89,17 +89,19 @@ this.AddonManagerTesting = {
* Install an XPI add-on from a URL.
*
* @return Promise<addon>
*/
installXPIFromURL(url, hash, name, iconURL, version) {
let deferred = Promise.defer();
AddonManager.getInstallForURL(url, (install) => {
- let fail = () => { deferred.reject(new Error("Add-on install failed.")) };
+ let fail = () => {
+ deferred.reject(new Error("Add-on install failed."))
+};
let listener = {
onDownloadCancelled: fail,
onDownloadFailed: fail,
onInstallCancelled: fail,
onInstallFailed: fail,
onInstallEnded(install, addon) {
deferred.resolve(addon);
--- a/toolkit/mozapps/extensions/test/browser/browser_webapi_enable.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_webapi_enable.js
@@ -30,31 +30,35 @@ add_task(function* () {
let addon = yield promiseAddonByID(ID);
isnot(addon, null, "Test addon exists");
is(addon.userDisabled, false, "addon is enabled");
// Disable the addon from content.
yield ContentTask.spawn(browser, null, function* () {
return content.navigator.mozAddonManager
.getAddonByID("test@tests.mozilla.org")
- .then(addon => { addon.setEnabled(false); });
+ .then(addon => {
+ addon.setEnabled(false);
+});
});
let events = yield getListenerEvents(browser);
let expected = [
{id: ID, needsRestart: false, event: "onDisabling"},
{id: ID, needsRestart: false, event: "onDisabled"},
];
Assert.deepEqual(events, expected, "Got expected disable events");
// Enable the addon from content.
yield ContentTask.spawn(browser, null, function* () {
return content.navigator.mozAddonManager
.getAddonByID("test@tests.mozilla.org")
- .then(addon => { addon.setEnabled(true); });
+ .then(addon => {
+ addon.setEnabled(true);
+});
});
events = yield getListenerEvents(browser);
expected = expected.concat([
{id: ID, needsRestart: false, event: "onEnabling"},
{id: ID, needsRestart: false, event: "onEnabled"},
]);
Assert.deepEqual(events, expected, "Got expected enable events");
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -1443,17 +1443,19 @@ function waitForCondition(condition, nex
ok(false, e + "\n" + e.stack);
conditionPassed = false;
}
if (conditionPassed) {
moveOn();
}
tries++;
}, 100);
- let moveOn = function() { clearInterval(interval); nextTest(); };
+ let moveOn = function() {
+ clearInterval(interval); nextTest();
+};
}
function getTestPluginTag() {
let ph = Cc["@mozilla.org/plugin/host;1"].getService(Ci.nsIPluginHost);
let tags = ph.getPluginTags();
// Find the test plugin
for (let i = 0; i < tags.length; i++) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_AddonRepository_cache.js
@@ -201,17 +201,19 @@ const WITHOUT_CACHE = [{
name: "XPI Add-on 3",
version: "1.3",
get iconURL() {
return get_subfile_uri(ADDON_IDS[2], "icon.png");
},
get icons() {
return { "32": get_subfile_uri(ADDON_IDS[2], "icon.png") };
},
- screenshots: [{ get url() { return get_subfile_uri(ADDON_IDS[2], "preview.png"); } }],
+ screenshots: [{ get url() {
+ return get_subfile_uri(ADDON_IDS[2], "preview.png");
+} }],
sourceURI: NetUtil.newURI(ADDON_FILES[2]).spec
}];
// Expected add-ons when using cache
const WITH_CACHE = [{
id: ADDON_IDS[0],
type: "extension",
@@ -392,17 +394,19 @@ const WITH_EXTENSION_CACHE = [{
name: "XPI Add-on 3",
version: "1.3",
get iconURL() {
return get_subfile_uri(ADDON_IDS[2], "icon.png");
},
get icons() {
return { "32": get_subfile_uri(ADDON_IDS[2], "icon.png") };
},
- screenshots: [{ get url() { return get_subfile_uri(ADDON_IDS[2], "preview.png"); } }],
+ screenshots: [{ get url() {
+ return get_subfile_uri(ADDON_IDS[2], "preview.png");
+} }],
sourceURI: NetUtil.newURI(ADDON_FILES[2]).spec
}];
var gDBFile = gProfD.clone();
gDBFile.append(FILE_DATABASE);
/*
* Check the actual add-on results against the expected add-on results
--- a/toolkit/mozapps/extensions/test/xpcshell/test_LightweightThemeManager.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_LightweightThemeManager.js
@@ -550,19 +550,23 @@ function run_test() {
ltm.currentTheme = dummy("x0");
do_check_eq([...ltm._builtInThemes].length, 2);
do_check_eq(ltm.usedThemes.length, 3);
do_check_eq(ltm.usedThemes[0].id, "x0");
do_check_eq(ltm.currentTheme.id, "x0");
do_check_eq(ltm.usedThemes[1].id, "builtInTheme0");
do_check_eq(ltm.usedThemes[2].id, "builtInTheme1");
- Assert.throws(() => { ltm.addBuiltInTheme(dummy("builtInTheme0")) },
+ Assert.throws(() => {
+ ltm.addBuiltInTheme(dummy("builtInTheme0"))
+},
"Exception is thrown adding a duplicate theme");
- Assert.throws(() => { ltm.addBuiltInTheme("not a theme object") },
+ Assert.throws(() => {
+ ltm.addBuiltInTheme("not a theme object")
+},
"Exception is thrown adding an invalid theme");
AddonManager.getAddonByID("x0@personas.mozilla.org", x0Addon => {
// Currently applied (non-app-specific) can be uninstalled or disabled,
// but can't be enabled (since it's already applied).
do_check_eq(hasPermission(x0Addon, "uninstall"), true);
do_check_eq(hasPermission(x0Addon, "disable"), true);
do_check_eq(hasPermission(x0Addon, "enable"), false);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_gfx.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_blocklist_gfx.js
@@ -38,17 +38,19 @@ add_task(function* test_sends_serialized
const blocklist = Blocklist();
blocklist._gfxEntries = [SAMPLE_GFX_RECORD];
const expected = "blockID:g36\tdevices:0x0a6c,geforce\tdriverVersion:8.17.12.5896\t" +
"driverVersionComparator:LESS_THAN_OR_EQUAL\tfeature:DIRECT3D_9_LAYERS\t" +
"featureStatus:BLOCKED_DRIVER_VERSION\tos:WINNT 6.1\tvendor:0x10de\t" +
"versionRange:0,*";
let received;
- const observe = (subject, topic, data) => { received = data };
+ const observe = (subject, topic, data) => {
+ received = data
+};
Services.obs.addObserver(observe, EVENT_NAME, false);
blocklist._notifyObserversBlocklistGFX();
equal(received, expected);
Services.obs.removeObserver(observe, EVENT_NAME);
});
add_task(function* test_parsing_fails_if_devices_contains_comma() {
@@ -74,34 +76,38 @@ add_task(function* test_empty_values_are
"<gfxItems>" +
" <gfxBlacklistEntry>" +
" <os></os>" +
" </gfxBlacklistEntry>" +
"</gfxItems>" +
"</blocklist>";
const blocklist = Blocklist();
let received;
- const observe = (subject, topic, data) => { received = data };
+ const observe = (subject, topic, data) => {
+ received = data
+};
Services.obs.addObserver(observe, EVENT_NAME, false);
blocklist._loadBlocklistFromString(input);
ok(received.indexOf("os" < 0));
Services.obs.removeObserver(observe, EVENT_NAME);
});
add_task(function* test_empty_devices_are_ignored() {
const input = "<blocklist xmlns=\"http://www.mozilla.org/2006/addons-blocklist\">" +
"<gfxItems>" +
" <gfxBlacklistEntry>" +
" <devices></devices>" +
" </gfxBlacklistEntry>" +
"</gfxItems>" +
"</blocklist>";
const blocklist = Blocklist();
let received;
- const observe = (subject, topic, data) => { received = data };
+ const observe = (subject, topic, data) => {
+ received = data
+};
Services.obs.addObserver(observe, EVENT_NAME, false);
blocklist._loadBlocklistFromString(input);
ok(received.indexOf("devices" < 0));
Services.obs.removeObserver(observe, EVENT_NAME);
});
add_task(function* test_version_range_default_values() {
const input = "<blocklist xmlns=\"http://www.mozilla.org/2006/addons-blocklist\">" +
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug449027.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug449027.js
@@ -386,17 +386,19 @@ function check_test_pt1() {
dump("Checking pt 1\n");
AddonManager.getAddonsByIDs(ADDONS.map(a => a.id), function(addons) {
for (var i = 0; i < ADDONS.length; i++) {
if (!addons[i])
do_throw("Addon " + (i + 1) + " did not get installed correctly");
}
- do_execute_soon(function checkstate1() { check_state("start", null, run_test_pt2); });
+ do_execute_soon(function checkstate1() {
+ check_state("start", null, run_test_pt2);
+});
});
}
/**
* Load the toolkit based blocks
*/
function run_test_pt2() {
dump("Running test pt 2\n");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug659772.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug659772.js
@@ -238,17 +238,19 @@ function run_test_2() {
do_check_false(a4.userDisabled);
do_check_false(a4.isActive);
do_check_false(isExtensionInAddonsList(profileDir, addon4.id));
// Prepare the add-on update, and a bootstrapped addon (bug 693714)
installAllFiles([
do_get_addon("test_bug659772"),
do_get_addon("test_bootstrap1_1")
- ], function() { do_execute_soon(prepare_schema_migrate); });
+ ], function() {
+ do_execute_soon(prepare_schema_migrate);
+});
function prepare_schema_migrate() {
shutdownManager();
// Make it look like the next time the app is started it has a new DB schema
changeXPIDBVersion(1);
Services.prefs.setIntPref("extensions.databaseSchema", 1);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_experiment.js
@@ -47,19 +47,25 @@ add_task(function* test_experiment() {
Assert.equal(addon.applyBackgroundUpdates, AddonManager.AUTOUPDATE_DISABLE,
"Setting applyBackgroundUpdates shouldn't do anything.");
let noCompatibleCalled = false;
let noUpdateCalled = false;
let finishedCalled = false;
let listener = {
- onNoCompatibilityUpdateAvailable: () => { noCompatibleCalled = true; },
- onNoUpdateAvailable: () => { noUpdateCalled = true; },
- onUpdateFinished: () => { finishedCalled = true; },
+ onNoCompatibilityUpdateAvailable: () => {
+ noCompatibleCalled = true;
+},
+ onNoUpdateAvailable: () => {
+ noUpdateCalled = true;
+},
+ onUpdateFinished: () => {
+ finishedCalled = true;
+},
};
addon.findUpdates(listener, "testing", null, null);
Assert.ok(noCompatibleCalled, "Listener called.");
Assert.ok(noUpdateCalled, "Listener called.");
Assert.ok(finishedCalled, "Listener called.");
});
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gmpProvider.js
@@ -265,17 +265,19 @@ add_task(function* test_pluginRegistrati
let profD = do_get_profile();
for (let addon of gMockAddons.values()) {
let file = profD.clone();
file.append(addon.id);
file.append(TEST_VERSION);
let addedPaths = [];
let removedPaths = [];
- let clearPaths = () => { addedPaths = []; removedPaths = []; }
+ let clearPaths = () => {
+ addedPaths = []; removedPaths = [];
+}
let MockGMPService = {
addPluginDirectory: path => {
if (!addedPaths.includes(path)) {
addedPaths.push(path);
}
},
removePluginDirectory: path => {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install.js
@@ -246,17 +246,19 @@ function check_test_2(install) {
do_check_eq(install.name, "Real Test 2");
do_check_eq(install.state, AddonManager.STATE_DOWNLOADED);
do_check_eq(install.addon.install, install);
do_check_true(hasFlag(install.addon.operationsRequiringRestart,
AddonManager.OP_NEEDS_RESTART_INSTALL));
do_check_eq(install.iconURL, null);
// Pause the install here and start it again in run_test_3
- do_execute_soon(function() { run_test_3(install); });
+ do_execute_soon(function() {
+ run_test_3(install);
+});
return false;
}
// Tests that the downloaded XPI installs ok
function run_test_3(install) {
prepare_test({
"addon2@tests.mozilla.org": [
"onInstalling"
--- a/toolkit/mozapps/extensions/test/xpcshell/test_install_strictcompat.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_install_strictcompat.js
@@ -174,17 +174,19 @@ function check_test_1() {
do_check_false(a1.hasResource("foo.bar"));
let root_uri = do_get_addon_root_uri(profileDir, "addon1@tests.mozilla.org");
do_check_eq(a1.getResourceURI("install.rdf").spec, root_uri + "install.rdf");
do_check_eq(a1.iconURL, root_uri + "icon.png");
do_check_eq(a1.icon64URL, root_uri + "icon64.png");
a1.uninstall();
- do_execute_soon(function() { run_test_2(a1) });
+ do_execute_soon(function() {
+ run_test_2(a1)
+});
});
});
}));
});
}
// Tests that an install from a url downloads.
function run_test_2(aAddon) {
@@ -229,17 +231,19 @@ function check_test_2(install) {
do_check_eq(install.name, "Real Test 2");
do_check_eq(install.state, AddonManager.STATE_DOWNLOADED);
do_check_eq(install.addon.install, install);
do_check_true(hasFlag(install.addon.operationsRequiringRestart,
AddonManager.OP_NEEDS_RESTART_INSTALL));
do_check_eq(install.iconURL, null);
// Pause the install here and start it again in run_test_3
- do_execute_soon(function() { run_test_3(install); });
+ do_execute_soon(function() {
+ run_test_3(install);
+});
return false;
}
// Tests that the downloaded XPI installs ok
function run_test_3(install) {
prepare_test({
"addon2@tests.mozilla.org": [
"onInstalling"
--- a/toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_syncGUID.js
@@ -104,17 +104,19 @@ add_test(function test_error_on_duplicat
}
}));
});
}
}
};
AddonManager.addInstallListener(listener);
- let getInstallCB = function(install) { install.install(); };
+ let getInstallCB = function(install) {
+ install.install();
+};
for (let name of installNames) {
AddonManager.getInstallForFile(do_get_addon(name), getInstallCB);
}
});
add_test(function test_fetch_by_guid_known_guid() {
AddonManager.getAddonByID(addonId, function(addon) {
--- a/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_updateid.js
@@ -52,13 +52,15 @@ add_task(function* test_update_new_id()
let update = yield promiseFindAddonUpdates(addon, AddonManager.UPDATE_WHEN_USER_REQUESTED);
let install = update.updateAvailable;
do_check_eq(install.name, addon.name);
do_check_eq(install.version, "2.0");
do_check_eq(install.state, AddonManager.STATE_AVAILABLE);
do_check_eq(install.existingAddon, addon);
yield Assert.rejects(promiseInstallUpdate(install),
- function(err) { return err.code == AddonManager.ERROR_INCORRECT_ID },
+ function(err) {
+ return err.code == AddonManager.ERROR_INCORRECT_ID
+},
"Upgrade to a different ID fails");
addon.uninstall();
});
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_amosigned_trigger.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_amosigned_trigger.js
@@ -10,17 +10,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
IconURL: TESTROOT + "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function confirm_install(window) {
var items = window.document.getElementById("itemList").childNodes;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_amosigned_trigger_iframe.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_amosigned_trigger_iframe.js
@@ -11,17 +11,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var inner_url = encodeURIComponent(TESTROOT + "installtrigger.html?" + encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
IconURL: TESTROOT + "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
})));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger_frame.html?" + inner_url);
}
function confirm_install(window) {
var items = window.document.getElementById("itemList").childNodes;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_badhash.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_badhash.js
@@ -8,17 +8,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
Hash: "sha1:643b08418599ddbd1ea8a511c90696578fb844b9",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function download_failed(install) {
is(install.error, AddonManager.ERROR_INCORRECT_HASH, "Install should fail");
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_badhashtype.js
@@ -8,17 +8,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
Hash: "foo:3d0dc22e1f394e159b08aaf5f0f97de4d5c65f4f",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function download_failed(install) {
is(install.error, AddonManager.ERROR_INCORRECT_HASH, "Install should fail");
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_hash.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_hash.js
@@ -8,17 +8,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
Hash: "sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function install_ended(install, addon) {
install.cancel();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_hash2.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_hash2.js
@@ -8,17 +8,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
Hash: "sha1:36FFB0ACFD9C6E9682473AAEBAAB394D38B473C9",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function install_ended(install, addon) {
install.cancel();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_httphash.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_httphash.js
@@ -12,17 +12,19 @@ function test() {
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
url += "?sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9|" + TESTROOT + "amosigned.xpi";
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: url,
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function install_ended(install, addon) {
install.cancel();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_httphash2.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_httphash2.js
@@ -12,17 +12,19 @@ function test() {
Services.prefs.setBoolPref(PREF_INSTALL_REQUIREBUILTINCERTS, false);
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: url,
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function download_failed(install) {
is(install.error, AddonManager.ERROR_INCORRECT_HASH, "Download should fail");
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_httphash3.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_httphash3.js
@@ -12,17 +12,19 @@ function test() {
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: url,
Hash: "sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function install_ended(install, addon) {
install.cancel();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_httphash4.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_httphash4.js
@@ -10,17 +10,19 @@ function test() {
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var url = "http://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: url,
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function install_ended(install, addon) {
install.cancel();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_httphash5.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_httphash5.js
@@ -13,17 +13,19 @@ function test() {
var url = "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
url += "?sha1:36ffb0acfd9c6e9682473aaebaab394d38b473c9|";
url += "https://example.com/browser/" + RELATIVE_DIR + "hashRedirect.sjs";
url += "?sha1:foobar|" + TESTROOT + "amosigned.xpi";
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: url,
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function install_ended(install, addon) {
install.cancel();
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_httphash6.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_httphash6.js
@@ -29,17 +29,19 @@ function test() {
"Location": "http://example.com/browser/" + RELATIVE_DIR + "amosigned.xpi"
});
var url = "https://example.com/browser/" + RELATIVE_DIR + "redirect.sjs?mode=redirect";
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: url,
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function download_failed(install) {
is(install.error, AddonManager.ERROR_INCORRECT_HASH, "Should have seen a hash failure");
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_relative.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_relative.js
@@ -9,17 +9,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: "amosigned.xpi",
IconURL: "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function confirm_install(window) {
var items = window.document.getElementById("itemList").childNodes;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_switchtab.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_switchtab.js
@@ -11,17 +11,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
IconURL: TESTROOT + "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
expectedTab = gBrowser.addTab();
expectedTab.linkedBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function confirm_install(window) {
var items = window.document.getElementById("itemList").childNodes;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger.js
@@ -10,17 +10,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var triggers = encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "unsigned.xpi",
IconURL: TESTROOT + "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
}));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger.html?" + triggers);
}
function confirm_install(window) {
var items = window.document.getElementById("itemList").childNodes;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger_iframe.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger_iframe.js
@@ -11,17 +11,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var inner_url = encodeURIComponent(TESTROOT + "installtrigger.html?" + encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "unsigned.xpi",
IconURL: TESTROOT + "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
})));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT + "installtrigger_frame.html?" + inner_url);
}
function confirm_install(window) {
var items = window.document.getElementById("itemList").childNodes;
--- a/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger_xorigin.js
+++ b/toolkit/mozapps/extensions/test/xpinstall/browser_unsigned_trigger_xorigin.js
@@ -11,17 +11,19 @@ function test() {
var pm = Services.perms;
pm.add(makeURI("http://example.com/"), "install", pm.ALLOW_ACTION);
var inner_url = encodeURIComponent(TESTROOT + "installtrigger.html?" + encodeURIComponent(JSON.stringify({
"Unsigned XPI": {
URL: TESTROOT + "amosigned.xpi",
IconURL: TESTROOT + "icon.png",
- toString() { return this.URL; }
+ toString() {
+ return this.URL;
+}
}
})));
gBrowser.selectedTab = gBrowser.addTab();
gBrowser.loadURI(TESTROOT2 + "installtrigger_frame.html?" + inner_url);
}
function install_blocked(installInfo) {
wasOriginBlocked = true;
--- a/toolkit/mozapps/update/content/updates.js
+++ b/toolkit/mozapps/update/content/updates.js
@@ -1273,17 +1273,19 @@ var gFinishedPage = {
document.getElementById("finishedBackgroundMoreElevatedLinkLabel");
let manualURL = Services.urlFormatter.formatURLPref(PREF_APP_UPDATE_URL_MANUAL);
moreElevatedLinkLabel.value = manualURL;
moreElevatedLinkLabel.setAttribute("url", manualURL);
moreElevatedLinkLabel.setAttribute("hidden", "false");
}
if (getPref("getBoolPref", PREF_APP_UPDATE_TEST_LOOP, false)) {
- setTimeout(function() { gUpdates.wiz.getButton("finish").click(); },
+ setTimeout(function() {
+ gUpdates.wiz.getButton("finish").click();
+},
UPDATE_TEST_LOOP_INTERVAL);
}
},
/**
* Called when the wizard finishes, i.e. the "Restart Now" button is
* clicked.
*/
--- a/toolkit/mozapps/update/nsUpdateService.js
+++ b/toolkit/mozapps/update/nsUpdateService.js
@@ -3259,18 +3259,22 @@ Checker.prototype = {
// final destination. It does not help if a resource is already
// cached locally.
this._request.setRequestHeader("Cache-Control", "no-cache");
// HTTP/1.0 servers might not implement Cache-Control and
// might only implement Pragma: no-cache
this._request.setRequestHeader("Pragma", "no-cache");
var self = this;
- this._request.addEventListener("error", function(event) { self.onError(event); }, false);
- this._request.addEventListener("load", function(event) { self.onLoad(event); }, false);
+ this._request.addEventListener("error", function(event) {
+ self.onError(event);
+}, false);
+ this._request.addEventListener("load", function(event) {
+ self.onLoad(event);
+}, false);
LOG("Checker:checkForUpdates - sending request to: " + url);
this._request.send(null);
this._callback = listener;
},
/**