--- a/browser/base/content/browser-data-submission-info-bar.js
+++ b/browser/base/content/browser-data-submission-info-bar.js
@@ -34,17 +34,17 @@ var gDataNotificationInfoBar = {
}
}, false);
for (let o of this._OBSERVERS) {
Services.obs.addObserver(this, o, true);
}
},
- _getDataReportingNotification: function (name=this._DATA_REPORTING_NOTIFICATION) {
+ _getDataReportingNotification: function (name = this._DATA_REPORTING_NOTIFICATION) {
return this._notificationBox.getNotificationWithValue(name);
},
_displayDataPolicyInfoBar: function (request) {
if (this._getDataReportingNotification()) {
return;
}
--- a/browser/base/content/browser-fxaccounts.js
+++ b/browser/base/content/browser-fxaccounts.js
@@ -339,17 +339,17 @@ var gFxAccounts = {
PanelUI.hide();
},
openPreferences: function () {
openPreferences("paneSync", { urlParams: { entrypoint: "menupanel" } });
},
- openAccountsPage: function (action, urlParams={}) {
+ openAccountsPage: function (action, urlParams = {}) {
let params = new URLSearchParams();
if (action) {
params.set("action", action);
}
for (let name in urlParams) {
if (urlParams[name] !== undefined) {
params.set(name, urlParams[name]);
}
--- a/browser/base/content/browser-places.js
+++ b/browser/base/content/browser-places.js
@@ -528,17 +528,17 @@ var PlacesCommandHook = {
* bookmarked.
* @param aURL (string)
* the address of the link target
* @param aTitle
* The link text
* @param [optional] aDescription
* The linked page description, if available
*/
- bookmarkLink: Task.async(function* (aParentId, aURL, aTitle, aDescription="") {
+ bookmarkLink: Task.async(function* (aParentId, aURL, aTitle, aDescription = "") {
let node = yield PlacesUIUtils.fetchNodeLike({ url: aURL });
if (node) {
PlacesUIUtils.showBookmarkDialog({ action: "edit"
, node
}, window.top);
return;
}
--- a/browser/base/content/browser-tabsintitlebar.js
+++ b/browser/base/content/browser-tabsintitlebar.js
@@ -96,17 +96,17 @@ var TabsInTitlebar = {
_prefName: "browser.tabs.drawInTitlebar",
_lastSizeMode: null,
_readPref: function () {
this.allowedBy("pref",
Services.prefs.getBoolPref(this._prefName));
},
- _update: function (aForce=false) {
+ _update: function (aForce = false) {
let $ = id => document.getElementById(id);
let rect = ele => ele.getBoundingClientRect();
let verticalMargins = cstyle => parseFloat(cstyle.marginBottom) + parseFloat(cstyle.marginTop);
if (window.fullScreen)
return;
// In some edgecases it is possible for this to fire before we've initialized.
@@ -249,17 +249,17 @@ var TabsInTitlebar = {
ToolbarIconColor.inferFromText();
if (CustomizationHandler.isCustomizing()) {
gCustomizeMode.updateLWTStyling();
}
},
_sizePlaceholder: function (type, width) {
- Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='"+ type +"']"),
+ Array.forEach(document.querySelectorAll(".titlebar-placeholder[type='" + type + "']"),
function (node) { node.width = width; });
},
uninit: function () {
this._initialized = false;
removeEventListener("resolutionchange", this);
Services.prefs.removeObserver(this._prefName, this);
this._menuObserver.disconnect();
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -3440,17 +3440,17 @@ function openHomeDialog(aURL)
if (pressedVal == 0) {
try {
var homepageStr = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
homepageStr.data = aURL;
gPrefService.setComplexValue("browser.startup.homepage",
Components.interfaces.nsISupportsString, homepageStr);
} catch (ex) {
- dump("Failed to set the home page.\n"+ex+"\n");
+ dump("Failed to set the home page.\n" + ex + "\n");
}
}
}
var newTabButtonObserver = {
onDragOver(aEvent) {
browserDragAndDrop.dragOver(aEvent);
},
@@ -3763,17 +3763,17 @@ const BrowserSearch = {
* allowed values.
* @param details [optional]
* An optional parameter passed to |BrowserUsageTelemetry.recordSearch|.
* See its documentation for allowed options.
* Additionally, if the search was a suggested search, |details.selection|
* indicates where the item was in the suggestion list and how the user
* selected it: {selection: {index: The selected index, kind: "key" or "mouse"}}
*/
- recordSearchInTelemetry: function (engine, source, details={}) {
+ recordSearchInTelemetry: function (engine, source, details = {}) {
BrowserUITelemetry.countSearchEvent(source, null, details.selection);
try {
BrowserUsageTelemetry.recordSearch(engine, source, details);
} catch (ex) {
Cu.reportError(ex);
}
},
@@ -4011,17 +4011,17 @@ function OpenBrowserWindow(options)
// if and only if the current window is a browser window and it has a document with a character
// set, then extract the current charset menu setting from the current document and use it to
// initialize the new browser window...
var win;
if (window && (wintype == "navigator:browser") && window.content && window.content.document)
{
var DocCharset = window.content.document.characterSet;
- charsetArg = "charset="+DocCharset;
+ charsetArg = "charset=" + DocCharset;
// we should "inherit" the charset menu setting in a new window
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no" + extraFeatures, defaultArgs, charsetArg);
}
else // forget about the charset information.
{
win = window.openDialog("chrome://browser/content/", "_blank", "chrome,all,dialog=no" + extraFeatures, defaultArgs);
}
@@ -4875,19 +4875,19 @@ var TabsProgressListener = {
}
function nsBrowserAccess() { }
nsBrowserAccess.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsIBrowserDOMWindow, Ci.nsISupports]),
_openURIInNewTab: function(aURI, aReferrer, aReferrerPolicy, aIsPrivate,
- aIsExternal, aForceNotRemote=false,
- aUserContextId=Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID,
- aOpener=null) {
+ aIsExternal, aForceNotRemote = false,
+ aUserContextId = Ci.nsIScriptSecurityManager.DEFAULT_USER_CONTEXT_ID,
+ aOpener = null) {
let win, needToFocusWin;
// try the current window. if we're in a popup, fall back on the most recent browser window
if (window.toolbar.visible)
win = window;
else {
win = RecentWindow.getMostRecentBrowserWindow({private: aIsPrivate});
needToFocusWin = true;
@@ -5054,17 +5054,17 @@ function getTogglableToolbars() {
}
function onViewToolbarsPopupShowing(aEvent, aInsertPoint) {
var popup = aEvent.target;
if (popup != aEvent.currentTarget)
return;
// Empty the menu
- for (var i = popup.childNodes.length-1; i >= 0; --i) {
+ for (var i = popup.childNodes.length - 1; i >= 0; --i) {
var deadItem = popup.childNodes[i];
if (deadItem.hasAttribute("toolbarId"))
popup.removeChild(deadItem);
}
var firstMenuItem = aInsertPoint || popup.firstChild;
let toolbarNodes = getTogglableToolbars();
@@ -5149,17 +5149,17 @@ function onViewToolbarsPopupShowing(aEve
}
function onViewToolbarCommand(aEvent) {
var toolbarId = aEvent.originalTarget.getAttribute("toolbarId");
var isVisible = aEvent.originalTarget.getAttribute("checked") == "true";
CustomizableUI.setToolbarVisibility(toolbarId, isVisible);
}
-function setToolbarVisibility(toolbar, isVisible, persist=true) {
+function setToolbarVisibility(toolbar, isVisible, persist = true) {
let hidingAttribute;
if (toolbar.getAttribute("type") == "menubar") {
hidingAttribute = "autohide";
if (AppConstants.platform == "linux") {
Services.prefs.setBoolPref("ui.key.menuAccessKeyFocuses", !isVisible);
}
} else {
hidingAttribute = "collapsed";
@@ -7637,17 +7637,17 @@ var gRemoteTabsUI = {
* If set to "whenComparingAndReplace", the fragment will be replaced.
* - 'ignoreQueryString' boolean property to be set to true to exclude query string
* matching when comparing URIs.
* - 'replaceQueryString' boolean property to be set to true to exclude query string
* matching when comparing URIs and overwrite the initial query string with
* the one from the new URI.
* @return True if an existing tab was found, false otherwise
*/
-function switchToTabHavingURI(aURI, aOpenNew, aOpenParams={}) {
+function switchToTabHavingURI(aURI, aOpenNew, aOpenParams = {}) {
// Certain URLs can be switched to irrespective of the source or destination
// window being in private browsing mode:
const kPrivateBrowsingWhitelist = new Set([
"about:addons",
]);
let ignoreFragment = aOpenParams.ignoreFragment;
let ignoreQueryString = aOpenParams.ignoreQueryString;
--- a/browser/base/content/content.js
+++ b/browser/base/content/content.js
@@ -830,17 +830,17 @@ addMessageListener("ContextMenu:SearchFi
let type = el.type.toLowerCase();
if (((el instanceof content.HTMLInputElement && el.mozIsTextField(true)) ||
type == "hidden" || type == "textarea") ||
((type == "checkbox" || type == "radio") && el.checked)) {
formData.push(escapeNameValuePair(el.name, el.value, isURLEncoded));
} else if (el instanceof content.HTMLSelectElement && el.selectedIndex >= 0) {
- for (let j=0; j < el.options.length; j++) {
+ for (let j = 0; j < el.options.length; j++) {
if (el.options[j].selected)
formData.push(escapeNameValuePair(el.name, el.options[j].value,
isURLEncoded));
}
}
}
let postData;
--- a/browser/base/content/contentSearchUI.js
+++ b/browser/base/content/contentSearchUI.js
@@ -33,17 +33,17 @@ const HTML_NS = "http://www.w3.org/1999/
* This will be sent with the search data for FHR to record the search.
* @param searchPurpose
* Sent with search data, see nsISearchEngine.getSubmission.
* @param idPrefix
* The IDs of elements created by the object will be prefixed with this
* string.
*/
function ContentSearchUIController(inputElement, tableParent, healthReportKey,
- searchPurpose, idPrefix="") {
+ searchPurpose, idPrefix = "") {
this.input = inputElement;
this._idPrefix = idPrefix;
this._healthReportKey = healthReportKey;
this._searchPurpose = searchPurpose;
let tableID = idPrefix + "searchSuggestionTable";
this.input.autocomplete = "off";
this.input.setAttribute("aria-autocomplete", "true");
@@ -896,17 +896,17 @@ ContentSearchUIController.prototype = {
cell.appendChild(button);
this._oneOffButtons.push(button);
}
row.appendChild(cell);
this._oneOffsTable.appendChild(row);
this._oneOffsTable.hidden = false;
},
- _sendMsg: function (type, data=null) {
+ _sendMsg: function (type, data = null) {
dispatchEvent(new CustomEvent("ContentSearchClient", {
detail: {
type: type,
data: data,
},
}));
},
};
--- a/browser/base/content/sanitize.js
+++ b/browser/base/content/sanitize.js
@@ -776,17 +776,17 @@ Sanitizer.__defineGetter__("prefs", func
.getService(Components.interfaces.nsIPrefService)
.getBranch(Sanitizer.PREF_DOMAIN);
});
// Shows sanitization UI
Sanitizer.showUI = function(aParentWindow)
{
let win = AppConstants.platform == "macosx" ?
- null: // make this an app-modal window on Mac
+ null : // make this an app-modal window on Mac
aParentWindow;
Services.ww.openWindow(win,
"chrome://browser/content/sanitize.xul",
"Sanitize",
"chrome,titlebar,dialog,centerscreen,modal",
null);
};
--- a/browser/base/content/tab-content.js
+++ b/browser/base/content/tab-content.js
@@ -424,24 +424,24 @@ var ContentSearchMediator = {
this._fireEvent(msg.data.type, msg.data.data);
}
},
get _contentWhitelisted() {
return this.whitelist.has(content.document.documentURI);
},
- _sendMsg: function (type, data=null) {
+ _sendMsg: function (type, data = null) {
sendAsyncMessage("ContentSearch", {
type: type,
data: data,
});
},
- _fireEvent: function (type, data=null) {
+ _fireEvent: function (type, data = null) {
let event = Cu.cloneInto({
detail: {
type: type,
data: data,
},
}, content);
content.dispatchEvent(new content.CustomEvent("ContentSearchService",
event));
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -2238,17 +2238,17 @@
}
if (aFromExternal)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FROM_EXTERNAL;
if (aAllowMixedContent)
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_ALLOW_MIXED_CONTENT;
try {
b.loadURIWithFlags(aURI, {
flags,
- referrerURI: aNoReferrer ? null: aReferrerURI,
+ referrerURI: aNoReferrer ? null : aReferrerURI,
referrerPolicy: aReferrerPolicy,
charset: aCharset,
postData: aPostData,
});
} catch (ex) {
Cu.reportError(ex);
}
}
@@ -3223,17 +3223,17 @@
aIndex = Math.max(aIndex, this._numPinnedTabs);
if (oldPosition == aIndex)
return;
this._lastRelatedTab = null;
let wasFocused = (document.activeElement == this.mCurrentTab);
- aIndex = aIndex < aTab._tPos ? aIndex: aIndex+1;
+ aIndex = aIndex < aTab._tPos ? aIndex : aIndex + 1;
// invalidate cache
this._visibleTabs = null;
// use .item() instead of [] because dragging to the end of the strip goes out of
// bounds: .item() returns null (so it acts like appendChild), but [] throws
this.tabContainer.insertBefore(aTab, this.tabs.item(aIndex));
@@ -5522,17 +5522,17 @@
<!-- Try to keep the active tab's close button under the mouse cursor -->
<method name="_lockTabSizing">
<parameter name="aTab"/>
<body><![CDATA[
var tabs = this.tabbrowser.visibleTabs;
if (!tabs.length)
return;
- var isEndTab = (aTab._tPos > tabs[tabs.length-1]._tPos);
+ var isEndTab = (aTab._tPos > tabs[tabs.length - 1]._tPos);
var tabWidth = aTab.getBoundingClientRect().width;
if (!this._tabDefaultMaxWidth)
this._tabDefaultMaxWidth =
parseFloat(window.getComputedStyle(aTab).maxWidth);
this._lastTabClosedByMouse = true;
if (this.getAttribute("overflow") == "true") {
@@ -6362,17 +6362,17 @@
if (!ltr)
[minMargin, maxMargin] = [this.clientWidth - maxMargin,
this.clientWidth - minMargin];
newMargin = (pixelsToScroll > 0) ? maxMargin : minMargin;
}
else {
let newIndex = this._getDropIndex(event, effects == "link");
if (newIndex == this.childNodes.length) {
- let tabRect = this.childNodes[newIndex-1].getBoundingClientRect();
+ let tabRect = this.childNodes[newIndex - 1].getBoundingClientRect();
if (ltr)
newMargin = tabRect.right - rect.left;
else
newMargin = rect.right - tabRect.left;
}
else {
let tabRect = this.childNodes[newIndex].getBoundingClientRect();
if (ltr)
--- a/browser/base/content/test/general/browser_aboutHealthReport.js
+++ b/browser/base/content/test/general/browser_aboutHealthReport.js
@@ -114,17 +114,17 @@ function test()
gBrowser.removeCurrentTab();
}
finish();
});
}
-function promiseNewTabLoadEvent(aUrl, aEventType="load")
+function promiseNewTabLoadEvent(aUrl, aEventType = "load")
{
let deferred = Promise.defer();
let tab = gBrowser.selectedTab = gBrowser.addTab(aUrl);
tab.linkedBrowser.addEventListener(aEventType, function load(event) {
tab.linkedBrowser.removeEventListener(aEventType, load, true);
let iframe = tab.linkedBrowser.contentDocument.getElementById("remote-report");
iframe.addEventListener("load", function frameLoad(e) {
if (iframe.contentWindow.location.href == "about:blank" ||
--- a/browser/base/content/test/general/browser_aboutHome.js
+++ b/browser/base/content/test/general/browser_aboutHome.js
@@ -287,17 +287,17 @@ add_task(function* () {
function check(n) {
let win = Services.wm.getMostRecentWindow("Browser:Preferences");
ok(!win, "Preferences window not showing");
if (win) {
win.close();
}
if (n > 0) {
- executeSoon(() => check(n-1));
+ executeSoon(() => check(n - 1));
} else {
resolve();
}
}
check(5);
});
});
--- a/browser/base/content/test/general/browser_bug356571.js
+++ b/browser/base/content/test/general/browser_bug356571.js
@@ -81,13 +81,13 @@ function finishTest() {
Cm.QueryInterface(Ci.nsIComponentRegistrar)
.registerFactory(Components.ID(kPromptServiceUUID), "Prompt Service",
kPromptServiceContractID, kPromptServiceFactory);
// Remove the listener
gBrowser.removeTabsProgressListener(gProgressListener);
// Close opened tabs
- for (var i = gBrowser.tabs.length-1; i > 0; i--)
+ for (var i = gBrowser.tabs.length - 1; i > 0; i--)
gBrowser.removeTab(gBrowser.tabs[i]);
finish();
}
--- a/browser/base/content/test/general/browser_bug477014.js
+++ b/browser/base/content/test/general/browser_bug477014.js
@@ -1,15 +1,15 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// That's a gecko!
const iconURLSpec = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAHWSURBVHjaYvz//z8DJQAggJiQOe/fv2fv7Oz8rays/N+VkfG/iYnJfyD/1+rVq7ffu3dPFpsBAAHEAHIBCJ85c8bN2Nj4vwsDw/8zQLwKiO8CcRoQu0DxqlWrdsHUwzBAAIGJmTNnPgYa9j8UqhFElwPxf2MIDeIrKSn9FwSJoRkAEEAM0DD4DzMAyPi/G+QKY4hh5WAXGf8PDQ0FGwJ22d27CjADAAIIrLmjo+MXA9R2kAHvGBA2wwx6B8W7od6CeQcggKCmCEL8bgwxYCbUIGTDVkHDBia+CuotgACCueD3TDQN75D4xmAvCoK9ARMHBzAw0AECiBHkAlC0Mdy7x9ABNA3obAZXIAa6iKEcGlMVQHwWyjYuL2d4v2cPg8vZswx7gHyAAAK7AOif7SAbOqCmn4Ha3AHFsIDtgPq/vLz8P4MSkJ2W9h8ggBjevXvHDo4FQUQg/kdypqCg4H8lUIACnQ/SOBMYI8bAsAJFPcj1AAEEjwVQqLpAbXmH5BJjqI0gi9DTAAgDBBCcAVLkgmQ7yKCZxpCQxqUZhAECCJ4XgMl493ug21ZD+aDAXH0WLM4A9MZPXJkJIIAwTAR5pQMalaCABQUULttBGCCAGCnNzgABBgAMJ5THwGvJLAAAAABJRU5ErkJggg==";
-var testPage="data:text/plain,test bug 477014";
+var testPage = "data:text/plain,test bug 477014";
add_task(function*() {
let tabToDetach = gBrowser.addTab(testPage);
yield waitForDocLoadComplete(tabToDetach.linkedBrowser);
gBrowser.setIcon(tabToDetach, iconURLSpec,
Services.scriptSecurityManager.getSystemPrincipal());
tabToDetach.setAttribute("busy", "true");
--- a/browser/base/content/test/general/browser_contentSearchUI.js
+++ b/browser/base/content/test/general/browser_contentSearchUI.js
@@ -655,17 +655,17 @@ function setUp(aNoEngine) {
yield setUpEngines();
yield promiseTab();
gDidInitialSetUp = true;
}
yield msg("focus");
});
}
-function msg(type, data=null) {
+function msg(type, data = null) {
gMsgMan.sendAsyncMessage(TEST_MSG, {
type: type,
data: data,
});
let deferred = Promise.defer();
gMsgMan.addMessageListener(TEST_MSG, function onMsg(msgObj) {
if (msgObj.data.type != type) {
return;
--- a/browser/base/content/test/general/browser_ctrlTab.js
+++ b/browser/base/content/test/general/browser_ctrlTab.js
@@ -174,12 +174,12 @@ add_task(function* () {
ok(!isOpen(),
"Releasing Ctrl closes the preview panel");
} else {
ok(!isOpen(),
"With " + tabCount + " tabs open, Ctrl+Tab doesn't open the preview panel");
}
is(gBrowser.tabContainer.selectedIndex, expectedIndex,
- "With "+ tabCount +" tabs open and tab " + indexStart
+ "With " + tabCount + " tabs open and tab " + indexStart
+ " selected, Ctrl+Tab*" + tabTimes + " goes " + where);
}
});
--- a/browser/base/content/test/general/browser_fullscreen-window-open.js
+++ b/browser/base/content/test/general/browser_fullscreen-window-open.js
@@ -212,17 +212,17 @@ function waitForTabOpen(aOptions) {
gBrowser.tabContainer.addEventListener("TabOpen", onTabOpen, true);
let finalize = function () {
aOptions.finalizeFn();
info("Finished: " + message.title);
runNextTest();
};
- const URI = "data:text/html;charset=utf-8,<!DOCTYPE html><html><head><title>"+
+ const URI = "data:text/html;charset=utf-8,<!DOCTYPE html><html><head><title>" +
message.title +
"<%2Ftitle><%2Fhead><body><%2Fbody><%2Fhtml>";
executeWindowOpenInContent({
uri: URI,
title: message.title,
option: message.param,
});
@@ -314,17 +314,17 @@ WindowListener.prototype = {
onOpenWindow: function(aXULWindow) {
Services.wm.removeListener(this);
let domwindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
let onLoad = aEvent => {
is(domwindow.document.location.href, this.test_url,
- "Opened Window is expected: "+ this.test_title);
+ "Opened Window is expected: " + this.test_title);
if (this.callback_onSuccess) {
this.callback_onSuccess();
}
domwindow.removeEventListener("load", onLoad, true);
// wait for trasition to fullscreen on OSX Lion later
if (isOSX) {
--- a/browser/base/content/test/general/browser_gestureSupport.js
+++ b/browser/base/content/test/general/browser_gestureSupport.js
@@ -502,20 +502,20 @@ function test_swipeGestures()
ok(cmdLeft.callCount == 0, "Step 4: Left command was triggered");
ok(cmdRight.callCount == 1, "Step 4: Right command was not triggered");
// Make sure combinations do not trigger events.
let combos = [ up | left, up | right, down | left, down | right];
for (let i = 0; i < combos.length; i++) {
resetCounts();
test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, combos[i], 0, 0);
- ok(cmdUp.callCount == 0, "Step 5-"+i+": Up command was triggered");
- ok(cmdDown.callCount == 0, "Step 5-"+i+": Down command was triggered");
- ok(cmdLeft.callCount == 0, "Step 5-"+i+": Left command was triggered");
- ok(cmdRight.callCount == 0, "Step 5-"+i+": Right command was triggered");
+ ok(cmdUp.callCount == 0, "Step 5-" + i + ": Up command was triggered");
+ ok(cmdDown.callCount == 0, "Step 5-" + i + ": Down command was triggered");
+ ok(cmdLeft.callCount == 0, "Step 5-" + i + ": Left command was triggered");
+ ok(cmdRight.callCount == 0, "Step 5-" + i + ": Right command was triggered");
}
// Remove the test commands.
test_removeCommand(cmdUp);
test_removeCommand(cmdDown);
test_removeCommand(cmdLeft);
test_removeCommand(cmdRight);
}
--- a/browser/base/content/test/general/browser_getshortcutoruri.js
+++ b/browser/base/content/test/general/browser_getshortcutoruri.js
@@ -3,17 +3,17 @@ function getPostDataString(aIS) {
return null;
var sis = Cc["@mozilla.org/scriptableinputstream;1"].
createInstance(Ci.nsIScriptableInputStream);
sis.init(aIS);
var dataLines = sis.read(aIS.available()).split("\n");
// only want the last line
- return dataLines[dataLines.length-1];
+ return dataLines[dataLines.length - 1];
}
function keywordResult(aURL, aPostData, aIsUnsafe) {
this.url = aURL;
this.postData = aPostData;
this.isUnsafe = aIsUnsafe;
}
--- a/browser/base/content/test/general/browser_newTabDrop.js
+++ b/browser/base/content/test/general/browser_newTabDrop.js
@@ -48,21 +48,21 @@ add_task(function*() {
// Single item with multiple types.
add_task(function*() {
yield drop([[{type: "text/plain",
data: "mochi.test/10"},
{type: "text/x-moz-url",
data: "mochi.test/11\nTITLE11"}]], 1);
});
-function dropText(text, expectedTabOpenCount=0) {
+function dropText(text, expectedTabOpenCount = 0) {
return drop([[{type: "text/plain", data: text}]], expectedTabOpenCount);
}
-function* drop(dragData, expectedTabOpenCount=0) {
+function* drop(dragData, expectedTabOpenCount = 0) {
let dragDataString = JSON.stringify(dragData);
info(`Starting test for datagData:${dragDataString}; expectedTabOpenCount:${expectedTabOpenCount}`);
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let EventUtils = {};
scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
// Since synthesizeDrop triggers the srcElement, need to use another button.
--- a/browser/base/content/test/general/browser_newWindowDrop.js
+++ b/browser/base/content/test/general/browser_newWindowDrop.js
@@ -61,21 +61,21 @@ add_task(function*() {
// Single item with multiple types.
add_task(function*() {
yield drop([[{type: "text/plain",
data: "mochi.test/10"},
{type: "text/x-moz-url",
data: "mochi.test/11\nTITLE11"}]], 1);
});
-function dropText(text, expectedWindowOpenCount=0) {
+function dropText(text, expectedWindowOpenCount = 0) {
return drop([[{type: "text/plain", data: text}]], expectedWindowOpenCount);
}
-function* drop(dragData, expectedWindowOpenCount=0) {
+function* drop(dragData, expectedWindowOpenCount = 0) {
let dragDataString = JSON.stringify(dragData);
info(`Starting test for datagData:${dragDataString}; expectedWindowOpenCount:${expectedWindowOpenCount}`);
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let EventUtils = {};
scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
// Since synthesizeDrop triggers the srcElement, need to use another button.
--- a/browser/base/content/test/general/browser_sanitize-timespans.js
+++ b/browser/base/content/test/general/browser_sanitize-timespans.js
@@ -94,17 +94,17 @@ function* onHistoryReady() {
itemPrefs.setBoolPref("sessions", false);
itemPrefs.setBoolPref("siteSettings", false);
let publicList = yield Downloads.getList(Downloads.PUBLIC);
let downloadPromise = promiseDownloadRemoved(publicList);
let formHistoryPromise = promiseFormHistoryRemoved();
// Clear 10 minutes ago
- s.range = [now_uSec - 10*60*1000000, now_uSec];
+ s.range = [now_uSec - 10 * 60 * 1000000, now_uSec];
yield s.sanitize();
s.range = null;
yield formHistoryPromise;
yield downloadPromise;
ok(!(yield promiseIsURIVisited(makeURI("http://10minutes.com"))),
"Pretend visit to 10minutes.com should now be deleted");
@@ -202,17 +202,17 @@ function* onHistoryReady() {
if (hoursSinceMidnight > 1)
ok((yield downloadExists(publicList, "fakefile-today")), "'Today' download should still be present");
downloadPromise = promiseDownloadRemoved(publicList);
formHistoryPromise = promiseFormHistoryRemoved();
// Clear 1 hour 10 minutes
- s.range = [now_uSec - 70*60*1000000, now_uSec];
+ s.range = [now_uSec - 70 * 60 * 1000000, now_uSec];
yield s.sanitize();
s.range = null;
yield formHistoryPromise;
yield downloadPromise;
ok(!(yield promiseIsURIVisited(makeURI("http://1hour10minutes.com"))),
"Pretend visit to 1hour10minutes.com should now be deleted");
@@ -289,17 +289,17 @@ function* onHistoryReady() {
ok((yield downloadExists(publicList, "fakefile-4-hour-10-minutes")), "4 hour 10 minute download should still be present");
if (hoursSinceMidnight > 2)
ok((yield downloadExists(publicList, "fakefile-today")), "'Today' download should still be present");
downloadPromise = promiseDownloadRemoved(publicList);
formHistoryPromise = promiseFormHistoryRemoved();
// Clear 2 hours 10 minutes
- s.range = [now_uSec - 130*60*1000000, now_uSec];
+ s.range = [now_uSec - 130 * 60 * 1000000, now_uSec];
yield s.sanitize();
s.range = null;
yield formHistoryPromise;
yield downloadPromise;
ok(!(yield promiseIsURIVisited(makeURI("http://2hour10minutes.com"))),
"Pretend visit to 2hour10minutes.com should now be deleted");
@@ -360,17 +360,17 @@ function* onHistoryReady() {
ok((yield downloadExists(publicList, "fakefile-old")), "Year old download should still be present");
if (hoursSinceMidnight > 4)
ok((yield downloadExists(publicList, "fakefile-today")), "'Today' download should still be present");
downloadPromise = promiseDownloadRemoved(publicList);
formHistoryPromise = promiseFormHistoryRemoved();
// Clear 4 hours 10 minutes
- s.range = [now_uSec - 250*60*1000000, now_uSec];
+ s.range = [now_uSec - 250 * 60 * 1000000, now_uSec];
yield s.sanitize();
s.range = null;
yield formHistoryPromise;
yield downloadPromise;
ok(!(yield promiseIsURIVisited(makeURI("http://4hour10minutes.com"))),
"Pretend visit to 4hour10minutes.com should now be deleted");
--- a/browser/base/content/test/general/browser_tabDrop.js
+++ b/browser/base/content/test/general/browser_tabDrop.js
@@ -48,21 +48,21 @@ add_task(function*() {
// Single item with multiple types.
add_task(function*() {
yield drop([[{type: "text/plain",
data: "mochi.test/10"},
{type: "text/x-moz-url",
data: "mochi.test/11\nTITLE11"}]], 1);
});
-function dropText(text, expectedTabOpenCount=0) {
+function dropText(text, expectedTabOpenCount = 0) {
return drop([[{type: "text/plain", data: text}]], expectedTabOpenCount);
}
-function* drop(dragData, expectedTabOpenCount=0) {
+function* drop(dragData, expectedTabOpenCount = 0) {
let dragDataString = JSON.stringify(dragData);
info(`Starting test for datagData:${dragDataString}; expectedTabOpenCount:${expectedTabOpenCount}`);
let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
getService(Ci.mozIJSSubScriptLoader);
let EventUtils = {};
scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
let awaitDrop = BrowserTestUtils.waitForEvent(gBrowser.tabContainer, "drop");
--- a/browser/base/content/test/general/browser_tab_dragdrop.js
+++ b/browser/base/content/test/general/browser_tab_dragdrop.js
@@ -112,17 +112,17 @@ add_task(function*() {
gBrowser.addTab("about:blank", {skipAnimation: true}),
gBrowser.addTab("about:blank", {skipAnimation: true})
];
// Initially 0 1 2 3 4
yield loadURI(tabs[1], "data:text/html;charset=utf-8,<title>tab1</title><body>tab1<iframe>");
yield loadURI(tabs[2], "data:text/plain;charset=utf-8,tab2");
yield loadURI(tabs[3], "data:text/html;charset=utf-8,<title>tab3</title><body>tab3<iframe>");
- yield loadURI(tabs[4], "data:text/html;charset=utf-8,<body onload='clicks=0' onclick='++clicks'>"+embed);
+ yield loadURI(tabs[4], "data:text/html;charset=utf-8,<body onload='clicks=0' onclick='++clicks'>" + embed);
yield BrowserTestUtils.switchTab(gBrowser, tabs[3]);
swapTabsAndCloseOther(2, 3); // now: 0 1 2 4
is(gBrowser.tabs[1], tabs[1], "tab1");
is(gBrowser.tabs[2], tabs[3], "tab3");
is(gBrowser.tabs[3], tabs[4], "tab4");
delete tabs[2];
--- a/browser/base/content/test/general/browser_trackingUI_telemetry.js
+++ b/browser/base/content/test/general/browser_trackingUI_telemetry.js
@@ -132,14 +132,14 @@ add_task(function* testPrivateBrowsing()
let tabReloadPromise = promiseTabLoadEvent(tab);
privateWin.document.querySelector("#tracking-action-unblock").doCommand();
yield tabReloadPromise;
tabReloadPromise = promiseTabLoadEvent(tab);
privateWin.document.querySelector("#tracking-action-block").doCommand();
yield tabReloadPromise;
// Sum up all the counts to make sure that nothing got logged
- is(getEnabledCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
- is(getEventCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
- is(getShieldCounts().reduce((p, c) => p+c), 0, "Telemetry logging off in PB mode");
+ is(getEnabledCounts().reduce((p, c) => p + c), 0, "Telemetry logging off in PB mode");
+ is(getEventCounts().reduce((p, c) => p + c), 0, "Telemetry logging off in PB mode");
+ is(getShieldCounts().reduce((p, c) => p + c), 0, "Telemetry logging off in PB mode");
yield promiseWindowClosed(privateWin);
});
--- a/browser/base/content/test/general/contextmenu_common.js
+++ b/browser/base/content/test/general/contextmenu_common.js
@@ -131,49 +131,49 @@ function getVisibleMenuItems(aMenu, aDat
function checkContextMenu(expectedItems) {
is(contextMenu.state, "open", "checking if popup is open");
var data = { generatedSubmenuId: 1 };
checkMenu(contextMenu, expectedItems, data);
}
function checkMenuItem(actualItem, actualEnabled, expectedItem, expectedEnabled, index) {
is(actualItem, expectedItem,
- "checking item #" + index/2 + " (" + expectedItem + ") name");
+ "checking item #" + index / 2 + " (" + expectedItem + ") name");
if (typeof expectedEnabled == "object" && expectedEnabled != null ||
typeof actualEnabled == "object" && actualEnabled != null) {
ok(!(actualEnabled == null), "actualEnabled is not null");
ok(!(expectedEnabled == null), "expectedEnabled is not null");
is(typeof actualEnabled, typeof expectedEnabled, "checking types");
if (typeof actualEnabled != typeof expectedEnabled ||
actualEnabled == null || expectedEnabled == null)
return;
is(actualEnabled.type, expectedEnabled.type,
- "checking item #" + index/2 + " (" + expectedItem + ") type attr value");
+ "checking item #" + index / 2 + " (" + expectedItem + ") type attr value");
var icon = actualEnabled.icon;
if (icon) {
var tmp = "";
var j = icon.length - 1;
while (j && icon[j] != "/") {
tmp = icon[j--] + tmp;
}
icon = tmp;
}
is(icon, expectedEnabled.icon,
- "checking item #" + index/2 + " (" + expectedItem + ") icon attr value");
+ "checking item #" + index / 2 + " (" + expectedItem + ") icon attr value");
is(actualEnabled.checked, expectedEnabled.checked,
- "checking item #" + index/2 + " (" + expectedItem + ") has checked attr");
+ "checking item #" + index / 2 + " (" + expectedItem + ") has checked attr");
is(actualEnabled.disabled, expectedEnabled.disabled,
- "checking item #" + index/2 + " (" + expectedItem + ") has disabled attr");
+ "checking item #" + index / 2 + " (" + expectedItem + ") has disabled attr");
} else if (expectedEnabled != null)
is(actualEnabled, expectedEnabled,
- "checking item #" + index/2 + " (" + expectedItem + ") enabled state");
+ "checking item #" + index / 2 + " (" + expectedItem + ") enabled state");
}
/*
* checkMenu - checks to see if the specified <menupopup> contains the
* expected items and state.
* expectedItems is a array of (1) item IDs and (2) a boolean specifying if
* the item is enabled or not (or null to ignore it). Submenus can be checked
* by providing a nested array entry after the expected <menu> ID.
@@ -182,17 +182,17 @@ function checkMenuItem(actualItem, actua
* ["sub1", true, // submenu contents
* "sub2", false], null, // submenu contents
* "lol", false] // item disabled
*
*/
function checkMenu(menu, expectedItems, data) {
var actualItems = getVisibleMenuItems(menu, data);
// ok(false, "Items are: " + actualItems);
- for (var i = 0; i < expectedItems.length; i+=2) {
+ for (var i = 0; i < expectedItems.length; i += 2) {
var actualItem = actualItems[i];
var actualEnabled = actualItems[i + 1];
var expectedItem = expectedItems[i];
var expectedEnabled = expectedItems[i + 1];
if (expectedItem instanceof Array) {
ok(true, "Checking submenu/menugroup...");
var previousId = expectedItems[i - 2]; // The last item was the menu ID.
var previousItem = menu.getElementsByAttribute("id", previousId)[0];
@@ -200,17 +200,17 @@ function checkMenu(menu, expectedItems,
if (previousItem && previousItem.nodeName == "menu") {
ok(previousItem, "got a submenu element of id='" + previousId + "'");
is(previousItem.nodeName, "menu", "submenu element of id='" + previousId +
"' has expected nodeName");
checkMenu(previousItem.menupopup, expectedItem, data, i);
} else if (previousItem && previousItem.nodeName == "menugroup") {
ok(expectedItem.length, "menugroup must not be empty");
for (var j = 0; j < expectedItem.length / 2; j++) {
- checkMenuItem(actualItems[i][j][0], actualItems[i][j][1], expectedItem[j*2], expectedItem[j*2+1], i+j*2);
+ checkMenuItem(actualItems[i][j][0], actualItems[i][j][1], expectedItem[j * 2], expectedItem[j * 2 + 1], i + j * 2);
}
i += j;
} else {
ok(false, "previous item is not a menu or menugroup");
}
} else {
checkMenuItem(actualItem, actualEnabled, expectedItem, expectedEnabled, i);
}
@@ -242,17 +242,17 @@ let lastElementSelector = null;
* to true if offsetX and offsetY are not provided
* waitForSpellCheck: wait until spellcheck is initialized before
* starting test
* preCheckContextMenuFn: callback to run before opening menu
* onContextMenuShown: callback to run when the context menu is shown
* postCheckContextMenuFn: callback to run after opening menu
* @return {Promise} resolved after the test finishes
*/
-function* test_contextmenu(selector, menuItems, options={}) {
+function* test_contextmenu(selector, menuItems, options = {}) {
contextMenu = document.getElementById("contentAreaContextMenu");
is(contextMenu.state, "closed", "checking if popup is closed");
// Default to centered if no positioning is defined.
if (!options.offsetX && !options.offsetY) {
options.centered = true;
}
--- a/browser/base/content/test/general/file_bug822367_1.js
+++ b/browser/base/content/test/general/file_bug822367_1.js
@@ -1,1 +1,1 @@
-document.getElementById('p1').innerHTML="hello";
+document.getElementById('p1').innerHTML = "hello";
--- a/browser/base/content/test/general/file_bug822367_5.html
+++ b/browser/base/content/test/general/file_bug822367_5.html
@@ -5,17 +5,17 @@ Test 5 for Mixed Content Blocker User Ov
https://bugzilla.mozilla.org/show_bug.cgi?id=822367
-->
<head>
<meta charset="utf-8">
<title>Test 5 for Bug 822367</title>
<script>
function createDoc()
{
- var doc=document.open("text/html", "replace");
+ var doc = document.open("text/html", "replace");
doc.write('<!DOCTYPE html><html><body><p id="p1">This is some content</p><script src="http://example.com/browser/browser/base/content/test/general/file_bug822367_1.js">\<\/script\>\<\/body>\<\/html>');
doc.close();
}
</script>
</head>
<body>
<div id="testContent">
<img src="https://example.com/tests/image/test/mochitest/blue.png" onload="createDoc()">
--- a/browser/base/content/test/general/head.js
+++ b/browser/base/content/test/general/head.js
@@ -253,17 +253,17 @@ function promiseWindowWillBeClosed(win)
}
function promiseWindowClosed(win) {
let promise = promiseWindowWillBeClosed(win);
win.close();
return promise;
}
-function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup=false) {
+function promiseOpenAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
let deferred = Promise.defer();
let win = OpenBrowserWindow(aOptions);
if (aWaitForDelayedStartup) {
Services.obs.addObserver(function onDS(aSubject, aTopic, aData) {
if (aSubject != win) {
return;
}
Services.obs.removeObserver(onDS, "browser-delayed-startup-finished");
@@ -394,17 +394,17 @@ function promiseHistoryClearedState(aURI
* Whether to cancel the load directly from the progress listener. Defaults to true.
* If you're using this method to avoid hitting the network, you want the default (true).
* However, the browser UI will behave differently for loads stopped directly from
* the progress listener (effectively in the middle of a call to loadURI) and so there
* are cases where you may want to avoid stopping the load directly from within the
* progress listener callback.
* @return promise
*/
-function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser, aStopFromProgressListener=true) {
+function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) {
function content_script(contentStopFromProgressListener) {
let { interfaces: Ci, utils: Cu } = Components;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let wp = docShell.QueryInterface(Ci.nsIWebProgress);
function stopContent(now, uri) {
if (now) {
/* Hammer time. */
@@ -462,17 +462,17 @@ function waitForDocLoadAndStopIt(aExpect
}
/**
* Waits for the next load to complete in any browser or the given browser.
* If a <tabbrowser> is given it waits for a load in any of its browsers.
*
* @return promise
*/
-function waitForDocLoadComplete(aBrowser=gBrowser) {
+function waitForDocLoadComplete(aBrowser = gBrowser) {
return new Promise(resolve => {
let listener = {
onStateChange: function (webProgress, req, flags, status) {
let docStop = Ci.nsIWebProgressListener.STATE_IS_NETWORK |
Ci.nsIWebProgressListener.STATE_STOP;
info("Saw state " + flags.toString(16) + " and status " + status.toString(16));
// When a load needs to be retargetted to a new process it is cancelled
@@ -1034,17 +1034,17 @@ function getPropertyBagValue(bag, key) {
* in the crash report.
*
* Note that this will ignore any keys that are not included
* in expectedExtra. It's possible that the crash report
* will contain other extra information that is not
* compared against.
* @returns Promise
*/
-function promiseCrashReport(expectedExtra={}) {
+function promiseCrashReport(expectedExtra = {}) {
return Task.spawn(function*() {
info("Starting wait on crash-report-status");
let [subject, ] =
yield TestUtils.topicObserved("crash-report-status", (unused, data) => {
return data == "success";
});
info("Topic observed!");
--- a/browser/base/content/test/newtab/head.js
+++ b/browser/base/content/test/newtab/head.js
@@ -272,17 +272,17 @@ function restore() {
whenPagesUpdated().then(resolve);
NewTabUtils.restore();
});
}
/**
* Wait until a given condition becomes true.
*/
-function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) {
+function waitForCondition(aConditionFn, aMaxTries = 50, aCheckInterval = 100) {
return new Promise((resolve, reject) => {
let tries = 0;
function tryNow() {
tries++;
if (aConditionFn()) {
resolve();
--- a/browser/base/content/test/plugins/browser_clearplugindata.js
+++ b/browser/base/content/test/plugins/browser_clearplugindata.js
@@ -78,17 +78,17 @@ add_task(function* () {
yield promiseUpdatePluginBindings(gTestBrowser);
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
"Data stored for sites");
// Clear 20 seconds ago
let now_uSec = Date.now() * 1000;
- sanitizer.range = [now_uSec - 20*1000000, now_uSec];
+ sanitizer.range = [now_uSec - 20 * 1000000, now_uSec];
yield sanitizer.sanitize();
ok(stored(["bar.com", "qux.com"]), "Data stored for sites");
ok(!stored(["foo.com"]), "Data cleared for foo.com");
ok(!stored(["baz.com"]), "Data cleared for baz.com");
// Clear everything
sanitizer.range = null;
@@ -111,17 +111,17 @@ add_task(function* () {
ok(stored(["foo.com", "bar.com", "baz.com", "qux.com"]),
"Data stored for sites");
// Attempt to clear 20 seconds ago. The plugin will throw
// NS_ERROR_PLUGIN_TIME_RANGE_NOT_SUPPORTED, which should result in us
// clearing all data regardless of age.
let now_uSec = Date.now() * 1000;
- sanitizer.range = [now_uSec - 20*1000000, now_uSec];
+ sanitizer.range = [now_uSec - 20 * 1000000, now_uSec];
yield sanitizer.sanitize();
ok(!stored(null), "All data cleared");
gBrowser.removeCurrentTab();
gTestBrowser = null;
});
--- a/browser/base/content/test/plugins/browser_private_clicktoplay.js
+++ b/browser/base/content/test/plugins/browser_private_clicktoplay.js
@@ -203,14 +203,14 @@ add_task(function* test3d() {
ok(allownow.hidden, "Test 3d, Plugin set to 'always allow' should have an invisible 'allow now' action.");
ok(block.hidden, "Test 3d, Plugin set to 'always allow' should have an invisible 'block' action.");
} else if (item.action.pluginName === "Second Test") {
is(item.value, "block", "Test 3d, Second plugin should bet set to 'block'");
ok(allowalways.hidden, "Test 3d, Plugin set to 'block' should have a visible 'always allow' action.");
ok(!allownow.hidden, "Test 3d, Plugin set to 'block' should have a visible 'allow now' action.");
ok(!block.hidden, "Test 3d, Plugin set to 'block' should have a visible 'block' action.");
} else {
- ok(false, "Test 3d, Unexpected plugin '"+item.action.pluginName+"'");
+ ok(false, "Test 3d, Unexpected plugin '" + item.action.pluginName + "'");
}
}
finishTest();
});
--- a/browser/base/content/test/plugins/plugin_add_dynamically.html
+++ b/browser/base/content/test/plugins/plugin_add_dynamically.html
@@ -1,16 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
-function addPlugin(aId, aType="application/x-test") {
+function addPlugin(aId, aType = "application/x-test") {
var embed = document.createElement("embed");
embed.setAttribute("id", aId);
embed.style.width = "200px";
embed.style.height = "200px";
embed.setAttribute("type", aType);
return document.body.appendChild(embed);
}
</script>
--- a/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
+++ b/browser/base/content/test/popupNotifications/browser_popupNotification_checkbox.js
@@ -7,23 +7,23 @@ function test() {
ok(PopupNotifications, "PopupNotifications object exists");
ok(PopupNotifications.panel, "PopupNotifications panel exists");
setup();
goNext();
}
-function checkCheckbox(checkbox, label, checked=false, hidden=false) {
+function checkCheckbox(checkbox, label, checked = false, hidden = false) {
is(checkbox.label, label, "Checkbox should have the correct label");
is(checkbox.hidden, hidden, "Checkbox should be shown");
is(checkbox.checked, checked, "Checkbox should be checked by default");
}
-function checkMainAction(notification, disabled=false) {
+function checkMainAction(notification, disabled = false) {
let mainAction = notification.button;
let warningLabel = document.getAnonymousElementByAttribute(notification, "class", "popup-notification-warning");
is(warningLabel.hidden, !disabled, "Warning label should be shown");
is(mainAction.disabled, disabled, "MainAction should be disabled");
}
function promiseElementVisible(element) {
// HTMLElement.offsetParent is null when the element is not visisble
--- a/browser/base/content/test/social/browser_aboutHome_activation.js
+++ b/browser/base/content/test/social/browser_aboutHome_activation.js
@@ -125,17 +125,17 @@ function test()
* @param aTab
* The tab to load into.
* @param aUrl
* The url to load.
* @param aEvent
* The load event type to wait for. Defaults to "load".
* @return {Promise} resolved when the event is handled.
*/
-function promiseTabLoadEvent(aTab, aURL, aEventType="load")
+function promiseTabLoadEvent(aTab, aURL, aEventType = "load")
{
return new Promise(resolve => {
info("Wait tab event: " + aEventType);
aTab.linkedBrowser.addEventListener(aEventType, function load(event) {
if (event.originalTarget != aTab.linkedBrowser.contentDocument ||
event.target.location.href == "about:blank") {
info("skipping spurious load event");
return;
--- a/browser/base/content/test/social/browser_addons.js
+++ b/browser/base/content/test/social/browser_addons.js
@@ -86,17 +86,17 @@ function installListener(next, aManifest
}
var tests = {
testHTTPInstallFailure: function(next) {
let installFrom = "http://example.com";
is(SocialService.getOriginActivationType(installFrom), "foreign", "testing foriegn install");
let data = {
origin: installFrom,
- url: installFrom+"/activate",
+ url: installFrom + "/activate",
manifest: manifest,
window: window
}
Social.installProvider(data, function(addonManifest) {
ok(!addonManifest, "unable to install provider over http");
next();
});
},
--- a/browser/base/content/test/social/browser_share.js
+++ b/browser/base/content/test/social/browser_share.js
@@ -59,17 +59,17 @@ function test() {
shareButton.remove();
}
next();
});
}
var corpus = [
{
- url: baseURL+"opengraph/opengraph.html",
+ url: baseURL + "opengraph/opengraph.html",
options: {
// og:title
title: ">This is my title<",
// og:description
description: "A test corpus file for open graph tags we care about",
// medium: this.getPageMedium(),
// source: this.getSourceURL(),
// og:url
@@ -78,63 +78,63 @@ var corpus = [
// og:image
previews:["https://www.mozilla.org/favicon.png"],
// og:site_name
siteName: ">My simple test page<"
}
},
{
// tests that og:url doesn't override the page url if it is bad
- url: baseURL+"opengraph/og_invalid_url.html",
+ url: baseURL + "opengraph/og_invalid_url.html",
options: {
description: "A test corpus file for open graph tags passing a bad url",
- url: baseURL+"opengraph/og_invalid_url.html",
+ url: baseURL + "opengraph/og_invalid_url.html",
previews: [],
siteName: "Evil chrome delivering website"
}
},
{
- url: baseURL+"opengraph/shorturl_link.html",
+ url: baseURL + "opengraph/shorturl_link.html",
options: {
previews: ["http://example.com/1234/56789.jpg"],
url: "http://www.example.com/photos/56789/",
shortUrl: "http://imshort/p/abcde"
}
},
{
- url: baseURL+"opengraph/shorturl_linkrel.html",
+ url: baseURL + "opengraph/shorturl_linkrel.html",
options: {
previews: ["http://example.com/1234/56789.jpg"],
url: "http://www.example.com/photos/56789/",
shortUrl: "http://imshort/p/abcde"
}
},
{
- url: baseURL+"opengraph/shortlink_linkrel.html",
+ url: baseURL + "opengraph/shortlink_linkrel.html",
options: {
previews: ["http://example.com/1234/56789.jpg"],
url: "http://www.example.com/photos/56789/",
shortUrl: "http://imshort/p/abcde"
}
}
];
function hasoptions(testOptions, options) {
for (let option in testOptions) {
let data = testOptions[option];
- info("data: "+JSON.stringify(data));
+ info("data: " + JSON.stringify(data));
let message_data = options[option];
- info("message_data: "+JSON.stringify(message_data));
+ 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);
+ is(message_data, data, "option " + option);
}
}
}
var tests = {
testShareDisabledOnActivation: function(next) {
// starting on about:blank page, share should be visible but disabled when
// adding provider
--- a/browser/base/content/test/social/browser_social_activation.js
+++ b/browser/base/content/test/social/browser_social_activation.js
@@ -51,24 +51,24 @@ function newTab(url) {
function sendActivationEvent(tab, callback, nullManifest) {
// hack Social.lastEventReceived so we don't hit the "too many events" check.
Social.lastEventReceived = 0;
BrowserTestUtils.synthesizeMouseAtCenter("#activation", {}, tab.linkedBrowser);
executeSoon(callback);
}
function activateProvider(domain, callback, nullManifest) {
- let activationURL = domain+"/browser/browser/base/content/test/social/social_activate_basic.html"
+ let activationURL = domain + "/browser/browser/base/content/test/social/social_activate_basic.html"
newTab(activationURL).then(tab => {
sendActivationEvent(tab, callback, nullManifest);
});
}
function activateIFrameProvider(domain, callback) {
- let activationURL = domain+"/browser/browser/base/content/test/social/social_activate_iframe.html"
+ let activationURL = domain + "/browser/browser/base/content/test/social/social_activate_iframe.html"
newTab(activationURL).then(tab => {
sendActivationEvent(tab, callback, false);
});
}
function waitForProviderLoad(origin) {
return Promise.all([
ensureFrameLoaded(gBrowser, origin + "/browser/browser/base/content/test/social/social_postActivation.html"),
@@ -106,17 +106,17 @@ function clickAddonRemoveButton(tab, aCa
executeSoon(function() { aCallback(addon); });
});
BrowserTestUtils.synthesizeMouseAtCenter(button, {}, tab.linkedBrowser);
});
}
function activateOneProvider(manifest, finishActivation, aCallback) {
- info("activating provider "+manifest.name);
+ info("activating provider " + manifest.name);
let panel = document.getElementById("servicesInstall-notification");
BrowserTestUtils.waitForEvent(PopupNotifications.panel, "popupshown").then(() => {
ok(!panel.hidden, "servicesInstall-notification panel opened");
if (finishActivation)
panel.button.click();
else
panel.closebutton.click();
});
--- a/browser/base/content/test/social/head.js
+++ b/browser/base/content/test/social/head.js
@@ -8,17 +8,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
"resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "PlacesUtils",
"resource://gre/modules/PlacesUtils.jsm");
function promiseObserverNotified(aTopic) {
return new Promise(resolve => {
Services.obs.addObserver(function onNotification(aSubject, aTopic, aData) {
- dump("notification promised "+aTopic);
+ dump("notification promised " + aTopic);
Services.obs.removeObserver(onNotification, aTopic);
TestUtils.executeSoon(() => resolve({subject: aSubject, data: aData}));
}, aTopic, false);
});
}
// Check that a specified (string) URL hasn't been "remembered" (ie, is not
// in history, will not appear in about:newtab or auto-complete, etc.)
@@ -175,17 +175,17 @@ function runSocialTests(tests, cbPreTest
cbPostTest(runNextTest);
}
cbPreTest(function() {
info("pre-test: starting with " + Social.providers.length + " providers");
info("sub-test " + name + " starting");
try {
func.call(tests, cleanupAndRunNextTest);
} catch (ex) {
- ok(false, "sub-test " + name + " failed: " + ex.toString() +"\n"+ex.stack);
+ ok(false, "sub-test " + name + " failed: " + ex.toString() + "\n" + ex.stack);
cleanupAndRunNextTest();
}
})
});
}
runNextTest();
}
--- a/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
+++ b/browser/base/content/test/urlbar/browser_urlbarAutoFillTrimURLs.js
@@ -18,17 +18,17 @@ add_task(function* setup() {
yield PlacesTestUtils.addVisits({
uri: "http://www.autofilltrimurl.com/whatever",
transition: Ci.nsINavHistoryService.TRANSITION_TYPED,
});
});
function* promiseSearch(searchtext) {
gURLBar.focus();
- gURLBar.inputField.value = searchtext.substr(0, searchtext.length -1);
+ gURLBar.inputField.value = searchtext.substr(0, searchtext.length - 1);
EventUtils.synthesizeKey(searchtext.substr(-1, 1), {});
yield promiseSearchComplete();
}
add_task(function* () {
yield promiseSearch("http://");
is(gURLBar.inputField.value, "http://", "Autofilled value is as expected");
});
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSingleWordNotification.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSingleWordNotification.js
@@ -31,17 +31,17 @@ function promiseNotification(aBrowser, v
is(notificationBox.getNotificationWithValue(value), null,
`We are expecting to not get a notification for ${input}`);
deferred.resolve();
}, 1000);
}
return deferred.promise;
}
-function* runURLBarSearchTest({valueToOpen, expectSearch, expectNotification, aWindow=window}) {
+function* runURLBarSearchTest({valueToOpen, expectSearch, expectNotification, aWindow = window}) {
aWindow.gURLBar.value = valueToOpen;
let expectedURI;
if (!expectSearch) {
expectedURI = "http://" + valueToOpen + "/";
} else {
yield new Promise(resolve => {
Services.search.init(resolve);
});
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestionsNotification.js
@@ -231,23 +231,23 @@ function suggestionsPresent() {
if (type == "searchengine" && "searchSuggestion" in params) {
return true;
}
}
}
return false;
}
-function assertVisible(visible, win=window) {
+function assertVisible(visible, win = window) {
let style =
win.getComputedStyle(win.gURLBar.popup.searchSuggestionsNotification);
Assert.equal(style.visibility, visible ? "visible" : "collapse");
}
-function promiseTransition(win=window) {
+function promiseTransition(win = window) {
return new Promise(resolve => {
win.gURLBar.popup.addEventListener("transitionend", function onEnd() {
win.gURLBar.popup.removeEventListener("transitionend", onEnd, true);
// The urlbar needs to handle the transitionend first, but that happens
// naturally since promises are resolved at the end of the current tick.
resolve();
}, true);
});
--- a/browser/base/content/test/urlbar/head.js
+++ b/browser/base/content/test/urlbar/head.js
@@ -22,17 +22,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
* Whether to cancel the load directly from the progress listener. Defaults to true.
* If you're using this method to avoid hitting the network, you want the default (true).
* However, the browser UI will behave differently for loads stopped directly from
* the progress listener (effectively in the middle of a call to loadURI) and so there
* are cases where you may want to avoid stopping the load directly from within the
* progress listener callback.
* @return promise
*/
-function waitForDocLoadAndStopIt(aExpectedURL, aBrowser=gBrowser.selectedBrowser, aStopFromProgressListener=true) {
+function waitForDocLoadAndStopIt(aExpectedURL, aBrowser = gBrowser.selectedBrowser, aStopFromProgressListener = true) {
function content_script(aStopFromProgressListener) {
let { interfaces: Ci, utils: Cu } = Components;
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
let wp = docShell.QueryInterface(Ci.nsIWebProgress);
function stopContent(now, uri) {
if (now) {
/* Hammer time. */
--- a/browser/components/contextualidentity/test/browser/browser_aboutURLs.js
+++ b/browser/components/contextualidentity/test/browser/browser_aboutURLs.js
@@ -20,30 +20,30 @@ add_task(function* () {
if (!result) {
continue;
}
let aboutType = result[1];
let contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
try {
let am = Cc[contract].getService(Ci.nsIAboutModule);
- let uri = ios.newURI("about:"+aboutType, null, null);
+ let uri = ios.newURI("about:" + aboutType, null, null);
let flags = am.getURIFlags(uri);
if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT) &&
networkURLs.indexOf(aboutType) == -1) {
aboutURLs.push(aboutType);
}
} catch (e) {
// getService might have thrown if the component doesn't actually
// implement nsIAboutModule
}
}
for (let url of aboutURLs) {
info("Loading about:" + url);
- let tab = gBrowser.addTab("about:"+url, {userContextId: 1});
+ let tab = gBrowser.addTab("about:" + url, {userContextId: 1});
yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
ok(true, "Done loading about:" + url);
yield BrowserTestUtils.removeTab(tab);
}
});
--- a/browser/components/contextualidentity/test/browser/browser_forgetAPI_EME_forgetThisSite.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetAPI_EME_forgetThisSite.js
@@ -186,34 +186,34 @@ add_task(function* setup() {
});
add_task(function* test_EME_forgetThisSite() {
let tabs = [];
let emeSessionIds = [];
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Open our tab in the given user context.
- tabs[userContextId] = yield* openTabInUserContext(TEST_URL+ "empty_file.html", userContextId);
+ tabs[userContextId] = yield* openTabInUserContext(TEST_URL + "empty_file.html", userContextId);
// Setup EME Key.
emeSessionIds[userContextId] = yield setupEMEKey(tabs[userContextId].browser);
// Close this tab.
yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
}
// Clear all EME data for a given domain with originAttributes pattern.
let mps = Cc["@mozilla.org/gecko-media-plugin-service;1"].
getService(Ci.mozIGeckoMediaPluginChromeService);
mps.forgetThisSite(TEST_HOST, JSON.stringify({}));
// Open tabs again to check EME keys have been cleared.
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Open our tab in the given user context.
- tabs[userContextId] = yield* openTabInUserContext(TEST_URL+ "empty_file.html", userContextId);
+ tabs[userContextId] = yield* openTabInUserContext(TEST_URL + "empty_file.html", userContextId);
// Check whether EME Key has been cleared.
yield checkEMEKey(tabs[userContextId].browser, emeSessionIds[userContextId]);
// Close this tab.
yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
}
});
--- a/browser/components/contextualidentity/test/browser/browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetAPI_cookie_getCookiesWithOriginAttributes.js
@@ -49,17 +49,17 @@ add_task(function* test_cookie_getCookie
let cookieName = "userContextId";
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Load the page in 2 different contexts and set a cookie
// which should only be visible in that context.
let value = USER_CONTEXTS[userContextId];
// Open our tab in the given user context.
- tabs[userContextId] = yield* openTabInUserContext(TEST_URL+ "file_reflect_cookie_into_title.html?" + value, userContextId);
+ tabs[userContextId] = yield* openTabInUserContext(TEST_URL + "file_reflect_cookie_into_title.html?" + value, userContextId);
// Close this tab.
yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
}
// Check that cookies have been set properly.
for (let userContextId of Object.keys(USER_CONTEXTS)) {
let enumerator = getCookiesForOA(TEST_HOST, userContextId);
--- a/browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js
@@ -106,17 +106,17 @@ add_task(function* setup() {
]});
});
add_task(function* test_quota_clearStoragesForPrincipal() {
let tabs = [];
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Open our tab in the given user context.
- tabs[userContextId] = yield* openTabInUserContext(TEST_URL+ "empty_file.html", userContextId);
+ tabs[userContextId] = yield* openTabInUserContext(TEST_URL + "empty_file.html", userContextId);
// Setup an entry for the indexedDB.
yield setupIndexedDB(tabs[userContextId].browser);
// Close this tab.
yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
}
@@ -131,17 +131,17 @@ add_task(function* test_quota_clearStora
caUtils);
let httpURI = caUtils.makeURI("http://" + TEST_HOST);
let httpPrincipal = Services.scriptSecurityManager
.createCodebasePrincipal(httpURI, {});
qms.clearStoragesForPrincipal(httpPrincipal, null, true);
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Open our tab in the given user context.
- tabs[userContextId] = yield* openTabInUserContext(TEST_URL+ "empty_file.html", userContextId);
+ tabs[userContextId] = yield* openTabInUserContext(TEST_URL + "empty_file.html", userContextId);
// Check whether indexed DB has been cleared.
yield checkIndexedDB(tabs[userContextId].browser);
// Close this tab.
yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
}
});
--- a/browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
+++ b/browser/components/contextualidentity/test/browser/browser_forgetaboutsite.js
@@ -132,17 +132,17 @@ function* test_cookie_cleared() {
let tabs = [];
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Load the page in 2 different contexts and set a cookie
// which should only be visible in that context.
let value = USER_CONTEXTS[userContextId];
// Open our tab in the given user context.
- tabs[userContextId] = yield* openTabInUserContext(TEST_URL+ "file_reflect_cookie_into_title.html?" + value, userContextId);
+ tabs[userContextId] = yield* openTabInUserContext(TEST_URL + "file_reflect_cookie_into_title.html?" + value, userContextId);
// Close this tab.
yield BrowserTestUtils.removeTab(tabs[userContextId].tab);
}
// Check that cookies have been set properly.
for (let userContextId of Object.keys(USER_CONTEXTS)) {
let enumerator = getCookiesForOA(TEST_HOST, userContextId);
ok(enumerator.hasMoreElements(), "Cookies available");
@@ -237,17 +237,17 @@ function* test_image_cache_cleared() {
// Offline Storage
function* test_storage_cleared() {
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Load the page in 2 different contexts and set the local storage
// which should only be visible in that context.
let value = USER_CONTEXTS[userContextId];
// Open our tab in the given user context.
- let tabInfo = yield* openTabInUserContext(TEST_URL+ "file_set_storages.html?" + value, userContextId);
+ let tabInfo = yield* openTabInUserContext(TEST_URL + "file_set_storages.html?" + value, userContextId);
// Check that the storages has been set correctly.
yield ContentTask.spawn(tabInfo.browser, { userContext: USER_CONTEXTS[userContextId] }, function* (arg) {
// Check that the local storage has been set correctly.
Assert.equal(content.localStorage.getItem("userContext"), arg.userContext, "Check the local storage value");
// Check that the session storage has been set correctly.
Assert.equal(content.sessionStorage.getItem("userContext"), arg.userContext, "Check the session storage value");
@@ -280,17 +280,17 @@ function* test_storage_cleared() {
// Forget the site.
ForgetAboutSite.removeDataFromDomain(TEST_HOST);
// Open the tab again without setting the localStorage and check that the
// local storage has been cleared or not.
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Open our tab in the given user context without setting local storage.
- let tabInfo = yield* openTabInUserContext(TEST_URL+ "file_set_storages.html", userContextId);
+ let tabInfo = yield* openTabInUserContext(TEST_URL + "file_set_storages.html", userContextId);
// Check that do storages be cleared or not.
yield ContentTask.spawn(tabInfo.browser, null, function* () {
// Check that does the local storage be cleared or not.
Assert.ok(!content.localStorage.getItem("userContext"), "The local storage has been cleared");
// Check that does the session storage be cleared or not.
Assert.ok(!content.sessionStorage.getItem("userContext"), "The session storage has been cleared");
--- a/browser/components/contextualidentity/test/browser/browser_usercontext.js
+++ b/browser/components/contextualidentity/test/browser/browser_usercontext.js
@@ -37,30 +37,30 @@ add_task(function* setup() {
add_task(function* test() {
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// load the page in 3 different contexts and set a cookie
// which should only be visible in that context
let cookie = USER_CONTEXTS[userContextId];
// open our tab in the given user context
- let tab = openTabInUserContext(BASE_URI+"?"+cookie, userContextId);
+ let tab = openTabInUserContext(BASE_URI + "?" + cookie, userContextId);
// wait for tab load
yield BrowserTestUtils.browserLoaded(gBrowser.getBrowserForTab(tab));
// remove the tab
gBrowser.removeTab(tab);
}
{
// Set a cookie in a different context so we can detect if that affects
// cross-context properly. If we don't do that, we get an UNEXPECTED-PASS
// for the localStorage case for the last tab we set.
- let tab = openTabInUserContext(BASE_URI+"?foo", 9999);
+ let tab = openTabInUserContext(BASE_URI + "?foo", 9999);
yield BrowserTestUtils.browserLoaded(gBrowser.getBrowserForTab(tab));
gBrowser.removeTab(tab);
}
for (let userContextId of Object.keys(USER_CONTEXTS)) {
// Load the page without setting the cookie this time
let expectedContext = USER_CONTEXTS[userContextId];
--- a/browser/components/customizableui/CustomizableUI.jsm
+++ b/browser/components/customizableui/CustomizableUI.jsm
@@ -2127,17 +2127,17 @@ var CustomizableUIInternal = {
let evt = new aWindow.CustomEvent(aEventType, {
bubbles: true,
cancelable: true,
detail: aDetails
});
aWindow.gNavToolbox.dispatchEvent(evt);
},
- dispatchToolboxEvent: function(aEventType, aDetails={}, aWindow=null) {
+ dispatchToolboxEvent: function(aEventType, aDetails = {}, aWindow = null) {
if (aWindow) {
this._dispatchToolboxEventToWindow(aEventType, aDetails, aWindow);
return;
}
for (let [win, ] of gBuildWindows) {
this._dispatchToolboxEventToWindow(aEventType, aDetails, win);
}
},
@@ -3530,17 +3530,17 @@ this.CustomizableUI = {
* position: 42 // the index in the placements array corresponding to
* // your widget.
* }
*
* OR
*
* null // if the widget is not placed anywhere (ie in the palette)
*/
- getPlacementOfWidget: function(aWidgetId, aOnlyRegistered=true, aDeadAreas=false) {
+ getPlacementOfWidget: function(aWidgetId, aOnlyRegistered = true, aDeadAreas = false) {
return CustomizableUIInternal.getPlacementOfWidget(aWidgetId, aOnlyRegistered, aDeadAreas);
},
/**
* Check if a widget can be removed from the area it's in.
*
* Note that if you're wanting to move the widget somewhere, you should
* generally be checking canWidgetMoveToArea, because that will return
* true if the widget is already in the area where you want to move it (!).
@@ -3701,17 +3701,17 @@ this.CustomizableUI = {
/**
* Notify toolbox(es) of a particular event. If you don't pass aWindow,
* all toolboxes will be notified. For use from Customize Mode only,
* do not use otherwise.
* @param aEvent the name of the event to send.
* @param aDetails optional, the details of the event.
* @param aWindow optional, the window in which to send the event.
*/
- dispatchToolboxEvent: function(aEvent, aDetails={}, aWindow=null) {
+ dispatchToolboxEvent: function(aEvent, aDetails = {}, aWindow = null) {
CustomizableUIInternal.dispatchToolboxEvent(aEvent, aDetails, aWindow);
},
/**
* Check whether an area is overflowable.
*
* @param aAreaId the ID of an area to check for overflowable-ness
* @return true if the area is overflowable, false otherwise.
--- a/browser/components/customizableui/content/panelUI.js
+++ b/browser/components/customizableui/content/panelUI.js
@@ -216,17 +216,17 @@ const PanelUI = {
* by the user.
*
* @param aCustomizing (optional) set to true if this was called while entering
* customization mode. If that's the case, we trust that customization
* mode will handle calling beginBatchUpdate and endBatchUpdate.
*
* @return a Promise that resolves once the panel is ready to roll.
*/
- ensureReady: function(aCustomizing=false) {
+ ensureReady: function(aCustomizing = false) {
if (this._readyPromise) {
return this._readyPromise;
}
this._readyPromise = Task.spawn(function*() {
if (!this._initialized) {
yield new Promise(resolve => {
let delayedStartupObserver = (aSubject, aTopic, aData) => {
if (aSubject == window) {
--- a/browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
+++ b/browser/components/customizableui/test/browser_876926_customize_mode_wrapping.js
@@ -47,17 +47,17 @@ var move = {
function isLast(containerId, defaultPlacements, id) {
assertAreaPlacements(containerId, defaultPlacements.concat([id]));
is(document.getElementById(containerId).customizationTarget.lastChild.firstChild.id, id,
"Widget " + id + " should be in " + containerId + " in customizing window.");
is(otherWin.document.getElementById(containerId).customizationTarget.lastChild.id, id,
"Widget " + id + " should be in " + containerId + " in other window.");
}
-function getLastVisibleNodeInToolbar(containerId, win=window) {
+function getLastVisibleNodeInToolbar(containerId, win = window) {
let container = win.document.getElementById(containerId).customizationTarget;
let rv = container.lastChild;
while (rv && (rv.getAttribute('hidden') == 'true' || (rv.firstChild && rv.firstChild.getAttribute('hidden') == 'true'))) {
rv = rv.previousSibling;
}
return rv;
}
--- a/browser/components/customizableui/test/head.js
+++ b/browser/components/customizableui/test/head.js
@@ -169,34 +169,34 @@ function todoAssertAreaPlacements(areaId
function getAreaWidgetIds(areaId) {
return CustomizableUI.getWidgetIdsInArea(areaId);
}
function simulateItemDrag(aToDrag, aTarget) {
synthesizeDrop(aToDrag.parentNode, aTarget);
}
-function endCustomizing(aWindow=window) {
+function endCustomizing(aWindow = window) {
if (aWindow.document.documentElement.getAttribute("customizing") != "true") {
return true;
}
Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", true);
let deferredEndCustomizing = Promise.defer();
function onCustomizationEnds() {
Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", false);
aWindow.gNavToolbox.removeEventListener("aftercustomization", onCustomizationEnds);
deferredEndCustomizing.resolve();
}
aWindow.gNavToolbox.addEventListener("aftercustomization", onCustomizationEnds);
aWindow.gCustomizeMode.exit();
return deferredEndCustomizing.promise;
}
-function startCustomizing(aWindow=window) {
+function startCustomizing(aWindow = window) {
if (aWindow.document.documentElement.getAttribute("customizing") == "true") {
return null;
}
Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", true);
let deferred = Promise.defer();
function onCustomizing() {
aWindow.gNavToolbox.removeEventListener("customizationready", onCustomizing);
Services.prefs.setBoolPref("browser.uiCustomization.disableAnimation", false);
@@ -211,17 +211,17 @@ function promiseObserverNotified(aTopic)
let deferred = Promise.defer();
Services.obs.addObserver(function onNotification(aSubject, aTopic, aData) {
Services.obs.removeObserver(onNotification, aTopic);
deferred.resolve({subject: aSubject, data: aData});
}, aTopic, false);
return deferred.promise;
}
-function openAndLoadWindow(aOptions, aWaitForDelayedStartup=false) {
+function openAndLoadWindow(aOptions, aWaitForDelayedStartup = false) {
let deferred = Promise.defer();
let win = OpenBrowserWindow(aOptions);
if (aWaitForDelayedStartup) {
Services.obs.addObserver(function onDS(aSubject, aTopic, aData) {
if (aSubject != win) {
return;
}
Services.obs.removeObserver(onDS, "browser-delayed-startup-finished");
@@ -324,17 +324,17 @@ function subviewHidden(aSubview) {
aSubview.removeEventListener("ViewHiding", onViewHiding);
win.clearTimeout(timeoutId);
deferred.resolve();
}
aSubview.addEventListener("ViewHiding", onViewHiding);
return deferred.promise;
}
-function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) {
+function waitForCondition(aConditionFn, aMaxTries = 50, aCheckInterval = 100) {
function tryNow() {
tries++;
if (aConditionFn()) {
deferred.resolve();
} else if (tries < aMaxTries) {
tryAgain();
} else {
deferred.reject("Condition timed out: " + aConditionFn.toSource());
@@ -344,31 +344,31 @@ function waitForCondition(aConditionFn,
setTimeout(tryNow, aCheckInterval);
}
let deferred = Promise.defer();
let tries = 0;
tryAgain();
return deferred.promise;
}
-function waitFor(aTimeout=100) {
+function waitFor(aTimeout = 100) {
let deferred = Promise.defer();
setTimeout(() => deferred.resolve(), aTimeout);
return deferred.promise;
}
/**
* Starts a load in an existing tab and waits for it to finish (via some event).
*
* @param aTab The tab to load into.
* @param aUrl The url to load.
* @param aEventType The load event type to wait for. Defaults to "load".
* @return {Promise} resolved when the event is handled.
*/
-function promiseTabLoadEvent(aTab, aURL, aEventType="load") {
+function promiseTabLoadEvent(aTab, aURL, aEventType = "load") {
let deferred = Promise.defer();
info("Wait for tab event: " + aEventType);
let timeoutId = setTimeout(() => {
aTab.linkedBrowser.removeEventListener(aEventType, onTabLoad, true);
deferred.reject("TabSelect did not happen within " + kTabEventFailureTimeoutInMs + "ms");
}, kTabEventFailureTimeoutInMs);
@@ -484,17 +484,17 @@ function promisePopupEvent(aPopup, aEven
}
aPopup.addEventListener(eventType, onPopupEvent);
return deferred.promise;
}
// This is a simpler version of the context menu check that
// exists in contextmenu_common.js.
-function checkContextMenu(aContextMenu, aExpectedEntries, aWindow=window) {
+function checkContextMenu(aContextMenu, aExpectedEntries, aWindow = window) {
let childNodes = [...aContextMenu.childNodes];
// Ignore hidden nodes:
childNodes = childNodes.filter((n) => !n.hidden);
for (let i = 0; i < childNodes.length; i++) {
let menuitem = childNodes[i];
try {
if (aExpectedEntries[i][0] == "---") {
--- a/browser/components/feeds/FeedConverter.js
+++ b/browser/components/feeds/FeedConverter.js
@@ -337,17 +337,17 @@ FeedConverter.prototype = {
/**
* See nsISupports.idl
*/
QueryInterface(iid) {
if (iid.equals(Ci.nsIFeedResultListener) ||
iid.equals(Ci.nsIStreamConverter) ||
iid.equals(Ci.nsIStreamListener) ||
- iid.equals(Ci.nsIRequestObserver)||
+ iid.equals(Ci.nsIRequestObserver) ||
iid.equals(Ci.nsISupports))
return this;
throw Cr.NS_ERROR_NO_INTERFACE;
},
};
/**
* Keeps parsed FeedResults around for use elsewhere in the UI after the stream
--- a/browser/components/newtab/PlacesProvider.jsm
+++ b/browser/components/newtab/PlacesProvider.jsm
@@ -196,17 +196,17 @@ Links.prototype = {
* aOptions.columns - an array of column names. if supplied the returned
* items will consist of objects keyed on column names. Otherwise
* an array of raw values is returned in the select order
* aOptions.param - an object of SQL binding parameters
* aOptions.callback - a callback to handle query rows
*
* @returns {Promise} Returns a promise with the array of retrieved items
*/
- executePlacesQuery: Task.async(function*(aSql, aOptions={}) {
+ executePlacesQuery: Task.async(function*(aSql, aOptions = {}) {
let {columns, params, callback} = aOptions;
let items = [];
let queryError = null;
let conn = yield PlacesUtils.promiseDBConnection();
yield conn.executeCached(aSql, params, aRow => {
try {
// check if caller wants to handle query raws
if (callback) {
--- a/browser/components/newtab/tests/browser/browser_newtabmessages.js
+++ b/browser/components/newtab/tests/browser/browser_newtabmessages.js
@@ -104,17 +104,17 @@ add_task(function* placesMessages_reques
const TIME_NOW = (new Date()).getTime();
// utility function to compute past timestamp
function timeDaysAgo(numDays) {
return TIME_NOW - (numDays * 24 * 60 * 60 * 1000);
}
// utility function to make a visit for insertion into places db
- function makeVisit(index, daysAgo, isTyped, domain=TEST_URL) {
+ function makeVisit(index, daysAgo, isTyped, domain = TEST_URL) {
let {
TRANSITION_TYPED,
TRANSITION_LINK
} = PlacesUtils.history;
return {
uri: NetUtil.newURI(`${domain}${index}`),
visitDate: timeDaysAgo(daysAgo),
--- a/browser/components/newtab/tests/xpcshell/test_PlacesProvider.js
+++ b/browser/components/newtab/tests/xpcshell/test_PlacesProvider.js
@@ -36,17 +36,17 @@ const TEST_URL = "https://mozilla.com/";
const TIME_NOW = (new Date()).getTime();
// utility function to compute past timestap
function timeDaysAgo(numDays) {
return TIME_NOW - (numDays * 24 * 60 * 60 * 1000);
}
// utility function to make a visit for insetion into places db
-function makeVisit(index, daysAgo, isTyped, domain=TEST_URL) {
+function makeVisit(index, daysAgo, isTyped, domain = TEST_URL) {
let {
TRANSITION_TYPED,
TRANSITION_LINK
} = PlacesUtils.history;
return {
uri: NetUtil.newURI(`${domain}${index}`),
visitDate: timeDaysAgo(daysAgo),
--- a/browser/components/places/PlacesUIUtils.jsm
+++ b/browser/components/places/PlacesUIUtils.jsm
@@ -999,17 +999,17 @@ this.PlacesUIUtils = {
this._openTabset(urlsToOpen, aEvent, window);
}
},
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent, aView) {
let window = aView.ownerWindow;
let urlsToOpen = [];
- for (var i=0; i < aNodes.length; i++) {
+ for (var i = 0; i < aNodes.length; i++) {
// Skip over separators and folders.
if (PlacesUtils.nodeIsURI(aNodes[i]))
urlsToOpen.push({uri: aNodes[i].uri, isBookmark: PlacesUtils.nodeIsBookmark(aNodes[i])});
}
this._openTabset(urlsToOpen, aEvent, window);
},
/**
@@ -1035,17 +1035,17 @@ this.PlacesUIUtils = {
* web panel.
* see also openUILinkIn
*/
openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aView, aPrivate) {
let window = aView.ownerWindow;
this._openNodeIn(aNode, aWhere, window, aPrivate);
},
- _openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aWindow, aPrivate=false) {
+ _openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aWindow, aPrivate = false) {
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
this.checkURLSecurity(aNode, aWindow)) {
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
if (!PrivateBrowsingUtils.isWindowPrivate(aWindow)) {
if (isBookmark)
this.markPageAsFollowedBookmark(aNode.uri);
else
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -1564,17 +1564,17 @@ PlacesToolbar.prototype = {
return;
if (draggedElt.localName == "toolbarbutton" &&
draggedElt.getAttribute("type") == "menu") {
// If the drag gesture on a container is toward down we open instead
// of dragging.
let translateY = this._cachedMouseMoveEvent.clientY - aEvent.clientY;
let translateX = this._cachedMouseMoveEvent.clientX - aEvent.clientX;
- if ((translateY) >= Math.abs(translateX/2)) {
+ if ((translateY) >= Math.abs(translateX / 2)) {
// Don't start the drag.
aEvent.preventDefault();
// Open the menu.
draggedElt.open = true;
return;
}
// If the menu is open, close it.
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -1614,17 +1614,17 @@ var PlacesControllerDragHelper = {
let index = insertionPoint.index;
// Adjust insertion index to prevent reversal of dragged items. When you
// drag multiple elts upward: need to increment index or each successive
// elt will be inserted at the same index, each above the previous.
let dragginUp = insertionPoint.itemId == unwrapped.parent &&
index < PlacesUtils.bookmarks.getItemIndex(unwrapped.id);
if (index != -1 && dragginUp)
- index+= movedCount++;
+ index += movedCount++;
// If dragging over a tag container we should tag the item.
if (insertionPoint.isTag) {
let uri = NetUtil.newURI(unwrapped.uri);
let tagItemId = insertionPoint.itemId;
if (PlacesUIUtils.useAsyncTransactions)
transactions.push(PlacesTransactions.Tag({ uri: uri, tag: tagName }));
else
--- a/browser/components/places/content/moveBookmarks.js
+++ b/browser/components/places/content/moveBookmarks.js
@@ -23,17 +23,17 @@ var gMoveBookmarksDialog = {
},
onOK: function MBD_onOK(aEvent) {
let selectedNode = this.foldersTree.selectedNode;
let selectedFolderId = PlacesUtils.getConcreteItemId(selectedNode);
if (!PlacesUIUtils.useAsyncTransactions) {
let transactions = [];
- for (var i=0; i < this._nodes.length; i++) {
+ for (var i = 0; i < this._nodes.length; i++) {
// Nothing to do if the node is already under the selected folder
if (this._nodes[i].parent.itemId == selectedFolderId)
continue;
let txn = new PlacesMoveItemTransaction(this._nodes[i].itemId,
selectedFolderId,
PlacesUtils.bookmarks.DEFAULT_INDEX);
transactions.push(txn);
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -704,22 +704,22 @@ var PlacesOrganizer = {
var height = bo.height;
var canvas = document.getElementById("itemThumbnail");
var ctx = canvas.getContext('2d');
var notAvailableText = canvas.getAttribute("notavailabletext");
ctx.save();
ctx.fillStyle = "-moz-Dialog";
ctx.fillRect(0, 0, width, height);
- ctx.translate(width/2, height/2);
+ ctx.translate(width / 2, height / 2);
ctx.fillStyle = "GrayText";
ctx.mozTextStyle = "12pt sans serif";
var len = ctx.mozMeasureText(notAvailableText);
- ctx.translate(-len/2, 0);
+ ctx.translate(-len / 2, 0);
ctx.mozDrawText(notAvailableText);
ctx.restore();
},
toggleAdditionalInfoFields: function PO_toggleAdditionalInfoFields() {
var infoBox = document.getElementById("infoBox");
var infoBoxExpander = document.getElementById("infoBoxExpander");
var infoBoxExpanderLabel = document.getElementById("infoBoxExpanderLabel");
--- a/browser/components/places/tests/browser/browser_423515.js
+++ b/browser/components/places/tests/browser/browser_423515.js
@@ -33,17 +33,17 @@ function test() {
});
// add a regular folder shortcut, should be moveable
tests.push({
populate: function() {
this.folderId =
PlacesUtils.bookmarks.createFolder(rootId, "foo", IDX);
this.shortcutId =
- PlacesUtils.bookmarks.insertBookmark(rootId, makeURI("place:folder="+this.folderId), IDX, "bar");
+ PlacesUtils.bookmarks.insertBookmark(rootId, makeURI("place:folder=" + this.folderId), IDX, "bar");
},
validate: function() {
is(rootNode.childCount, 2,
"populated data to the test root");
var folderNode = rootNode.getChild(0);
is(folderNode.type, 6, "node is folder");
is(this.folderId, folderNode.itemId, "folder id and folder node item id match");
--- a/browser/components/places/tests/browser/browser_425884.js
+++ b/browser/components/places/tests/browser/browser_425884.js
@@ -26,19 +26,19 @@ add_task(function* () {
let toolbarNode = PlacesUtils.getFolderContents(toolbarId).root;
let oldCount = toolbarNode.childCount;
let testRoot = yield PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
type: PlacesUtils.bookmarks.TYPE_FOLDER,
title: "test root"
});
- is(toolbarNode.childCount, oldCount+1, "confirm test root node is a container, and is empty");
+ is(toolbarNode.childCount, oldCount + 1, "confirm test root node is a container, and is empty");
- let testRootNode = toolbarNode.getChild(toolbarNode.childCount-1);
+ let testRootNode = toolbarNode.getChild(toolbarNode.childCount - 1);
testRootNode.QueryInterface(Ci.nsINavHistoryContainerResultNode);
testRootNode.containerOpen = true;
is(testRootNode.childCount, 0, "confirm test root node is a container, and is empty");
// create folder A, fill it, validate its contents
let folderA = yield PlacesUtils.bookmarks.insert({
type: PlacesUtils.bookmarks.TYPE_FOLDER,
parentGuid: testRoot.guid,
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_addFolderDefaultButton.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_addFolderDefaultButton.js
@@ -26,17 +26,17 @@ add_task(function* () {
// will be inserted at index 0.
yield withBookmarksDialog(
false,
function openDialog() {
tree.controller.doCommand("placesCmd_new:folder");
},
function* test(dialogWin) {
let promiseTitleChangeNotification = promiseBookmarksNotification(
- "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val =="n");
+ "onItemChanged", (itemId, prop, isAnno, val) => prop == "title" && val == "n");
fillBookmarkTextField("editBMPanel_namePicker", "n", dialogWin, false);
// Confirm and close the dialog.
EventUtils.synthesizeKey("VK_RETURN", {}, dialogWin);
yield promiseTitleChangeNotification;
let newFolder = yield PlacesUtils.bookmarks.fetch({
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_addKeywordForThisSearch.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_addKeywordForThisSearch.js
@@ -10,17 +10,17 @@ add_task(function* () {
// We must wait for the context menu code to build metadata.
yield openContextMenuForContentSelector(browser, 'form > input[name="search"]');
yield withBookmarksDialog(true, AddKeywordForSearchField, function* (dialogWin) {
let acceptBtn = dialogWin.document.documentElement.getButton("accept");
ok(acceptBtn.disabled, "Accept button is disabled");
let promiseKeywordNotification = promiseBookmarksNotification(
- "onItemChanged", (itemId, prop, isAnno, val) => prop == "keyword" && val =="kw");
+ "onItemChanged", (itemId, prop, isAnno, val) => prop == "keyword" && val == "kw");
fillBookmarkTextField("editBMPanel_keywordField", "kw", dialogWin);
ok(!acceptBtn.disabled, "Accept button is enabled");
// The dialog is instant apply.
yield promiseKeywordNotification;
--- a/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
+++ b/browser/components/places/tests/browser/browser_drag_bookmarks_on_toolbar.js
@@ -88,18 +88,18 @@ function synthesizeDragWithDirection(aEl
yIncrement = -1;
break;
case dragDirections.DOWN:
yIncrement = +1;
break;
}
var rect = aElement.getBoundingClientRect();
- var startingPoint = { x: (rect.right - rect.left)/2,
- y: (rect.bottom - rect.top)/2 };
+ var startingPoint = { x: (rect.right - rect.left) / 2,
+ y: (rect.bottom - rect.top) / 2 };
EventUtils.synthesizeMouse(aElement,
startingPoint.x,
startingPoint.y,
{ type: "mousedown" });
EventUtils.synthesizeMouse(aElement,
startingPoint.x + xIncrement * 1,
startingPoint.y + yIncrement * 1,
--- a/browser/components/places/tests/unit/head_bookmarks.js
+++ b/browser/components/places/tests/unit/head_bookmarks.js
@@ -115,17 +115,17 @@ const NUMBER_OF_TRIES = 30;
* The reason to reject the returned promise with.
* @param [optional] tryCount
* Maximum times to try before rejecting the returned promise with
* timeoutMsg, defaults to NUMBER_OF_TRIES.
* @return {Promise}
* @resolves to the asynchronous value being polled.
* @rejects if the asynchronous value is not available after tryCount attempts.
*/
-var waitForResolvedPromise = Task.async(function* (promiseFn, timeoutMsg, tryCount=NUMBER_OF_TRIES) {
+var waitForResolvedPromise = Task.async(function* (promiseFn, timeoutMsg, tryCount = NUMBER_OF_TRIES) {
let tries = 0;
do {
try {
let value = yield promiseFn();
return value;
} catch (ex) {}
yield new Promise(resolve => do_timeout(SINGLE_TRY_TIMEOUT, resolve));
} while (++tries <= tryCount);
--- a/browser/components/preferences/in-content/advanced.js
+++ b/browser/components/preferences/in-content/advanced.js
@@ -645,21 +645,21 @@ var gAdvancedPane = {
updateReadPrefs: function ()
{
if (AppConstants.MOZ_UPDATER) {
var enabledPref = document.getElementById("app.update.enabled");
var autoPref = document.getElementById("app.update.auto");
var radiogroup = document.getElementById("updateRadioGroup");
if (!enabledPref.value) // Don't care for autoPref.value in this case.
- radiogroup.value="manual"; // 3. Never check for updates.
+ radiogroup.value = "manual"; // 3. Never check for updates.
else if (autoPref.value) // enabledPref.value && autoPref.value
- radiogroup.value="auto"; // 1. Automatically install updates
+ radiogroup.value = "auto"; // 1. Automatically install updates
else // enabledPref.value && !autoPref.value
- radiogroup.value="checkOnly"; // 2. Check, but let me choose
+ radiogroup.value = "checkOnly"; // 2. Check, but let me choose
var canCheck = Components.classes["@mozilla.org/updates/update-service;1"].
getService(Components.interfaces.nsIApplicationUpdateService).
canCheckForUpdates;
// canCheck is false if the enabledPref is false and locked,
// or the binary platform or OS version is not known.
// A locked pref is sufficient to disable the radiogroup.
radiogroup.disabled = !canCheck || enabledPref.locked || autoPref.locked;
--- a/browser/components/preferences/in-content/search.js
+++ b/browser/components/preferences/in-content/search.js
@@ -344,17 +344,17 @@ EngineStore.prototype = {
return this._engines.indexOf(aEngine);
},
_getEngineByName: function ES_getEngineByName(aName) {
return this._engines.find(engine => engine.name == aName);
},
_cloneEngine: function ES_cloneEngine(aEngine) {
- var clonedObj={};
+ var clonedObj = {};
for (var i in aEngine)
clonedObj[i] = aEngine[i];
clonedObj.originalEngine = aEngine;
clonedObj.shown = this.hiddenList.indexOf(clonedObj.name) == -1;
return clonedObj;
},
// Callback for Array's some(). A thisObj must be passed to some()
--- a/browser/components/preferences/in-content/tests/browser_bug705422.js
+++ b/browser/components/preferences/in-content/tests/browser_bug705422.js
@@ -13,50 +13,50 @@ function initTest() {
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager);
// delete all cookies (might be left over from other tests)
cm.removeAll();
// data for cookies
- var vals = [[searchTerm+".com", dummyTerm, dummyTerm], // match
- [searchTerm+".org", dummyTerm, dummyTerm], // match
- [dummyTerm+".com", searchTerm, dummyTerm], // match
- [dummyTerm+".edu", searchTerm+dummyTerm, dummyTerm], // match
- [dummyTerm+".net", dummyTerm, searchTerm], // match
- [dummyTerm+".org", dummyTerm, searchTerm+dummyTerm], // match
- [dummyTerm+".int", dummyTerm, dummyTerm]]; // no match
+ var vals = [[searchTerm + ".com", dummyTerm, dummyTerm], // match
+ [searchTerm + ".org", dummyTerm, dummyTerm], // match
+ [dummyTerm + ".com", searchTerm, dummyTerm], // match
+ [dummyTerm + ".edu", searchTerm + dummyTerm, dummyTerm], // match
+ [dummyTerm + ".net", dummyTerm, searchTerm], // match
+ [dummyTerm + ".org", dummyTerm, searchTerm + dummyTerm], // match
+ [dummyTerm + ".int", dummyTerm, dummyTerm]]; // no match
// matches must correspond to above data
const matches = 6;
var ios = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService);
var cookieSvc = Components.classes["@mozilla.org/cookieService;1"]
.getService(Components.interfaces.nsICookieService);
var v;
// inject cookies
for (v in vals) {
let [host, name, value] = vals[v];
- var cookieUri = ios.newURI("http://"+host, null, null);
- cookieSvc.setCookieString(cookieUri, null, name+"="+value+";", null);
+ var cookieUri = ios.newURI("http://" + host, null, null);
+ 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);
}
function isDisabled(win, expectation) {
var disabled = win.document.getElementById("removeAllCookies").disabled;
- is(disabled, expectation, "Remove all cookies button has correct state: "+(expectation?"disabled":"enabled"));
+ is(disabled, expectation, "Remove all cookies button has correct state: " + (expectation ? "disabled" : "enabled"));
}
function runTest(win, searchTerm, cookies, matches) {
var cm = Components.classes["@mozilla.org/cookiemanager;1"]
.getService(Components.interfaces.nsICookieManager);
// number of cookies should match injected cookies
@@ -82,46 +82,46 @@ function runTest(win, searchTerm, cookie
// select first cookie and delete
var tree = win.document.getElementById("cookiesList");
var deleteButton = win.document.getElementById("removeSelectedCookies");
var rect = tree.treeBoxObject.getCoordsForCellItem(0, tree.columns[0], "cell");
EventUtils.synthesizeMouse(tree.body, rect.x + rect.width / 2, rect.y + rect.height / 2, {}, win);
EventUtils.synthesizeMouseAtCenter(deleteButton, {}, win);
// count cookies should be matches-1
- is(win.gCookiesWindow._view.rowCount, matches-1, "Deleted selected cookie");
+ is(win.gCookiesWindow._view.rowCount, matches - 1, "Deleted selected cookie");
// select two adjacent cells and delete
EventUtils.synthesizeMouse(tree.body, rect.x + rect.width / 2, rect.y + rect.height / 2, {}, win);
var eventObj = {};
if (navigator.platform.indexOf("Mac") >= 0)
eventObj.metaKey = true;
else
eventObj.ctrlKey = true;
rect = tree.treeBoxObject.getCoordsForCellItem(1, tree.columns[0], "cell");
EventUtils.synthesizeMouse(tree.body, rect.x + rect.width / 2, rect.y + rect.height / 2, eventObj, win);
EventUtils.synthesizeMouseAtCenter(deleteButton, {}, win);
// count cookies should be matches-3
- is(win.gCookiesWindow._view.rowCount, matches-3, "Deleted selected two adjacent cookies");
+ is(win.gCookiesWindow._view.rowCount, matches - 3, "Deleted selected two adjacent cookies");
// "delete all cookies" should be enabled
isDisabled(win, false);
// delete all cookies and count
var deleteAllButton = win.document.getElementById("removeAllCookies");
EventUtils.synthesizeMouseAtCenter(deleteAllButton, {}, win);
is(win.gCookiesWindow._view.rowCount, 0, "Deleted all matching cookies");
// "delete all cookies" should be disabled
isDisabled(win, true);
// clear filter and count should be cookies-matches
win.gCookiesWindow.setFilter("");
- is(win.gCookiesWindow._view.rowCount, cookies-matches, "Unmatched cookies remain");
+ is(win.gCookiesWindow._view.rowCount, cookies - matches, "Unmatched cookies remain");
// "delete all cookies" should be enabled
isDisabled(win, false);
// delete all cookies and count should be 0
EventUtils.synthesizeMouseAtCenter(deleteAllButton, {}, win);
is(win.gCookiesWindow._view.rowCount, 0, "Deleted all cookies");
--- a/browser/components/preferences/in-content/tests/head.js
+++ b/browser/components/preferences/in-content/tests/head.js
@@ -138,17 +138,17 @@ function openPreferencesViaOpenPreferenc
gBrowser.removeCurrentTab();
deferred.resolve({selectedPane: selectedPane, selectedAdvancedTab: selectedAdvancedTab});
});
}, true);
return deferred.promise;
}
-function waitForCondition(aConditionFn, aMaxTries=50, aCheckInterval=100) {
+function waitForCondition(aConditionFn, aMaxTries = 50, aCheckInterval = 100) {
return new Promise((resolve, reject) => {
function tryNow() {
tries++;
let rv = aConditionFn();
if (rv) {
resolve(rv);
} else if (tries < aMaxTries) {
tryAgain();
--- a/browser/components/preferences/languages.js
+++ b/browser/components/preferences/languages.js
@@ -211,17 +211,17 @@ var gLanguagesDialog = {
languagesArray.push(item.id);
else
this._acceptLanguages[item.id] = false;
}
var string = languagesArray.join(",");
// Get the item to select after the remove operation completes.
var selection = this._activeLanguages.selectedItems;
- var lastSelected = selection[selection.length-1];
+ var lastSelected = selection[selection.length - 1];
var selectItem = lastSelected.nextSibling || lastSelected.previousSibling;
selectItem = selectItem ? selectItem.id : null;
this._selectedItemID = selectItem;
// Update the preference and force a UI rebuild
var preference = document.getElementById("intl.accept_languages");
preference.value = string;
--- a/browser/components/safebrowsing/content/test/head.js
+++ b/browser/components/safebrowsing/content/test/head.js
@@ -14,17 +14,17 @@ XPCOMUtils.defineLazyModuleGetter(this,
* @param [optional] url
* The url to load, or the current url.
* @param [optional] event
* The load event type to wait for. Defaults to "load".
* @return {Promise} resolved when the event is handled.
* @resolves to the received event
* @rejects if a valid load event is not received within a meaningful interval
*/
-function promiseTabLoadEvent(tab, url, eventType="load")
+function promiseTabLoadEvent(tab, url, eventType = "load")
{
info(`Wait tab event: ${eventType}`);
function handle(loadedUrl) {
if (loadedUrl === "about:blank" || (url && loadedUrl !== url)) {
info(`Skipping spurious load event for ${loadedUrl}`);
return false;
}
--- a/browser/components/uitour/UITour-lib.js
+++ b/browser/components/uitour/UITour-lib.js
@@ -249,17 +249,17 @@ if (typeof Mozilla == 'undefined') {
extraURLCampaignParams: JSON.stringify(extraURLCampaignParams),
});
};
Mozilla.UITour.resetFirefox = function() {
_sendEvent('resetFirefox');
};
- Mozilla.UITour.addNavBarWidget= function(name, callback) {
+ Mozilla.UITour.addNavBarWidget = function(name, callback) {
_sendEvent('addNavBarWidget', {
name: name,
callbackID: _waitForCallback(callback),
});
};
Mozilla.UITour.setDefaultSearchEngine = function(identifier) {
_sendEvent('setDefaultSearchEngine', {
--- a/browser/components/uitour/test/head.js
+++ b/browser/components/uitour/test/head.js
@@ -4,17 +4,17 @@ Cu.import("resource://gre/modules/Promis
Cu.import("resource://gre/modules/Task.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UITour",
"resource:///modules/UITour.jsm");
const SINGLE_TRY_TIMEOUT = 100;
const NUMBER_OF_TRIES = 30;
-function waitForConditionPromise(condition, timeoutMsg, tryCount=NUMBER_OF_TRIES) {
+function waitForConditionPromise(condition, timeoutMsg, tryCount = NUMBER_OF_TRIES) {
let defer = Promise.defer();
let tries = 0;
function checkCondition() {
if (tries >= tryCount) {
defer.reject(timeoutMsg);
}
var conditionPassed;
try {
--- a/browser/experiments/Experiments.jsm
+++ b/browser/experiments/Experiments.jsm
@@ -282,41 +282,41 @@ Experiments.Policy.prototype = {
* For testing a race condition, one of the tests delays the callback of
* writing the cache by replacing this policy function.
*/
delayCacheWrite: function(promise) {
return promise;
},
};
-function AlreadyShutdownError(message="already shut down") {
+function AlreadyShutdownError(message = "already shut down") {
Error.call(this, message);
let error = new Error();
this.name = "AlreadyShutdownError";
this.message = message;
this.stack = error.stack;
}
AlreadyShutdownError.prototype = Object.create(Error.prototype);
AlreadyShutdownError.prototype.constructor = AlreadyShutdownError;
-function CacheWriteError(message="Error writing cache file") {
+function CacheWriteError(message = "Error writing cache file") {
Error.call(this, message);
let error = new Error();
this.name = "CacheWriteError";
this.message = message;
this.stack = error.stack;
}
CacheWriteError.prototype = Object.create(Error.prototype);
CacheWriteError.prototype.constructor = CacheWriteError;
/**
* Manages the experiments and provides an interface to control them.
*/
-Experiments.Experiments = function (policy=new Experiments.Policy()) {
+Experiments.Experiments = function (policy = new Experiments.Policy()) {
let log = Log.repository.getLoggerWithMessagePrefix(
"Browser.Experiments.Experiments",
"Experiments #" + gExperimentsCounter++ + "::");
// At the time of this writing, Experiments.jsm has severe
// crashes. For forensics purposes, keep the last few log
// messages in memory and upload them in case of crash.
this._forensicsLogs = [];
@@ -698,17 +698,17 @@ Experiments.Experiments.prototype = {
* throws an error.
*
* @param id The ID of the experiment. Pass null for the currently running
* experiment.
* @returns Promise<string|null>
* @throws Error if the specified experiment ID is unknown, or if there is no
* current experiment.
*/
- getExperimentBranch: Task.async(function*(id=null) {
+ getExperimentBranch: Task.async(function*(id = null) {
yield this._loadTask;
let e;
if (id) {
e = this._experiments.get(id);
if (!e) {
throw new Error("Experiment not found");
}
} else {
@@ -1351,17 +1351,17 @@ Experiments.Experiments.prototype = {
}
}
if (time === null) {
// No schedule time found.
return;
}
- this._log.trace("scheduleExperimentEvaluation() - scheduling for "+time+", now: "+now);
+ this._log.trace("scheduleExperimentEvaluation() - scheduling for " + time + ", now: " + now);
this._policy.oneshotTimer(this.notify, time - now, this, "_timer");
},
};
/*
* Represents a single experiment.
*/
--- a/browser/experiments/test/xpcshell/head.js
+++ b/browser/experiments/test/xpcshell/head.js
@@ -154,32 +154,32 @@ const {
// |loadAddonManager| defined above in test_conditions.js as it would make the test fail.
function startAddonManagerOnly() {
let addonManager = Cc["@mozilla.org/addons/integration;1"]
.getService(Ci.nsIObserver)
.QueryInterface(Ci.nsITimerCallback);
addonManager.observe(null, "addons-startup", null);
}
-function getExperimentAddons(previous=false) {
+function getExperimentAddons(previous = false) {
let deferred = Promise.defer();
AddonManager.getAddonsByTypes(["experiment"], (addons) => {
if (previous) {
deferred.resolve(addons);
} else {
deferred.resolve(addons.filter(a => !a.appDisabled));
}
});
return deferred.promise;
}
-function createAppInfo(ID="xpcshell@tests.mozilla.org", name="XPCShell",
- version="1.0", platformVersion="1.0") {
+function createAppInfo(ID = "xpcshell@tests.mozilla.org", name = "XPCShell",
+ version = "1.0", platformVersion = "1.0") {
AddonTestUtils.createAppInfo(ID, name, version, platformVersion);
gAppInfo = AddonTestUtils.appInfo;
}
/**
* Replace the experiments on an Experiments with a new list.
*
* This monkeypatches getExperiments(). It doesn't monkeypatch the internal
--- a/browser/experiments/test/xpcshell/test_api.js
+++ b/browser/experiments/test/xpcshell/test_api.js
@@ -251,17 +251,17 @@ add_task(function* test_getExperiments()
list = yield experiments.getExperiments();
Assert.equal(list.length, 2, "Experiment list should have 2 entries now.");
addons = yield getExperimentAddons();
Assert.equal(addons.length, 1, "An experiment add-on is installed.");
experimentListData[0].active = true;
experimentListData[0].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
- for (let i=0; i<experimentListData.length; ++i) {
+ for (let i = 0; i < experimentListData.length; ++i) {
let entry = experimentListData[i];
for (let k of Object.keys(entry)) {
Assert.equal(entry[k], list[i][k],
"Entry " + i + " - Property '" + k + "' should match reference data.");
}
}
Assert.equal(gTimerScheduleOffset, 10 * MS_IN_ONE_DAY,
@@ -281,17 +281,17 @@ add_task(function* test_getExperiments()
list = yield experiments.getExperiments();
Assert.equal(list.length, 2, "Experiment list should have 2 entries now.");
addons = yield getExperimentAddons();
Assert.equal(addons.length, 0, "No experiments add-ons are installed.");
experimentListData[0].active = false;
experimentListData[0].endDate = now.getTime();
- for (let i=0; i<experimentListData.length; ++i) {
+ for (let i = 0; i < experimentListData.length; ++i) {
let entry = experimentListData[i];
for (let k of Object.keys(entry)) {
Assert.equal(entry[k], list[i][k],
"Entry " + i + " - Property '" + k + "' should match reference data.");
}
}
// Cleanup.
@@ -738,17 +738,17 @@ add_task(function* test_installFailure()
"Experiments observer should have been called.");
experimentListData[0].active = true;
experimentListData[0].endDate = now.getTime() + 10 * MS_IN_ONE_DAY;
list = yield experiments.getExperiments();
Assert.equal(list.length, 2, "Experiment list should have 2 entries now.");
- for (let i=0; i<experimentListData.length; ++i) {
+ for (let i = 0; i < experimentListData.length; ++i) {
let entry = experimentListData[i];
for (let k of Object.keys(entry)) {
Assert.equal(entry[k], list[i][k],
"Entry " + i + " - Property '" + k + "' should match reference data.");
}
}
yield testCleanup(experiments);
--- a/browser/experiments/test/xpcshell/test_cache.js
+++ b/browser/experiments/test/xpcshell/test_cache.js
@@ -53,17 +53,17 @@ add_task(function* test_setup() {
updatechannel: () => "nightly",
oneshotTimer: (callback, timeout, thisObj, name) => {},
});
});
function checkExperimentListsEqual(list, list2) {
Assert.equal(list.length, list2.length, "Lists should have the same length.")
- for (let i=0; i<list.length; ++i) {
+ for (let i = 0; i < list.length; ++i) {
for (let k of Object.keys(list[i])) {
Assert.equal(list[i][k], list2[i][k],
"Field '" + k + "' should match for list entry " + i + ".");
}
}
}
function checkExperimentSerializations(experimentEntryIterator) {
@@ -122,17 +122,17 @@ add_task(function* test_cache() {
};
// Setup dates for the experiments.
let baseDate = new Date(2014, 5, 1, 12);
let startDates = [];
let endDates = [];
- for (let i=0; i<gManifestObject.experiments.length; ++i) {
+ for (let i = 0; i < gManifestObject.experiments.length; ++i) {
let experiment = gManifestObject.experiments[i];
startDates.push(futureDate(baseDate, (50 + (150 * i)) * MS_IN_ONE_DAY));
endDates .push(futureDate(startDates[i], 50 * MS_IN_ONE_DAY));
experiment.startTime = dateToSeconds(startDates[i]);
experiment.endTime = dateToSeconds(endDates[i]);
}
// Data to compare the result of Experiments.getExperiments() against.
@@ -301,17 +301,17 @@ add_task(function* test_expiration() {
},
];
// Setup dates for the experiments.
let baseDate = new Date(2014, 5, 1, 12);
let startDates = [];
let endDates = [];
- for (let i=0; i<gManifestObject.experiments.length; ++i) {
+ for (let i = 0; i < gManifestObject.experiments.length; ++i) {
let experiment = gManifestObject.experiments[i];
// Spread out experiments in time so that one experiment can end and expire while
// the next is still running.
startDates.push(futureDate(baseDate, (50 + (200 * i)) * MS_IN_ONE_DAY));
endDates .push(futureDate(startDates[i], 50 * MS_IN_ONE_DAY));
experiment.startTime = dateToSeconds(startDates[i]);
experiment.endTime = dateToSeconds(endDates[i]);
}
--- a/browser/experiments/test/xpcshell/test_conditions.js
+++ b/browser/experiments/test/xpcshell/test_conditions.js
@@ -60,17 +60,17 @@ add_task(function* test_setup() {
Services.prefs.setBoolPref(PREF_LOGGING_DUMP, true);
});
function arraysEqual(a, b) {
if (a.length !== b.length) {
return false;
}
- for (let i=0; i<a.length; ++i) {
+ for (let i = 0; i < a.length; ++i) {
if (a[i] !== b[i]) {
return false;
}
}
return true;
}
@@ -195,17 +195,17 @@ add_task(function* test_simpleFields() {
[true, null, {jsfilter: "function filter(c) { return 123; }"}], // truthy
[false, ["jsfilter-false"], {jsfilter: "function filter(c) { return ''; }"}], // falsy
[false, ["jsfilter-false"], {jsfilter: "function filter(c) { var a = []; }"}], // undefined
[false, ["jsfilter-threw", "some error"], {jsfilter: "function filter(c) { throw new Error('some error'); }"}],
[false, ["jsfilter-evalfailed"], {jsfilter: "123, this won't work"}],
[true, null, {jsfilter: "var filter = " + sanityFilter.toSource()}],
];
- for (let i=0; i<testData.length; ++i) {
+ for (let i = 0; i < testData.length; ++i) {
let entry = testData[i];
let applicable;
let reason = null;
yield applicableFromManifestData(entry[2], gPolicy).then(
value => applicable = value,
value => {
applicable = false;
@@ -292,17 +292,17 @@ add_task(function* test_times() {
startTime: nowSec - 10 * SEC_IN_ONE_DAY,
endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
[true, null, now,
{maxActiveSeconds: 20 * SEC_IN_ONE_DAY,
startTime: nowSec - 10 * SEC_IN_ONE_DAY,
endTime: nowSec + 10 * SEC_IN_ONE_DAY}],
];
- for (let i=0; i<testData.length; ++i) {
+ for (let i = 0; i < testData.length; ++i) {
let entry = testData[i];
let applicable;
let reason = null;
defineNow(gPolicy, entry[2]);
yield applicableFromManifestData(entry[3], gPolicy).then(
value => applicable = value,
value => {
--- a/browser/experiments/test/xpcshell/test_telemetry.js
+++ b/browser/experiments/test/xpcshell/test_telemetry.js
@@ -133,162 +133,162 @@ add_task(function* test_telemetryBasics(
yield experiments.updateManifest();
let list = yield experiments.getExperiments();
Assert.equal(list.length, 0, "Experiment list should be empty.");
expectedLogLength += 2;
let log = TelemetryLog.entries();
do_print("Telemetry log: " + JSON.stringify(log));
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-2], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 2], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.REJECTED, EXPERIMENT1_ID, "startTime"]);
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.REJECTED, EXPERIMENT2_ID, "startTime"]);
// Trigger update, clock set for experiment 1 to start.
now = futureDate(startDate1, 5 * MS_IN_ONE_DAY);
defineNow(gPolicy, now);
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 1, "Experiment list should have 1 entry now.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries. Got " + log.toSource());
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.ACTIVATED, EXPERIMENT1_ID]);
// Trigger update, clock set for experiment 1 to stop.
now = futureDate(endDate1, 1000);
defineNow(gPolicy, now);
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 1, "Experiment list should have 1 entry.");
expectedLogLength += 2;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-2], TLOG.TERMINATION_KEY,
+ checkEvent(log[log.length - 2], TLOG.TERMINATION_KEY,
[TLOG.TERMINATION.EXPIRED, EXPERIMENT1_ID]);
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.REJECTED, EXPERIMENT2_ID, "startTime"]);
// Trigger update, clock set for experiment 2 to start with invalid hash.
now = startDate2;
defineNow(gPolicy, now);
gManifestObject.experiments[1].xpiHash = "sha1:0000000000000000000000000000000000000000";
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 1, "Experiment list should have 1 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.INSTALL_FAILURE, EXPERIMENT2_ID]);
// Trigger update, clock set for experiment 2 to properly start now.
now = futureDate(now, MS_IN_ONE_DAY);
defineNow(gPolicy, now);
gManifestObject.experiments[1].xpiHash = EXPERIMENT2_XPI_SHA1;
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.ACTIVATED, EXPERIMENT2_ID]);
// Fake user uninstall of experiment via add-on manager.
now = futureDate(now, MS_IN_ONE_DAY);
defineNow(gPolicy, now);
yield experiments.disableExperiment(TLOG.TERMINATION.ADDON_UNINSTALLED);
list = yield experiments.getExperiments();
Assert.equal(list.length, 2, "Experiment list should have 2 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.TERMINATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.TERMINATION_KEY,
[TLOG.TERMINATION.ADDON_UNINSTALLED, EXPERIMENT2_ID]);
// Trigger update with experiment 1a ready to start.
now = futureDate(now, MS_IN_ONE_DAY);
defineNow(gPolicy, now);
gManifestObject.experiments[0].id = EXPERIMENT3_ID;
gManifestObject.experiments[0].endTime = dateToSeconds(futureDate(now, 50 * MS_IN_ONE_DAY));
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 3, "Experiment list should have 3 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.ACTIVATED, EXPERIMENT3_ID]);
// Trigger disable of an experiment via the API.
now = futureDate(now, MS_IN_ONE_DAY);
defineNow(gPolicy, now);
yield experiments.disableExperiment(TLOG.TERMINATION.FROM_API);
list = yield experiments.getExperiments();
Assert.equal(list.length, 3, "Experiment list should have 3 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.TERMINATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.TERMINATION_KEY,
[TLOG.TERMINATION.FROM_API, EXPERIMENT3_ID]);
// Trigger update with experiment 1a ready to start.
now = futureDate(now, MS_IN_ONE_DAY);
defineNow(gPolicy, now);
gManifestObject.experiments[0].id = EXPERIMENT4_ID;
gManifestObject.experiments[0].endTime = dateToSeconds(futureDate(now, 50 * MS_IN_ONE_DAY));
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 4, "Experiment list should have 4 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.ACTIVATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.ACTIVATION_KEY,
[TLOG.ACTIVATION.ACTIVATED, EXPERIMENT4_ID]);
// Trigger experiment termination by something other than expiry via the manifest.
now = futureDate(now, MS_IN_ONE_DAY);
defineNow(gPolicy, now);
gManifestObject.experiments[0].os = "Plan9";
yield experiments.updateManifest();
list = yield experiments.getExperiments();
Assert.equal(list.length, 4, "Experiment list should have 4 entries.");
expectedLogLength += 1;
log = TelemetryLog.entries();
Assert.equal(log.length, expectedLogLength, "Telemetry log should have " + expectedLogLength + " entries.");
- checkEvent(log[log.length-1], TLOG.TERMINATION_KEY,
+ checkEvent(log[log.length - 1], TLOG.TERMINATION_KEY,
[TLOG.TERMINATION.RECHECK, EXPERIMENT4_ID, "os"]);
// Cleanup.
yield promiseRestartManager();
yield removeCacheFile();
});
--- a/browser/extensions/pocket/content/main.js
+++ b/browser/extensions/pocket/content/main.js
@@ -195,17 +195,17 @@ var pktUI = (function() {
var isValidURL = (typeof url !== 'undefined' && (url.startsWith("http") || url.startsWith('https')));
var inOverflowMenu = isInOverflowMenu();
var startheight = pktApi.isPremiumUser() && isValidURL ? savePanelHeights.expanded : savePanelHeights.collapsed;
if (inOverflowMenu) {
startheight = overflowMenuHeight;
}
- var panelId = showPanel("about:pocket-saved?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu='+inOverflowMenu + "&locale=" + getUILocale(), {
+ var panelId = showPanel("about:pocket-saved?pockethost=" + Services.prefs.getCharPref("extensions.pocket.site") + "&premiumStatus=" + (pktApi.isPremiumUser() ? '1' : '0') + '&inoverflowmenu=' + inOverflowMenu + "&locale=" + getUILocale(), {
onShow: function() {
var saveLinkMessageId = 'saveLink';
// Send error message for invalid url
if (!isValidURL) {
// TODO: Pass key for localized error in error object
let error = {
message: 'Only links can be saved',
--- a/browser/extensions/pocket/content/panels/js/saved.js
+++ b/browser/extensions/pocket/content/panels/js/saved.js
@@ -140,17 +140,17 @@ var PKT_SAVED_OVERLAY = function (option
var inputleft = $('.token-input-input-token input').position().left;
var listleft = $('.token-input-list').position().left;
var listleftmanual = parseInt($('.token-input-list').css('left'));
var listleftnatural = listleft - listleftmanual;
var leftwidth = $('.pkt_ext_tag_input_wrapper').outerWidth();
if ((inputleft + listleft + 20) > leftwidth)
{
- $('.token-input-list').css('left', Math.min(((inputleft + listleftnatural - leftwidth + 20)*-1), 0) + 'px');
+ $('.token-input-list').css('left', Math.min(((inputleft + listleftnatural - leftwidth + 20) * -1), 0) + 'px');
}
else
{
$('.token-input-list').css('left', '0');
}
};
this.checkPlaceholderStatus = function() {
if (this.wrapper.find('.pkt_ext_tag_input_wrapper').find('.token-input-token').length)
@@ -591,16 +591,16 @@ PKT_SAVED.prototype = {
window.thePKT_SAVED = thePKT_SAVED;
thePKT_SAVED.init();
}
var pocketHost = thePKT_SAVED.overlay.pockethost;
// send an async message to get string data
thePKT_SAVED.sendMessage("initL10N", {
tos: [
- 'https://'+ pocketHost +'/tos?s=ffi&t=tos&tv=panel_tryit',
- 'https://'+ pocketHost +'/privacy?s=ffi&t=privacypolicy&tv=panel_tryit'
+ 'https://' + pocketHost + '/tos?s=ffi&t=tos&tv=panel_tryit',
+ 'https://' + pocketHost + '/privacy?s=ffi&t=privacypolicy&tv=panel_tryit'
]
}, function(resp) {
window.pocketStrings = resp.strings;
window.thePKT_SAVED.create();
});
});
--- a/browser/extensions/pocket/content/panels/js/signup.js
+++ b/browser/extensions/pocket/content/panels/js/signup.js
@@ -178,16 +178,16 @@ PKT_SIGNUP.prototype = {
window.thePKT_SIGNUP = thePKT_SIGNUP;
thePKT_SIGNUP.init();
}
var pocketHost = thePKT_SIGNUP.overlay.pockethost;
// send an async message to get string data
thePKT_SIGNUP.sendMessage("initL10N", {
tos: [
- 'https://'+ pocketHost +'/tos?s=ffi&t=tos&tv=panel_tryit',
- 'https://'+ pocketHost +'/privacy?s=ffi&t=privacypolicy&tv=panel_tryit'
+ 'https://' + pocketHost + '/tos?s=ffi&t=tos&tv=panel_tryit',
+ 'https://' + pocketHost + '/privacy?s=ffi&t=privacypolicy&tv=panel_tryit'
]
}, function(resp) {
window.pocketStrings = resp.strings;
window.thePKT_SIGNUP.create();
});
});
--- a/browser/modules/BrowserUITelemetry.jsm
+++ b/browser/modules/BrowserUITelemetry.jsm
@@ -255,17 +255,17 @@ this.BrowserUITelemetry = {
}
parent = current;
current = current[key];
}
return parent;
},
_countableEvents: {},
- _countEvent: function(aKeyArray, root=this._countableEvents) {
+ _countEvent: function(aKeyArray, root = this._countableEvents) {
let countObject = this._ensureObjectChain(aKeyArray, 0, root);
let lastItemKey = aKeyArray[aKeyArray.length - 1];
countObject[lastItemKey]++;
},
_countMouseUpEvent: function(aCategory, aAction, aButton) {
const BUTTONS = ["left", "middle", "right"];
let buttonKey = BUTTONS[aButton];
--- a/browser/modules/BrowserUsageTelemetry.jsm
+++ b/browser/modules/BrowserUsageTelemetry.jsm
@@ -263,17 +263,17 @@ let BrowserUsageTelemetry = {
* @param {Boolean} [details.isSuggestion=false]
* true if this event was generated by a suggested search.
* @param {Boolean} [details.isAlias=false]
* true if this event was generated by a search using an alias.
* @param {Object} [details.type=null]
* The object describing the event that triggered the search.
* @throws if source is not in the known sources list.
*/
- recordSearch(engine, source, details={}) {
+ recordSearch(engine, source, details = {}) {
const isOneOff = !!details.isOneOff;
if (isOneOff) {
if (!KNOWN_ONEOFF_SOURCES.includes(source)) {
// Silently drop the error if this bogus call
// came from 'urlbar' or 'searchbar'. They're
// calling |recordSearch| twice from two different
// code paths.
--- a/browser/modules/ContentSearch.jsm
+++ b/browser/modules/ContentSearch.jsm
@@ -254,17 +254,17 @@ this.ContentSearch = {
};
win.openUILinkIn(submission.uri.spec, where, params);
}
win.BrowserSearch.recordSearchInTelemetry(engine, data.healthReportKey,
{ selection: data.selection });
return;
},
- getSuggestions: Task.async(function* (engineName, searchString, browser, remoteTimeout=null) {
+ getSuggestions: Task.async(function* (engineName, searchString, browser, remoteTimeout = null) {
let engine = Services.search.getEngineByName(engineName);
if (!engine) {
throw new Error("Unknown engine name: " + engineName);
}
let browserData = this._suggestionDataForBrowser(browser, true);
let { controller } = browserData;
let ok = SearchSuggestionController.engineOffersSuggestions(engine);
@@ -294,17 +294,17 @@ this.ContentSearch = {
engineName,
term: suggestions.term,
local: suggestions.local,
remote: suggestions.remote,
};
return result;
}),
- addFormHistoryEntry: Task.async(function* (browser, entry="") {
+ addFormHistoryEntry: Task.async(function* (browser, entry = "") {
let isPrivate = false;
try {
// isBrowserPrivate assumes that the passed-in browser has all the normal
// properties, which won't be true if the browser has been destroyed.
// That may be the case here due to the asynchronous nature of messaging.
isPrivate = PrivateBrowsingUtils.isBrowserPrivate(browser.target);
} catch (err) {
return false;
@@ -321,17 +321,17 @@ this.ContentSearch = {
handleCompletion: () => {},
handleError: err => {
Cu.reportError("Error adding form history entry: " + err);
},
});
return true;
}),
- currentStateObj: Task.async(function* (uriFlag=false) {
+ currentStateObj: Task.async(function* (uriFlag = false) {
let state = {
engines: [],
currentEngine: yield this._currentEngineObj(),
};
if (uriFlag) {
state.currentEngine.iconBuffer = Services.search.currentEngine.getIconURLBySize(16, 16);
}
let pref = Services.prefs.getCharPref("browser.search.hiddenOneOffs");
@@ -469,17 +469,17 @@ this.ContentSearch = {
else if (data !== "engine-default") {
// engine-default is always sent with engine-current and isn't otherwise
// relevant to content searches.
let state = yield this.currentStateObj();
this._broadcast("CurrentState", state);
}
}),
- _suggestionDataForBrowser: function (browser, create=false) {
+ _suggestionDataForBrowser: function (browser, create = false) {
let data = this._suggestionMap.get(browser);
if (!data && create) {
// Since one SearchSuggestionController instance is meant to be used per
// autocomplete widget, this means that we assume each xul:browser has at
// most one such widget.
data = {
controller: new SearchSuggestionController(),
};
--- a/browser/modules/DirectoryLinksProvider.jsm
+++ b/browser/modules/DirectoryLinksProvider.jsm
@@ -83,17 +83,17 @@ const SUGGESTED_FRECENCY = Infinity;
const FREQUENCY_CAP_FILE = "frequencyCap.json";
// Default settings for daily and total frequency caps
const DEFAULT_DAILY_FREQUENCY_CAP = 3;
const DEFAULT_TOTAL_FREQUENCY_CAP = 10;
// Default timeDelta to prune unused frequency cap objects
// currently set to 10 days in milliseconds
-const DEFAULT_PRUNE_TIME_DELTA = 10*24*60*60*1000;
+const DEFAULT_PRUNE_TIME_DELTA = 10 * 24 * 60 * 60 * 1000;
// The min number of visible (not blocked) history tiles to have before showing suggested tiles
const MIN_VISIBLE_HISTORY_TILES = 8;
// The max number of visible (not blocked) history tiles to test for inadjacency
const MAX_VISIBLE_HISTORY_TILES = 15;
// Allowed ping actions remotely stored as columns: case-insensitive [a-z0-9_]
@@ -101,17 +101,17 @@ const PING_ACTIONS = ["block", "click",
// Location of inadjacent sites json
const INADJACENCY_SOURCE = "chrome://browser/content/newtab/newTab.inadjacent.json";
// Fake URL to keep track of last block of a suggested tile in the frequency cap object
const FAKE_SUGGESTED_BLOCK_URL = "ignore://suggested_block";
// Time before suggested tile is allowed to play again after block - default to 1 day
-const AFTER_SUGGESTED_BLOCK_DECAY_TIME = 24*60*60*1000;
+const AFTER_SUGGESTED_BLOCK_DECAY_TIME = 24 * 60 * 60 * 1000;
/**
* Singleton that serves as the provider of directory links.
* Directory links are a hard-coded set of links shown if a user's link
* inventory is empty.
*/
var DirectoryLinksProvider = {
@@ -326,17 +326,17 @@ var DirectoryLinksProvider = {
}
return deferred.promise;
},
/**
* Downloads directory links if needed
* @return promise resolved immediately if no download needed, or upon completion
*/
- _fetchAndCacheLinksIfNecessary: function DirectoryLinksProvider_fetchAndCacheLinksIfNecessary(forceDownload=false) {
+ _fetchAndCacheLinksIfNecessary: function DirectoryLinksProvider_fetchAndCacheLinksIfNecessary(forceDownload = false) {
if (this._downloadDeferred) {
// fetching links already - just return the promise
return this._downloadDeferred.promise;
}
if (forceDownload || this._needsDownload) {
this._downloadDeferred = Promise.defer();
this._fetchAndCacheLinks(this._linksURL).then(() => {
--- a/browser/modules/Social.jsm
+++ b/browser/modules/Social.jsm
@@ -116,17 +116,17 @@ this.Social = {
}
return null;
},
getManifestByOrigin: function(origin) {
return SocialService.getManifestByOrigin(origin);
},
- installProvider: function(data, installCallback, options={}) {
+ installProvider: function(data, installCallback, options = {}) {
SocialService.installProvider(data, installCallback, options);
},
uninstallProvider: function(origin, aCallback) {
SocialService.uninstallProvider(origin, aCallback);
},
// Activation functionality
--- a/browser/modules/SocialService.jsm
+++ b/browser/modules/SocialService.jsm
@@ -570,17 +570,17 @@ this.SocialService = {
};
let anchor = "servicesInstall-notification-icon";
let notificationid = "servicesInstall";
data.window.PopupNotifications.show(data.window.gBrowser.selectedBrowser,
notificationid, message, anchor,
action, [], options);
},
- installProvider: function(data, installCallback, options={}) {
+ installProvider: function(data, installCallback, options = {}) {
data.installType = getOriginActivationType(data.origin);
// if we get data, we MUST have a valid manifest generated from the data
let manifest = this._manifestFromData(data.installType, data.manifest, data.origin);
if (!manifest)
throw new Error("SocialService.installProvider: service configuration is invalid from " + data.url);
let addon = new AddonWrapper(manifest);
if (addon && addon.blocklistState == Ci.nsIBlocklistService.STATE_BLOCKED)
--- a/browser/modules/WindowsJumpLists.jsm
+++ b/browser/modules/WindowsJumpLists.jsm
@@ -503,17 +503,17 @@ this.WinTaskbarJumpList =
Services.obs.removeObserver(this, "browser:purge-session-history");
_prefs.removeObserver("", this);
},
_updateTimer: function WTBJL__updateTimer() {
if (this._enabled && !this._shuttingDown && !this._timer) {
this._timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
this._timer.initWithCallback(this,
- _prefs.getIntPref(PREF_TASKBAR_REFRESH)*1000,
+ _prefs.getIntPref(PREF_TASKBAR_REFRESH) * 1000,
this._timer.TYPE_REPEATING_SLACK);
}
else if ((!this._enabled || this._shuttingDown) && this._timer) {
this._timer.cancel();
delete this._timer;
}
},
--- a/browser/modules/WindowsPreviewPerTab.jsm
+++ b/browser/modules/WindowsPreviewPerTab.jsm
@@ -787,17 +787,17 @@ this.AeroPeek = {
delete win.gTaskbarTabGroup;
if (this.windows.length == 0)
this.destroy();
},
resetCacheTimer: function () {
this.cacheTimer.cancel();
- this.cacheTimer.init(this, 1000*this.cacheLifespan, Ci.nsITimer.TYPE_ONE_SHOT);
+ this.cacheTimer.init(this, 1000 * this.cacheLifespan, Ci.nsITimer.TYPE_ONE_SHOT);
},
// nsIObserver
observe: function (aSubject, aTopic, aData) {
if (aTopic == "nsPref:changed" && aData == TOGGLE_PREF_NAME) {
this._prefenabled = this.prefs.getBoolPref(TOGGLE_PREF_NAME);
}
if (!this._prefenabled) {
--- a/browser/modules/test/browser_UsageTelemetry_urlbar.js
+++ b/browser/modules/test/browser_UsageTelemetry_urlbar.js
@@ -3,17 +3,17 @@
const SCALAR_URLBAR = "browser.engagement.navigation.urlbar";
// The preference to enable suggestions in the urlbar.
const SUGGEST_URLBAR_PREF = "browser.urlbar.suggest.searches";
// The name of the search engine used to generate suggestions.
const SUGGESTION_ENGINE_NAME = "browser_UsageTelemetry usageTelemetrySearchSuggestions.xml";
const ONEOFF_URLBAR_PREF = "browser.urlbar.oneOffSearches";
-let searchInAwesomebar = Task.async(function* (inputText, win=window) {
+let searchInAwesomebar = Task.async(function* (inputText, win = window) {
yield new Promise(r => waitForFocus(r, win));
// Write the search query in the urlbar.
win.gURLBar.focus();
win.gURLBar.value = inputText;
win.gURLBar.controller.startSearch(inputText);
// Wait for the popup to show.
yield BrowserTestUtils.waitForEvent(win.gURLBar.popup, "popupshown");
// And then for the search to complete.
--- a/browser/modules/test/head.js
+++ b/browser/modules/test/head.js
@@ -1,14 +1,14 @@
Cu.import("resource://gre/modules/Promise.jsm");
const SINGLE_TRY_TIMEOUT = 100;
const NUMBER_OF_TRIES = 30;
-function waitForConditionPromise(condition, timeoutMsg, tryCount=NUMBER_OF_TRIES) {
+function waitForConditionPromise(condition, timeoutMsg, tryCount = NUMBER_OF_TRIES) {
let defer = Promise.defer();
let tries = 0;
function checkCondition() {
if (tries >= tryCount) {
defer.reject(timeoutMsg);
}
var conditionPassed;
try {
--- a/browser/modules/test/unit/social/head.js
+++ b/browser/modules/test/unit/social/head.js
@@ -23,17 +23,17 @@ var manifests = [
const MANIFEST_PREFS = Services.prefs.getBranch("social.manifest.");
// SocialProvider class relies on blocklisting being enabled. To enable
// blocklisting, we have to setup an app and initialize the blocklist (see
// initApp below).
const gProfD = do_get_profile();
-function createAppInfo(ID, name, version, platformVersion="1.0") {
+function createAppInfo(ID, name, version, platformVersion = "1.0") {
let tmp = {};
Cu.import("resource://testing-common/AppInfo.jsm", tmp);
tmp.updateAppInfo({
ID, name, version, platformVersion,
crashReporter: true,
});
gAppInfo = tmp.getAppInfo();
}
--- a/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
+++ b/browser/modules/test/xpcshell/test_DirectoryLinksProvider.js
@@ -849,26 +849,26 @@ add_task(function* test_DirectoryLinksPr
});
add_task(function test_DirectoryLinksProvider_needsDownload() {
// test timestamping
DirectoryLinksProvider._lastDownloadMS = 0;
do_check_true(DirectoryLinksProvider._needsDownload);
DirectoryLinksProvider._lastDownloadMS = Date.now();
do_check_false(DirectoryLinksProvider._needsDownload);
- DirectoryLinksProvider._lastDownloadMS = Date.now() - (60*60*24 + 1)*1000;
+ DirectoryLinksProvider._lastDownloadMS = Date.now() - (60 * 60 * 24 + 1) * 1000;
do_check_true(DirectoryLinksProvider._needsDownload);
DirectoryLinksProvider._lastDownloadMS = 0;
});
add_task(function* test_DirectoryLinksProvider_fetchAndCacheLinksIfNecessary() {
yield DirectoryLinksProvider.init();
yield cleanJsonFile();
// explicitly change source url to cause the download during setup
- yield promiseSetupDirectoryLinksProvider({linksURL: kTestURL+" "});
+ yield promiseSetupDirectoryLinksProvider({linksURL: kTestURL + " "});
yield DirectoryLinksProvider._fetchAndCacheLinksIfNecessary();
// inspect lastDownloadMS timestamp which should be 5 seconds less then now()
let lastDownloadMS = DirectoryLinksProvider._lastDownloadMS;
do_check_true((Date.now() - lastDownloadMS) < 5000);
// we should have fetched a new file during setup
let data = yield readJsonFile();
@@ -1317,17 +1317,17 @@ add_task(function test_setupStartEndTime
}
};
// test ISO translation
DirectoryLinksProvider._setupStartEndTime(link);
do_check_eq(link.startTime, currentTime);
// test localtime translation
- let shiftedDate = new Date(currentTime - dt.getTimezoneOffset()*60*1000);
+ let shiftedDate = new Date(currentTime - dt.getTimezoneOffset() * 60 * 1000);
link.time_limits.start = shiftedDate.toISOString().replace(/Z$/, "");
DirectoryLinksProvider._setupStartEndTime(link);
do_check_eq(link.startTime, currentTime);
// throw some garbage into date string
delete link.startTime;
link.time_limits.start = "no date"
@@ -1521,17 +1521,17 @@ add_task(function* test_DirectoryLinksPr
// now insert a visit into places
yield new Promise(resolve => {
PlacesUtils.asyncHistory.updatePlaces(
{
uri: NetUtil.newURI(landingUrl),
title: "HELLO",
visits: [{
- visitDate: Date.now()*1000,
+ visitDate: Date.now() * 1000,
transitionType: Ci.nsINavHistoryService.TRANSITION_LINK
}]
},
{
handleError: function () { do_check_true(false); },
handleResult: function () {},
handleCompletion: function () { resolve(); }
}
@@ -1836,17 +1836,17 @@ add_task(function* test_blockSuggestedTi
do_check_true(suggestedLink.frecent_sites);
// timestamp suggested_block in the frequency cap object
DirectoryLinksProvider.handleSuggestedTileBlock();
// no more recommendations should be seen
do_check_eq(DirectoryLinksProvider._updateSuggestedTile(), undefined);
// move lastUpdated for suggested tile into the past
- DirectoryLinksProvider._frequencyCaps["ignore://suggested_block"].lastUpdated = Date.now() - 25*60*60*1000;
+ DirectoryLinksProvider._frequencyCaps["ignore://suggested_block"].lastUpdated = Date.now() - 25 * 60 * 60 * 1000;
// ensure that suggested tile updates again
suggestedLink = DirectoryLinksProvider._updateSuggestedTile();
do_check_true(suggestedLink.frecent_sites);
// Cleanup
yield promiseCleanDirectoryLinksProvider();
NewTabUtils.isTopPlacesSite = origIsTopPlacesSite;
NewTabUtils.getProviderLinks = origGetProviderLinks;
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -170,17 +170,17 @@ module.exports = {
// Never use spaces before function parentheses
// "space-before-function-paren": ["error", { "anonymous": "always", "named": "never" }],
// No space padding in parentheses
// "space-in-parens": ["error", "never"],
// Require spaces around operators
- // "space-infix-ops": "error",
+ "space-infix-ops": ["error", { "int32Hint": false }],
// ++ and -- should not need spacing
// "space-unary-ops": ["error", { "words": true, "nonwords": false }],
// Requires or disallows a whitespace (space or tab) beginning a comment
"spaced-comment": "error",
// No comparisons to NaN
--- a/toolkit/components/aboutperformance/content/aboutPerformance.js
+++ b/toolkit/components/aboutperformance/content/aboutPerformance.js
@@ -576,19 +576,19 @@ var View = {
for (let delta of subset) {
if (!(delta instanceof Delta)) {
throw new TypeError();
}
let cachedElements = this._grabOrCreateElements(delta, nature);
toAdd.push(cachedElements);
cachedElements.eltTitle.textContent = delta.readableName;
cachedElements.eltName.textContent = `Full name: ${delta.fullName}.`;
- cachedElements.eltLoaded.textContent = `Measure start: ${Math.round(delta.age/1000)} seconds ago.`
+ cachedElements.eltLoaded.textContent = `Measure start: ${Math.round(delta.age / 1000)} seconds ago.`
- let processes = delta.diff.processes.map(proc => `${proc.processId} (${proc.isChildProcess?"child":"parent"})`);
+ let processes = delta.diff.processes.map(proc => `${proc.processId} (${proc.isChildProcess ? "child" : "parent"})`);
cachedElements.eltProcess.textContent = `Processes: ${processes.join(", ")}`;
let jankSuffix = "";
if (watcherAlerts) {
let deltaAlerts = watcherAlerts.get(delta.diff.addonId);
if (deltaAlerts) {
if (deltaAlerts.occurrences) {
jankSuffix = ` (${deltaAlerts.occurrences} alerts)`;
}
@@ -602,19 +602,19 @@ var View = {
eltImpact.textContent = ` currently performs well.`;
} else if (Delta.compare(delta, Delta.MAX_DELTA_FOR_AVERAGE_RECENT_PERFORMANCE)) {
eltImpact.textContent = ` may currently be slowing down ${BRAND_NAME}.`;
} else {
eltImpact.textContent = ` is currently considerably slowing down ${BRAND_NAME}.`;
}
cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.diff.jank.longestDuration + 1}/${delta.diff.jank.durations.length}${jankSuffix}.`;
- cachedElements.eltCPU.textContent = `CPU usage: ${Math.ceil(delta.diff.jank.totalCPUTime/delta.diff.deltaT/10)}%.`;
- cachedElements.eltSystem.textContent = `System usage: ${Math.ceil(delta.diff.jank.totalSystemTime/delta.diff.deltaT/10)}%.`;
- cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.diff.cpow.totalCPOWTime/delta.diff.deltaT/10)}%.`;
+ cachedElements.eltCPU.textContent = `CPU usage: ${Math.ceil(delta.diff.jank.totalCPUTime / delta.diff.deltaT / 10)}%.`;
+ cachedElements.eltSystem.textContent = `System usage: ${Math.ceil(delta.diff.jank.totalSystemTime / delta.diff.deltaT / 10)}%.`;
+ cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.diff.cpow.totalCPOWTime / delta.diff.deltaT / 10)}%.`;
} else {
if (delta.alerts.length == 0) {
eltImpact.textContent = " has performed well so far.";
cachedElements.eltFPS.textContent = `Impact on framerate: no impact.`;
cachedElements.eltRoot.setAttribute("impact", 0);
} else {
let impact = 0;
let sum = /* medium impact */ delta.alerts[0] + /* high impact */ delta.alerts[1];
@@ -644,20 +644,20 @@ var View = {
}
eltImpact.textContent = ` ${describeFrequency} ${describeImpact}`;
cachedElements.eltFPS.textContent = `Impact on framerate: ${delta.alerts[1] || 0} high-impacts, ${delta.alerts[0] || 0} medium-impact${jankSuffix}.`;
}
cachedElements.eltRoot.setAttribute("impact", Math.round(impact));
}
- let result = delta.diff.jank.totalCPUTime/delta.diff.deltaT;
- cachedElements.eltCPU.textContent = `CPU usage: ${Math.ceil(delta.diff.jank.totalCPUTime/delta.diff.deltaT/10)}% (total ${delta.diff.jank.totalUserTime}ms).`;
- cachedElements.eltSystem.textContent = `System usage: ${Math.ceil(delta.diff.jank.totalSystemTime/delta.diff.deltaT/10)}% (total ${delta.diff.jank.totalSystemTime}ms).`;
- cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.diff.cpow.totalCPOWTime/delta.diff.deltaT/10)}% (total ${delta.diff.cpow.totalCPOWTime}ms).`;
+ let result = delta.diff.jank.totalCPUTime / delta.diff.deltaT;
+ cachedElements.eltCPU.textContent = `CPU usage: ${Math.ceil(delta.diff.jank.totalCPUTime / delta.diff.deltaT / 10)}% (total ${delta.diff.jank.totalUserTime}ms).`;
+ cachedElements.eltSystem.textContent = `System usage: ${Math.ceil(delta.diff.jank.totalSystemTime / delta.diff.deltaT / 10)}% (total ${delta.diff.jank.totalSystemTime}ms).`;
+ cachedElements.eltCPOW.textContent = `Blocking process calls: ${Math.ceil(delta.diff.cpow.totalCPOWTime / delta.diff.deltaT / 10)}% (total ${delta.diff.cpow.totalCPOWTime}ms).`;
}
}
this._insertElements(toAdd, id);
},
_insertElements: function(elements, id) {
let eltContainer = document.getElementById(id);
eltContainer.classList.remove("measuring");
@@ -864,18 +864,18 @@ var Control = {
},
update: Task.async(function*() {
let mode = this._displayMode;
if (this._autoRefreshInterval || !State._buffer[0]) {
// Update the state only if we are not on pause.
yield State.update();
}
yield wait(0);
- let state = yield (mode == MODE_GLOBAL?
- State.promiseDeltaSinceStartOfTime():
+ let state = yield (mode == MODE_GLOBAL ?
+ State.promiseDeltaSinceStartOfTime() :
State.promiseDeltaSinceStartOfBuffer());
for (let category of ["webpages", "addons"]) {
yield wait(0);
yield View.updateCategory(state[category], category, category, mode);
}
yield wait(0);
@@ -931,17 +931,17 @@ var Control = {
if (shouldUpdateNow) {
Control.update();
}
};
let eltCheckRecent = document.getElementById("check-display-recent");
let eltLabelRecent = document.getElementById("label-display-recent");
eltCheckRecent.addEventListener("click", () => onModeChange(true));
- eltLabelRecent.textContent = `Display only the latest ${Math.round(BUFFER_DURATION_MS/1000)}s`;
+ eltLabelRecent.textContent = `Display only the latest ${Math.round(BUFFER_DURATION_MS / 1000)}s`;
onModeChange(false);
},
// The display mode. One of `MODE_GLOBAL` or `MODE_RECENT`.
_displayMode: MODE_GLOBAL,
};
/**
--- a/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js
+++ b/toolkit/components/aboutperformance/tests/browser/browser_aboutperformance.js
@@ -222,17 +222,17 @@ var promiseExpectContent = Task.async(fu
return true;
}
return false;
});
// Test that we can find the title of a webpage in about:performance
add_task(function* test_find_title() {
for (let displayRecent of [true, false]) {
- info(`Testing with autoRefresh, in ${displayRecent?"recent":"global"} mode`);
+ info(`Testing with autoRefresh, in ${displayRecent ? "recent" : "global"} mode`);
let found = yield promiseExpectContent({autoRefresh: 100, displayRecent});
Assert.ok(found, `The page title appears when about:performance is set to auto-refresh`);
}
});
// Test that we can close/reload tabs using the corresponding buttons
add_task(function* test_close_tab() {
let tabs = new Map();
@@ -263,17 +263,17 @@ add_task(function* test_close_tab() {
info(`Requesting close`);
do {
yield new Promise(resolve => setTimeout(resolve, 100));
yield promiseContentResponse(tab.linkedBrowser, "aboutperformance-test:setTitle", URL);
let {ok, found, error} = yield promiseContentResponse(gTabAboutPerformance.linkedBrowser, "aboutperformance-test:closeTab", {url: URL, autoRefresh: true, mode, displayRecent});
Assert.ok(ok, `Message aboutperformance-test:closeTab was handled correctly ${JSON.stringify(error)}`);
- info(`URL ${URL} ${found?"found":"hasn't been found yet"}`);
+ info(`URL ${URL} ${found ? "found" : "hasn't been found yet"}`);
if (found) {
break;
}
} while (true);
if (mode == "close") {
info(`Waiting for close`);
yield promiseClosed;
--- a/toolkit/components/aboutperformance/tests/browser/browser_compartments_script.js
+++ b/toolkit/components/aboutperformance/tests/browser/browser_compartments_script.js
@@ -19,11 +19,11 @@ var interval = window.setInterval(() =>
}
// Compute an arbitrary value, print it out to make sure that the JS
// engine doesn't discard all our computation.
var date = Date.now();
var array = [];
var i = 0;
while (Date.now() - date <= 100) {
- array[i%2] = i++;
+ array[i % 2] = i++;
}
}, 300);
--- a/toolkit/components/asyncshutdown/AsyncShutdown.jsm
+++ b/toolkit/components/asyncshutdown/AsyncShutdown.jsm
@@ -212,17 +212,17 @@ try {
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
} catch (ex) {
// Ignore errors
}
Services.prefs.addObserver(PREF_DEBUG_LOG, function() {
DEBUG_LOG = Services.prefs.getBoolPref(PREF_DEBUG_LOG);
}, false);
-function debug(msg, error=null) {
+function debug(msg, error = null) {
if (DEBUG_LOG) {
log(msg, "DEBUG: ", error);
}
}
function warn(msg, error = null) {
log(msg, "WARNING: ", error);
}
function fatalerr(msg, error = null) {
--- a/toolkit/components/captivedetect/captivedetect.js
+++ b/toolkit/components/captivedetect/captivedetect.js
@@ -289,17 +289,17 @@ CaptivePortalDetector.prototype = {
let id = this._runningRequest.eventId;
if (eventId === id) {
this.executeCallback(false);
}
}
},
_applyDetection: function _applyDetection() {
- debug('enter applyDetection('+ this._runningRequest.interfaceName + ')');
+ debug('enter applyDetection(' + this._runningRequest.interfaceName + ')');
// Execute network interface preparation
if (this._runningRequest.hasOwnProperty('callback')) {
this._runningRequest.callback.prepare();
} else {
this._startDetection();
}
},
--- a/toolkit/components/commandlines/test/unit/test_bug666224.js
+++ b/toolkit/components/commandlines/test/unit/test_bug666224.js
@@ -1,6 +1,6 @@
function run_test() {
- var cmdLine=Components.classes["@mozilla.org/toolkit/command-line;1"].createInstance(Components.interfaces.nsICommandLine);
+ var cmdLine = Components.classes["@mozilla.org/toolkit/command-line;1"].createInstance(Components.interfaces.nsICommandLine);
try {
cmdLine.getArgument(cmdLine.length);
} catch (e) {}
}
--- a/toolkit/components/contentprefs/nsContentPrefService.js
+++ b/toolkit/components/contentprefs/nsContentPrefService.js
@@ -288,17 +288,17 @@ ContentPrefService.prototype = {
hasCachedPref: function ContentPrefService_hasCachedPref(aGroup, aName, aContext) {
warnDeprecated();
if (!aName)
throw Components.Exception("aName cannot be null or an empty string",
Cr.NS_ERROR_ILLEGAL_VALUE);
let group = this._parseGroupParam(aGroup);
- let storage = aContext && aContext.usePrivateBrowsing ? this._privModeStorage: this._cache;
+ let storage = aContext && aContext.usePrivateBrowsing ? this._privModeStorage : this._cache;
return storage.has(group, aName);
},
removePref: function ContentPrefService_removePref(aGroup, aName, aContext) {
warnDeprecated();
// If there's no old value, then there's nothing to remove.
if (!this.hasPref(aGroup, aName, aContext))
--- a/toolkit/components/cookie/content/cookieAcceptDialog.js
+++ b/toolkit/components/cookie/content/cookieAcceptDialog.js
@@ -128,17 +128,17 @@ function onload()
persistCheckbox.removeAttribute("checked");
persistCheckbox.setAttribute("disabled", "true");
}
} catch (ex) {}
}
function showhideinfo()
{
- var infobox=document.getElementById('infobox');
+ var infobox = document.getElementById('infobox');
if (infobox.hidden) {
infobox.setAttribute("hidden", "false");
document.getElementById('disclosureButton').setAttribute("label", hideDetails);
} else {
infobox.setAttribute("hidden", "true");
document.getElementById('disclosureButton').setAttribute("label", showDetails);
}
@@ -169,17 +169,17 @@ function cookieDeny()
params.SetInt(nsICookieAcceptDialog.ACCEPT_COOKIE, nsICookiePromptService.DENY_COOKIE);
// And remember that when needed
params.SetInt(nsICookieAcceptDialog.REMEMBER_DECISION, document.getElementById('persistDomainAcceptance').checked);
window.close();
}
function GetExpiresString(secondsUntilExpires) {
if (secondsUntilExpires) {
- var date = new Date(1000*secondsUntilExpires);
+ var date = new Date(1000 * secondsUntilExpires);
const locale = Components.classes["@mozilla.org/chrome/chrome-registry;1"]
.getService(Components.interfaces.nsIXULChromeRegistry)
.getSelectedLocale("global", true);
const dtOptions = { year: 'numeric', month: 'long', day: 'numeric',
hour: 'numeric', minute: 'numeric', second: 'numeric' };
return date.toLocaleString(locale, dtOptions);
}
return cookieBundle.getString("expireAtEndOfSession");
--- a/toolkit/components/crashes/CrashManagerTest.jsm
+++ b/toolkit/components/crashes/CrashManagerTest.jsm
@@ -52,17 +52,17 @@ this.sleep = function (wait) {
this.TestingCrashManager = function (options) {
CrashManager.call(this, options);
}
this.TestingCrashManager.prototype = {
__proto__: CrashManager.prototype,
- createDummyDump: function (submitted=false, date=new Date(), hr=false) {
+ createDummyDump: function (submitted = false, date = new Date(), hr = false) {
let uuid = Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator)
.generateUUID()
.toString();
uuid = uuid.substring(1, uuid.length - 1);
let path;
let mode;
@@ -84,32 +84,32 @@ this.TestingCrashManager.prototype = {
yield f.setDates(date, date);
yield f.close();
dump("Created fake crash: " + path + "\n");
return uuid;
});
},
- createIgnoredDumpFile: function (filename, submitted=false) {
+ createIgnoredDumpFile: function (filename, submitted = false) {
let path;
if (submitted) {
path = OS.Path.join(this._submittedDumpsDir, filename);
} else {
path = OS.Path.join(this._pendingDumpsDir, filename);
}
return Task.spawn(function* () {
let mode = OS.Constants.libc.S_IRUSR | OS.Constants.libc.S_IWUSR;
yield OS.File.open(path, {create: true}, {unixMode: mode});
dump ("Create ignored dump file: " + path + "\n");
});
},
- createEventsFile: function (filename, type, date, content, index=0) {
+ createEventsFile: function (filename, type, date, content, index = 0) {
let path = OS.Path.join(this._eventsDirs[index], filename);
let data = type + "\n" +
Math.floor(date.getTime() / 1000) + "\n" +
content;
let encoder = new TextEncoder();
let array = encoder.encode(data);
@@ -145,17 +145,17 @@ this.TestingCrashManager.prototype = {
var DUMMY_DIR_COUNT = 0;
this.getManager = function () {
return Task.spawn(function* () {
const dirMode = OS.Constants.libc.S_IRWXU;
let baseFile = OS.Constants.Path.profileDir;
- function makeDir(create=true) {
+ function makeDir(create = true) {
return Task.spawn(function* () {
let path = OS.Path.join(baseFile, "dummy-dir-" + DUMMY_DIR_COUNT++);
if (!create) {
return path;
}
dump("Creating directory: " + path + "\n");
--- a/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
+++ b/toolkit/components/crashes/tests/xpcshell/test_crash_manager.js
@@ -70,17 +70,17 @@ add_task(function* test_pending_dumps()
Assert.equal(typeof(entry), "object", "entry is an object");
Assert.ok("id" in entry, "id in entry");
Assert.ok("path" in entry, "path in entry");
Assert.ok("date" in entry, "date in entry");
Assert.notEqual(ids.indexOf(entry.id), -1, "ID is known");
}
for (let i = 0; i < COUNT; i++) {
- Assert.equal(entries[i].id, ids[COUNT-i-1], "Entries sorted by mtime");
+ Assert.equal(entries[i].id, ids[COUNT - i - 1], "Entries sorted by mtime");
}
});
// Submitted dump files on disk are detected properly.
add_task(function* test_submitted_dumps() {
let m = yield getManager();
let COUNT = 5;
@@ -425,17 +425,17 @@ add_task(function* test_addCrash() {
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE);
Assert.equal(crash.type, m.PROCESS_TYPE_GMPLUGIN + "-" + m.CRASH_TYPE_CRASH);
Assert.ok(crash.isOfType(m.PROCESS_TYPE_GMPLUGIN, m.CRASH_TYPE_CRASH));
crash = map.get("gpu-crash");
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE);
- Assert.equal(crash.type, m.PROCESS_TYPE_GPU+ "-" + m.CRASH_TYPE_CRASH);
+ Assert.equal(crash.type, m.PROCESS_TYPE_GPU + "-" + m.CRASH_TYPE_CRASH);
Assert.ok(crash.isOfType(m.PROCESS_TYPE_GPU, m.CRASH_TYPE_CRASH));
crash = map.get("changing-item");
Assert.ok(!!crash);
Assert.equal(crash.crashDate, DUMMY_DATE_2);
Assert.equal(crash.type, m.PROCESS_TYPE_CONTENT + "-" + m.CRASH_TYPE_HANG);
Assert.ok(crash.isOfType(m.PROCESS_TYPE_CONTENT, m.CRASH_TYPE_HANG));
});
--- a/toolkit/components/ctypes/tests/unit/head.js
+++ b/toolkit/components/ctypes/tests/unit/head.js
@@ -90,17 +90,17 @@ function structural_check_eq(a, b) {
do_check_true(result);
}
function structural_check_eq_aux(a, b) {
let ak;
try {
ak = Object.keys(a);
} catch (x) {
if (a != b) {
- throw new Error("Distinct values "+a, b);
+ throw new Error("Distinct values " + a, b);
}
return;
}
ak.forEach(
function(k) {
let av = a[k];
let bv = b[k];
structural_check_eq_aux(av, bv);
--- a/toolkit/components/ctypes/tests/unit/test_finalizer.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer.js
@@ -254,21 +254,21 @@ function run_test()
library.close();
}
// If only I could have Promises to test this :)
// There is only so much we can do at this stage,
// if we want to avoid tests overlapping.
function test_cycles(size, tc) {
// Now, restart this with unreferenced cycles
- for (i = 0; i < size/2; ++i) {
+ for (i = 0; i < size / 2; ++i) {
let a = {
- a: ctypes.CDataFinalizer(tc.acquire(i*2), tc.release),
+ a: ctypes.CDataFinalizer(tc.acquire(i * 2), tc.release),
b: {
- b: ctypes.CDataFinalizer(tc.acquire(i*2+1), tc.release)
+ b: ctypes.CDataFinalizer(tc.acquire(i * 2 + 1), tc.release)
}
};
a.b.a = a;
}
do_test_pending();
Components.utils.schedulePreciseGC(
function after_gc() {
@@ -324,17 +324,17 @@ function test_result_dispose(size, tc, c
ref.push(value);
}
do_check_eq(count_finalized(size, tc), 0);
for (i = 0; i < size; ++i) {
let witness = ref[i].dispose();
ref[i] = null;
if (!tc.released(i, witness)) {
- do_print("test_result_dispose failure at index "+i);
+ do_print("test_result_dispose failure at index " + i);
do_check_true(false);
}
}
do_check_eq(count_finalized(size, tc), size);
}
--- a/toolkit/components/ctypes/tests/unit/test_finalizer_shouldaccept.js
+++ b/toolkit/components/ctypes/tests/unit/test_finalizer_shouldaccept.js
@@ -83,19 +83,19 @@ function test_to_string()
function test_to_source()
{
do_print("Starting test_to_source");
let value = acquire(0);
let a = ctypes.CDataFinalizer(value, dispose);
do_check_eq(a.toSource(),
"ctypes.CDataFinalizer("
+ ctypes.size_t(value).toSource()
- +", "
- +dispose.toSource()
- +")");
+ + ", "
+ + dispose.toSource()
+ + ")");
value = null;
a.forget();
do_check_eq(a.toSource(), "ctypes.CDataFinalizer()");
a = ctypes.CDataFinalizer(acquire(0), dispose);
a.dispose();
do_check_eq(a.toSource(), "ctypes.CDataFinalizer()");
@@ -149,17 +149,17 @@ function test_errno(size, tc, cleanup)
* Check that a finalizable of a pointer can be used as a pointer
*/
function test_to_pointer()
{
let ptr = ctypes.int32_t(2).address();
let finalizable = ctypes.CDataFinalizer(ptr, dispose_ptr);
let unwrapped = ctypes.int32_t.ptr(finalizable);
- do_check_eq(""+ptr, ""+unwrapped);
+ do_check_eq("" + ptr, "" + unwrapped);
finalizable.forget(); // Do not dispose: This is not a real pointer.
}
/**
* Test that readstring can be applied to a finalizer
*/
function test_readstring(size)
--- a/toolkit/components/ctypes/tests/unit/test_jsctypes.js
+++ b/toolkit/components/ctypes/tests/unit/test_jsctypes.js
@@ -761,17 +761,17 @@ function run_bool_tests(library) {
do_check_eq(t.array().name, name + "[]");
do_check_eq(t.array(5).name, name + "[5]");
let d = t();
do_check_eq(d.value, 0);
d.value = 1;
do_check_eq(d.value, 1);
d.value = -0;
- do_check_eq(1/d.value, 1/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);
d = new t(1);
do_check_eq(d.value, 1);
// don't convert anything else
@@ -844,17 +844,17 @@ function run_integer_tests(library, t, n
d.value = limits[0];
do_check_eq(d.value, limits[0]);
d.value = limits[1];
do_check_eq(d.value, limits[1]);
d.value = 0;
do_check_eq(d.value, 0);
d.value = -0;
- do_check_eq(1/d.value, 1/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);
// don't convert anything else
let vals = [limits[0] - 1, limits[1] + 1, Infinity, -Infinity, NaN, 0.1,
null, undefined, "", "0", {}, [], new Number(16),
@@ -915,20 +915,20 @@ function run_float_tests(library, t, nam
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;
+ 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;
+ 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);
}
@@ -936,33 +936,33 @@ function run_float_tests(library, t, nam
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);
+ do_check_eq(1 / d.value, 1 / -0);
// don't convert anything else
let vals = [true, false, null, undefined, "", "0", {}, [], new Number(16),
{toString: function () { return 7; }},
{valueOf: function () { return 7; }}];
for (let i = 0; i < vals.length; i++)
do_check_throws(function () { d.value = vals[i]; }, TypeError);
// Check that values roundtrip through toSource() correctly.
function test_roundtrip(t, val)
{
let f1 = t(val);
eval("var f2 = " + f1.toSource());
do_check_eq(f1.value, f2.value);
}
- vals = [Infinity, -Infinity, -0, 0, 1, -1, 1/3, -1/3, 1/4, -1/4,
+ vals = [Infinity, -Infinity, -0, 0, 1, -1, 1 / 3, -1 / 3, 1 / 4, -1 / 4,
1e-14, -1e-14, 0xfffffffffffff000, -0xfffffffffffff000];
for (let i = 0; i < vals.length; i++)
test_roundtrip(t, vals[i]);
do_check_eq(t(NaN).toSource(), t.toSource() + "(NaN)");
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 + ")");
@@ -1031,17 +1031,17 @@ function run_wrapped_integer_tests(libra
d.value = w(limits[0]);
do_check_eq(d.value, limits[0]);
d.value = w(limits[1]);
do_check_eq(d.value, limits[1]);
d.value = 0;
do_check_eq(d.value, 0);
d.value = -0;
- do_check_eq(1/d.value, 1/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);
// don't convert anything else
let vals = [limits[2], limits[3], Infinity, -Infinity, NaN, 0.1,
null, undefined, "", "0", {}, [], new Number(16),
@@ -1112,17 +1112,17 @@ function run_char_tests(library, t, name
d.value = limits[0];
do_check_eq(d.value, limits[0]);
d.value = limits[1];
do_check_eq(d.value, limits[1]);
d.value = 0;
do_check_eq(d.value, 0);
d.value = -0;
- do_check_eq(1/d.value, 1/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);
// don't convert anything else
@@ -1201,17 +1201,17 @@ function run_char16_tests(library, t, na
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;
do_check_eq(toprimitive(d.value), 0);
d.value = -0;
- do_check_eq(1/toprimitive(d.value), 1/0);
+ do_check_eq(1 / toprimitive(d.value), 1 / 0);
d.value = false;
do_check_eq(toprimitive(d.value), 0);
d.value = true;
do_check_eq(toprimitive(d.value), 1);
d.value = "\0";
do_check_eq(toprimitive(d.value), 0);
d.value = "a";
@@ -1255,17 +1255,17 @@ function run_char16_tests(library, t, na
0, 0, 0, 0, 0, 0, 0, 0, 0,
0 ],
[ 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1,
18 ] ]);
}
// Test the class and prototype hierarchy for a given type constructor 'c'.
-function run_type_ctor_class_tests(c, t, t2, props=[], fns=[], instanceProps=[], instanceFns=[], specialProps=[])
+function run_type_ctor_class_tests(c, t, t2, props = [], fns = [], instanceProps = [], instanceFns = [], specialProps = [])
{
do_check_true(c.prototype.__proto__ === ctypes.CType.prototype);
do_check_true(c.prototype instanceof ctypes.CType);
do_check_true(c.prototype.constructor === c);
// Check that 'c.prototype' has the correct properties and functions.
for (let p of props)
do_check_true(c.prototype.hasOwnProperty(p));
@@ -2222,17 +2222,17 @@ 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: function () { return "bad"; }}, []];
+ let vals = [true, 0, 1 / 3, undefined, {}, {toString: function () { return "bad"; }}, []];
for (let i = 0; i < vals.length; i++)
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");
--- a/toolkit/components/feeds/FeedProcessor.js
+++ b/toolkit/components/feeds/FeedProcessor.js
@@ -363,18 +363,18 @@ Feed.prototype = {
LOG(e);
}
return uri;
},
// reset the bag to raw contents, not text constructs
_resetBagMembersToRawText: function Feed_resetBagMembers(fieldLists) {
- for (var i=0; i<fieldLists.length; i++) {
- for (var j=0; j<fieldLists[i].length; j++) {
+ for (var i = 0; i < fieldLists.length; i++) {
+ for (var j = 0; j < fieldLists[i].length; j++) {
if (bagHasKey(this.fields, fieldLists[i][j])) {
var textConstruct = this.fields.getProperty(fieldLists[i][j]);
this.fields.setPropertyAsAString(fieldLists[i][j],
textConstruct.text);
}
}
}
},
@@ -704,17 +704,17 @@ Person.prototype = {
* @param fields A list of fields to search for. List members can
* be a list, in which case the second member is
* transformation function (like parseInt).
*/
function fieldsToObj(container, fields) {
var props, prop, field, searchList;
for (var key in fields) {
searchList = fields[key];
- for (var i=0; i < searchList.length; ++i) {
+ for (var i = 0; i < searchList.length; ++i) {
props = searchList[i];
prop = null;
field = isArray(props) ? props[0] : props;
try {
prop = container.fields.getProperty(field);
}
catch (e) {
}
@@ -879,17 +879,17 @@ XHTMLHandler.prototype = {
// we need to skip it here.
if (this._isAtom && this._depth == 1 && localName == "div")
return;
// If it's an XHTML element, record it. Otherwise, it's ignored.
if (namespace == XHTML_NS) {
this._buf += "<" + localName;
var uri;
- for (var i=0; i < attributes.length; ++i) {
+ for (var i = 0; i < attributes.length; ++i) {
uri = attributes.getURI(i);
// XHTML attributes aren't in a namespace
if (uri == "") {
this._buf += (" " + attributes.getLocalName(i) + "='" +
xmlEscape(attributes.getValue(i)) + "'");
} else {
// write a small set of allowed attribute namespaces
var prefix = gAllowedXHTMLNamespaces[uri];
--- a/toolkit/components/feeds/test/head.js
+++ b/toolkit/components/feeds/test/head.js
@@ -18,25 +18,25 @@ function readTestData(testFile) {
istream.QueryInterface(Ci.nsILineInputStream);
var hasmore = false;
do {
var line = {};
hasmore = istream.readLine(line);
if (line.value.indexOf('Description:') > -1) {
- testcase.desc = line.value.substring(line.value.indexOf(':')+1).trim();
+ testcase.desc = line.value.substring(line.value.indexOf(':') + 1).trim();
}
if (line.value.indexOf('Expect:') > -1) {
- testcase.expect = line.value.substring(line.value.indexOf(':')+1).trim();
+ testcase.expect = line.value.substring(line.value.indexOf(':') + 1).trim();
}
if (line.value.indexOf('Base:') > -1) {
- testcase.base = NetUtil.newURI(line.value.substring(line.value.indexOf(':')+1).trim());
+ testcase.base = NetUtil.newURI(line.value.substring(line.value.indexOf(':') + 1).trim());
}
if (testcase.expect && testcase.desc) {
testcase.path = 'xml/' + testFile.parent.leafName + '/' + testFile.leafName;
testcase.file = testFile;
break;
}
--- a/toolkit/components/filepicker/content/filepicker.js
+++ b/toolkit/components/filepicker/content/filepicker.js
@@ -786,17 +786,17 @@ function processPath(path)
function processPathEntry(path, fileArray)
{
var filePath;
var file;
try {
file = sfile.clone().QueryInterface(nsILocalFile);
} catch (e) {
- dump("Couldn't clone\n"+e);
+ dump("Couldn't clone\n" + e);
return false;
}
var tilde_file = file.clone();
tilde_file.append("~");
if (path[0] == '~' && // Expand ~ to $HOME, except:
!(path == "~" && tilde_file.exists()) && // If ~ was entered and such a file exists, don't expand
(path.length == 1 || path[1] == "/")) // We don't want to expand ~file to ${HOME}file
@@ -812,24 +812,24 @@ function processPathEntry(path, fileArra
else if ((filePath.indexOf("/../") > 0) ||
(filePath.substr(-3) == "/..") ||
(filePath.substr(0, 3) == "../") ||
(filePath == "..")) {
/* appendRelativePath doesn't allow .. */
try {
file.initWithPath(file.path + "/" + filePath);
} catch (e) {
- dump("Couldn't init path\n"+e);
+ dump("Couldn't init path\n" + e);
return false;
}
}
else {
try {
file.appendRelativePath(filePath);
} catch (e) {
- dump("Couldn't append path\n"+e);
+ dump("Couldn't append path\n" + e);
return false;
}
}
fileArray[fileArray.length] = file;
return true;
}
--- a/toolkit/components/filepicker/nsFilePicker.js
+++ b/toolkit/components/filepicker/nsFilePicker.js
@@ -274,17 +274,17 @@ nsFilePicker.prototype = {
try {
parentWin = parent.QueryInterface(nsIInterfaceRequestor)
.getInterface(nsIWebNavigation)
.QueryInterface(nsIDocShellTreeItem)
.treeOwner
.QueryInterface(nsIInterfaceRequestor)
.getInterface(nsIBaseWindow);
} catch (ex) {
- dump("file picker couldn't get base window\n"+ex+"\n");
+ dump("file picker couldn't get base window\n" + ex + "\n");
}
try {
parent.openDialog("chrome://global/content/filepicker.xul",
"",
"chrome,modal,titlebar,resizable=yes,dependent=yes",
o);
this.mFilterIndex = o.retvals.filterIndex;
--- a/toolkit/components/filewatcher/tests/xpcshell/head.js
+++ b/toolkit/components/filewatcher/tests/xpcshell/head.js
@@ -11,19 +11,19 @@ Cu.import("resource://gre/modules/Promis
function makeWatcher() {
let watcher =
Cc['@mozilla.org/toolkit/filewatcher/native-file-watcher;1']
.getService(Ci.nsINativeFileWatcherService);
return watcher;
}
-function promiseAddPath(watcher, resource, onChange=null, onError=null) {
+function promiseAddPath(watcher, resource, onChange = null, onError = null) {
return new Promise(resolve =>
watcher.addPath(resource, onChange, onError, resolve)
);
}
-function promiseRemovePath(watcher, resource, onChange=null, onError=null) {
+function promiseRemovePath(watcher, resource, onChange = null, onError = null) {
return new Promise(resolve =>
watcher.removePath(resource, onChange, onError, resolve)
);
}
--- a/toolkit/components/gfx/SanityTest.js
+++ b/toolkit/components/gfx/SanityTest.js
@@ -8,45 +8,45 @@ const { utils: Cu, interfaces: Ci, class
Cu.import("resource://gre/modules/Services.jsm");
Cu.import('resource://gre/modules/Preferences.jsm');
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const FRAME_SCRIPT_URL = "chrome://gfxsanity/content/gfxFrameScript.js";
-const PAGE_WIDTH=92;
-const PAGE_HEIGHT=166;
-const DRIVER_PREF="sanity-test.driver-version";
-const DEVICE_PREF="sanity-test.device-id";
-const VERSION_PREF="sanity-test.version";
-const DISABLE_VIDEO_PREF="media.hardware-video-decoding.failed";
-const RUNNING_PREF="sanity-test.running";
-const TIMEOUT_SEC=20;
+const PAGE_WIDTH = 92;
+const PAGE_HEIGHT = 166;
+const DRIVER_PREF = "sanity-test.driver-version";
+const DEVICE_PREF = "sanity-test.device-id";
+const VERSION_PREF = "sanity-test.version";
+const DISABLE_VIDEO_PREF = "media.hardware-video-decoding.failed";
+const RUNNING_PREF = "sanity-test.running";
+const TIMEOUT_SEC = 20;
// GRAPHICS_SANITY_TEST histogram enumeration values
-const TEST_PASSED=0;
-const TEST_FAILED_RENDER=1;
-const TEST_FAILED_VIDEO=2;
-const TEST_CRASHED=3;
-const TEST_TIMEOUT=4;
+const TEST_PASSED = 0;
+const TEST_FAILED_RENDER = 1;
+const TEST_FAILED_VIDEO = 2;
+const TEST_CRASHED = 3;
+const TEST_TIMEOUT = 4;
// GRAPHICS_SANITY_TEST_REASON enumeration values.
-const REASON_FIRST_RUN=0;
-const REASON_FIREFOX_CHANGED=1;
-const REASON_DEVICE_CHANGED=2;
-const REASON_DRIVER_CHANGED=3;
+const REASON_FIRST_RUN = 0;
+const REASON_FIREFOX_CHANGED = 1;
+const REASON_DEVICE_CHANGED = 2;
+const REASON_DRIVER_CHANGED = 3;
// GRAPHICS_SANITY_TEST_OS_SNAPSHOT histogram enumeration values
-const SNAPSHOT_VIDEO_OK=0;
-const SNAPSHOT_VIDEO_FAIL=1;
-const SNAPSHOT_ERROR=2;
-const SNAPSHOT_TIMEOUT=3;
-const SNAPSHOT_LAYERS_OK=4;
-const SNAPSHOT_LAYERS_FAIL=5;
+const SNAPSHOT_VIDEO_OK = 0;
+const SNAPSHOT_VIDEO_FAIL = 1;
+const SNAPSHOT_ERROR = 2;
+const SNAPSHOT_TIMEOUT = 3;
+const SNAPSHOT_LAYERS_OK = 4;
+const SNAPSHOT_LAYERS_FAIL = 5;
function testPixel(ctx, x, y, r, g, b, a, fuzz) {
var data = ctx.getImageData(x, y, 1, 1);
if (Math.abs(data.data[0] - r) <= fuzz &&
Math.abs(data.data[1] - g) <= fuzz &&
Math.abs(data.data[2] - b) <= fuzz &&
Math.abs(data.data[3] - a) <= fuzz) {
--- a/toolkit/components/microformats/microformat-shiv.js
+++ b/toolkit/components/microformats/microformat-shiv.js
@@ -32,18 +32,18 @@ var Microformats; // jshint ignore:line
modules.Parser = function () {
this.rootPrefix = 'h-';
this.propertyPrefixes = ['p-', 'dt-', 'u-', 'e-'];
this.excludeTags = ['br', 'hr'];
};
// create objects incase the v1 map modules don't load
- modules.maps = (modules.maps)? modules.maps : {};
- modules.rels = (modules.rels)? modules.rels : {};
+ modules.maps = (modules.maps) ? modules.maps : {};
+ modules.rels = (modules.rels) ? modules.rels : {};
modules.Parser.prototype = {
init: function() {
this.rootNode = null;
this.document = null;
this.options = {
@@ -68,17 +68,17 @@ var Microformats; // jshint ignore:line
* @return {Object}
*/
get: function(options) {
var out = this.formatEmpty(),
data = [],
rels;
this.init();
- options = (options)? options : {};
+ options = (options) ? options : {};
this.mergeOptions(options);
this.getDOMContext( options );
// if we do not have any context create error
if (!this.rootNode || !this.document) {
this.errors.push(this.noContentErr);
} else {
@@ -123,17 +123,17 @@ var Microformats; // jshint ignore:line
* parse to get parent microformat of passed node
*
* @param {DOM Node} node
* @param {Object} options
* @return {Object}
*/
getParent: function(node, options) {
this.init();
- options = (options)? options : {};
+ options = (options) ? options : {};
if (node) {
return this.getParentTreeWalk(node, options);
}
this.errors.push(this.noContentErr);
return this.formatError();
},
@@ -147,17 +147,17 @@ var Microformats; // jshint ignore:line
count: function( options ) {
var out = {},
items,
classItems,
x,
i;
this.init();
- options = (options)? options : {};
+ options = (options) ? options : {};
this.getDOMContext( options );
// if we do not have any context create error
if (!this.rootNode || !this.document) {
return {'errors': [this.noContentErr]};
}
items = this.findRootNodes( this.rootNode, true );
i = items.length;
@@ -271,17 +271,17 @@ var Microformats; // jshint ignore:line
* internal parse to get parent microformats by walking up the tree
*
* @param {DOM Node} node
* @param {Object} options
* @param {Int} recursive
* @return {Object}
*/
getParentTreeWalk: function (node, options, recursive) {
- options = (options)? options : {};
+ options = (options) ? options : {};
// recursive calls
if (recursive === undefined) {
if (node.parentNode && node.nodeName !== 'HTML') {
return this.getParentTreeWalk(node.parentNode, options, true);
}
return this.formatEmpty();
}
@@ -1457,17 +1457,17 @@ var Microformats; // jshint ignore:line
*
* @param {DOM Node} node
* @param {Object} uf (microformat output structure)
* @param {Object} parentClasses (classes structure)
* @param {Boolean} impliedPropertiesByVersion
* @return {Object}
*/
modules.Parser.prototype.impliedRules = function(node, uf, parentClasses) {
- var typeVersion = (uf.typeVersion)? uf.typeVersion: 'v2';
+ var typeVersion = (uf.typeVersion) ? uf.typeVersion : 'v2';
// TEMP: override to allow v1 implied properties while spec changes
if (this.options.impliedPropertiesByVersion === false) {
typeVersion = 'v2';
}
if (node && uf && uf.properties) {
uf = this.impliedBackwardComp( node, uf, parentClasses );
@@ -1801,18 +1801,18 @@ var Microformats; // jshint ignore:line
latitude,
valid = true;
if (uf.type && uf.type.indexOf('h-geo') > -1) {
// has no latitude or longitude property
if (uf.properties.latitude === undefined || uf.properties.longitude === undefined ) {
- geoPair = (uf.properties.name)? uf.properties.name[0] : null;
- geoPair = (!geoPair && uf.properties.value)? uf.properties.value : geoPair;
+ geoPair = (uf.properties.name) ? uf.properties.name[0] : null;
+ geoPair = (!geoPair && uf.properties.value) ? uf.properties.value : geoPair;
if (geoPair) {
// allow for the use of a ';' as in microformats and also ',' as in Geo URL
geoPair = geoPair.replace(';', ',');
// has sep char
if (geoPair.indexOf(',') > -1 ) {
parts = geoPair.split(',');
@@ -2257,33 +2257,33 @@ var Microformats; // jshint ignore:line
/**
* removes spaces at front and back of text
*
* @param {String} text
* @return {String}
*/
trim: function( text ) {
if (text && this.isString(text)) {
- return (text.trim())? text.trim() : text.replace(/^\s+|\s+$/g, '');
+ return (text.trim()) ? text.trim() : text.replace(/^\s+|\s+$/g, '');
}
return '';
},
/**
* replaces a character in text
*
* @param {String} text
* @param {Int} index
* @param {String} character
* @return {String}
*/
replaceCharAt: function( text, index, character ) {
if (text && text.length > index) {
- return text.substr(0, index) + character + text.substr(index+character.length);
+ return text.substr(0, index) + character + text.substr(index + character.length);
}
return text;
},
/**
* removes whitespace, tabs and returns from start and end of text
*
@@ -2732,19 +2732,19 @@ var Microformats; // jshint ignore:line
} else {
// count all elements
out = child;
countAll++;
}
}
}
if (onlyOfType === true) {
- return (countOfType === 1)? out : null;
+ return (countOfType === 1) ? out : null;
}
- return (countAll === 1)? out : null;
+ return (countAll === 1) ? out : null;
},
/**
* is a node one of a list of tags
*
* @param {DOM Node} rootNode
* @param {Array} tagNames
@@ -2857,17 +2857,17 @@ var Microformats; // jshint ignore:line
var newNode,
newDocument = null;
if ( this.canCloneDocument( document )) {
newDocument = document.implementation.createHTMLDocument('');
newNode = newDocument.importNode( document.documentElement, true );
newDocument.replaceChild(newNode, newDocument.querySelector('html'));
}
- return (newNode && newNode.nodeType && newNode.nodeType === 1)? newDocument : document;
+ return (newNode && newNode.nodeType && newNode.nodeType === 1) ? newDocument : document;
},
/**
* can environment clone a DOM document
*
* @param {DOM Document} document
* @return {Boolean}
@@ -3040,17 +3040,17 @@ var Microformats; // jshint ignore:line
*
* @param {String} dateString
* @param {String} format
* @return {String}
*/
modules.ISODate = function ( dateString, format ) {
this.clear();
- this.format = (format)? format : 'auto'; // auto or W3C or RFC3339 or HTML5
+ this.format = (format) ? format : 'auto'; // auto or W3C or RFC3339 or HTML5
this.setFormatSep();
// optional should be full iso date/time string
if (arguments[0]) {
this.parse(dateString, format);
}
};
@@ -3299,17 +3299,17 @@ var Microformats; // jshint ignore:line
*/
parseTimeZone: function( timeString, format ) {
this.clearTimeZone();
var parts = [];
if (timeString.toLowerCase() === 'z') {
this.z = true;
// set case for z
- this.autoProfile.tzZulu = (timeString === 'z')? 'z' : 'Z';
+ this.autoProfile.tzZulu = (timeString === 'z') ? 'z' : 'Z';
} else {
// discover timezone separtor for auto profile // default is ':'
if (timeString.indexOf(':') === -1) {
this.autoProfile.tzsep = '';
}
// finds timezone +HH:MM and +HHMM ie +13:30 and +1330
@@ -3759,17 +3759,17 @@ var Microformats; // jshint ignore:line
* parses the text from the DOM Node
*
* @param {DOM Node} node
* @param {String} textFormat
* @return {String}
*/
parse: function(doc, node, textFormat) {
var out;
- this.textFormat = (textFormat)? textFormat : this.textFormat;
+ this.textFormat = (textFormat) ? textFormat : this.textFormat;
if (this.textFormat === 'normalised') {
out = this.walkTreeForText( node );
if (out !== undefined) {
return this.normalise( doc, out );
}
return '';
}
return this.formatText( doc, modules.domUtils.textContent(node), this.textFormat );
@@ -3793,17 +3793,17 @@ var Microformats; // jshint ignore:line
/**
* parses the text from a html string - only for whitespace or whitespacetrimmed formats
*
* @param {String} text
* @param {String} textFormat
* @return {String}
*/
formatText: function( doc, text, textFormat ) {
- this.textFormat = (textFormat)? textFormat : this.textFormat;
+ this.textFormat = (textFormat) ? textFormat : this.textFormat;
if (text) {
var out = '',
regex = /(<([^>]+)>)/ig;
out = text.replace(regex, '');
if (this.textFormat === 'whitespacetrimmed') {
out = modules.utils.trimWhitespace( out );
}
@@ -3859,17 +3859,17 @@ var Microformats; // jshint ignore:line
}
}
// if it's a block level tag add an additional space at the end
if (node.tagName && this.blockLevelTags.indexOf( node.tagName.toLowerCase() ) !== -1) {
out += ' ';
}
- return (out === '')? undefined : out ;
+ return (out === '') ? undefined : out ;
}
};
modules.html = {
// elements which are self-closing
@@ -3947,17 +3947,17 @@ var Microformats; // jshint ignore:line
// end tag
if (this.selfClosingElt.indexOf(node.tagName.toLowerCase()) > -1) {
out += ' />';
} else {
out += '</' + node.tagName.toLowerCase() + '>';
}
}
- return (out === '')? undefined : out;
+ return (out === '') ? undefined : out;
}
};
modules.maps['h-adr'] = {
root: 'adr',
--- a/toolkit/components/perfmonitoring/PerformanceStats.jsm
+++ b/toolkit/components/perfmonitoring/PerformanceStats.jsm
@@ -734,17 +734,17 @@ function PerformanceDiff(current, old =
this.addonId = current.addonId;
this.title = current.title;
this.windowId = current.windowId;
this.deltaT = old ? current._timestamp - old._timestamp : Infinity;
this._all = [];
// Handle the parent, if any.
if (current._parent) {
- this._parent = old?current._parent.subtract(old._parent):current._parent;
+ this._parent = old ? current._parent.subtract(old._parent) : current._parent;
this._all.push(this._parent);
this._parent.owner = this;
} else {
this._parent = null;
}
// Handle the children, if any.
this._content = new Map();
--- a/toolkit/components/perfmonitoring/tests/browser/browser_AddonWatcher.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_AddonWatcher.js
@@ -107,17 +107,17 @@ let burn_rubber = Task.async(function*({
info(`Burning some CPU with ${topic}. This should cause an add-on watcher notification`);
yield new Promise(resolve => setTimeout(resolve, 100));
Services.obs.notifyObservers(null, topic, "");
yield new Promise(resolve => setTimeout(resolve, 100));
let snap2 = histogram.snapshot(ADDON_ID);
histogramUpdated = snap2.sum > 0;
info(`For the moment, histogram ${histogramName} shows ${snap2.sum} => ${histogramUpdated}`);
- info(`For the moment, we have ${detected?"":"NOT "}detected the slow add-on`);
+ info(`For the moment, we have ${detected ? "" : "NOT "}detected the slow add-on`);
} while (!histogramUpdated || !detected);
let snap3 = histogram.snapshot(ADDON_ID);
Assert.ok(snap3.sum >= expectedMinSum, `Histogram ${histogramName} recorded a gravity of ${snap3.sum}, expecting at least ${expectedMinSum}.`);
} finally {
Services.obs.removeObserver(observer, AddonWatcher.TOPIC_SLOW_ADDON_DETECTED);
}
});
--- a/toolkit/components/perfmonitoring/tests/browser/browser_addonPerformanceAlerts.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_addonPerformanceAlerts.js
@@ -50,30 +50,30 @@ add_task(function* test_install_addon_th
yield new Promise(resolve => setTimeout(resolve, 100));
yield addon.run(topic, 10, realListener);
// Waiting a little – listeners are buffered.
yield new Promise(resolve => setTimeout(resolve, 100));
Assert.ok(realListener.triggered, `1. The real listener was triggered ${topic}`);
Assert.ok(universalListener.triggered, `1. The universal listener was triggered ${topic}`);
Assert.ok(!fakeListener.triggered, `1. The fake listener was not triggered ${topic}`);
- Assert.ok(realListener.result >= addon.jankThreshold, `1. jank is at least ${addon.jankThreshold/1000}ms (${realListener.result/1000}ms) ${topic}`);
+ Assert.ok(realListener.result >= addon.jankThreshold, `1. jank is at least ${addon.jankThreshold / 1000}ms (${realListener.result / 1000}ms) ${topic}`);
info(`Attempting to remove a performance listener incorrectly, check that this does not hurt our real listener ${topic}`);
Assert.throws(() => PerformanceWatcher.removePerformanceListener({addonId: addon.addonId}, () => {}));
Assert.throws(() => PerformanceWatcher.removePerformanceListener({addonId: addon.addonId + "-unbound-id-" + Math.random()}, realListener.listener));
yield addon.run(topic, 10, realListener);
// Waiting a little – listeners are buffered.
yield new Promise(resolve => setTimeout(resolve, 300));
Assert.ok(realListener.triggered, `2. The real listener was triggered ${topic}`);
Assert.ok(universalListener.triggered, `2. The universal listener was triggered ${topic}`);
Assert.ok(!fakeListener.triggered, `2. The fake listener was not triggered ${topic}`);
- Assert.ok(realListener.result >= 200000, `2. jank is at least 300ms (${realListener.result/1000}ms) ${topic}`);
+ Assert.ok(realListener.result >= 200000, `2. jank is at least 300ms (${realListener.result / 1000}ms) ${topic}`);
info(`Attempting to remove correctly, check if the listener is still triggered ${topic}`);
realListener.unregister();
yield addon.run(topic, 3, realListener);
Assert.ok(!realListener.triggered, `3. After being unregistered, the real listener was not triggered ${topic}`);
Assert.ok(universalListener.triggered, `3. The universal listener is still triggered ${topic}`);
info("Unregistering universal listener");
--- a/toolkit/components/perfmonitoring/tests/browser/browser_addonPerformanceAlerts_2.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_addonPerformanceAlerts_2.js
@@ -13,13 +13,13 @@ add_task(function* test_watch_addon_then
}
throw new Error(`I shouldn't have been called with addon ${group.addonId}`);
});
info("Now install the add-on, *after* having installed the listener");
let addon = new AddonBurner(addonId);
Assert.ok((yield addon.run(topic, 10, realListener)), `5. The real listener was triggered ${topic}`);
- Assert.ok(realListener.result >= addon.jankThreshold, `5. jank is at least ${addon.jankThreshold/1000}ms (${realListener.result}µs) ${topic}`);
+ Assert.ok(realListener.result >= addon.jankThreshold, `5. jank is at least ${addon.jankThreshold / 1000}ms (${realListener.result}µs) ${topic}`);
realListener.unregister();
addon.dispose();
}
});
--- a/toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_compartments.js
@@ -172,17 +172,17 @@ function monotinicity_tester(source, tes
let isCorrectPid = (item.processId == pid && !item.isChildProcess)
|| (item.processId != pid && item.isChildProcess);
SilentAssert.ok(isCorrectPid, `Pid check (${name}): the item comes from the right process`);
let key = item.groupId;
if (map.has(key)) {
let old = map.get(key);
- Assert.ok(false, `Component ${key} has already been seen. Latest: ${item.addonId||item.name}, previous: ${old.addonId||old.name}`);
+ Assert.ok(false, `Component ${key} has already been seen. Latest: ${item.addonId || item.name}, previous: ${old.addonId || old.name}`);
}
map.set(key, item);
}
for (let item of snapshot.componentsData) {
if (!item.parentId) {
continue;
}
let parent = map.get(item.parentId);
--- a/toolkit/components/perfmonitoring/tests/browser/browser_compartments_script.js
+++ b/toolkit/components/perfmonitoring/tests/browser/browser_compartments_script.js
@@ -19,11 +19,11 @@ var interval = window.setInterval(() =>
}
// Compute an arbitrary value, print it out to make sure that the JS
// engine doesn't discard all our computation.
var date = Date.now();
var array = [];
var i = 0;
while (Date.now() - date <= 100) {
- array[i%2] = i++;
+ array[i % 2] = i++;
}
}, 300);
--- a/toolkit/components/places/BookmarkJSONUtils.jsm
+++ b/toolkit/components/places/BookmarkJSONUtils.jsm
@@ -128,17 +128,17 @@ this.BookmarkJSONUtils = Object.freeze({
* @return {Promise}
* @resolves once the file has been created, to an object with the
* following properties:
* - count: number of exported bookmarks
* - hash: file hash for contents comparison
* @rejects JavaScript exception.
* @deprecated passing an nsIFile is deprecated
*/
- exportToFile: function BJU_exportToFile(aFilePath, aOptions={}) {
+ exportToFile: function BJU_exportToFile(aFilePath, aOptions = {}) {
if (aFilePath instanceof Ci.nsIFile) {
Deprecated.warning("Passing an nsIFile to BookmarksJSONUtils.exportToFile " +
"is deprecated. Please use an OS.File path string instead.",
"https://developer.mozilla.org/docs/JavaScript_OS.File");
aFilePath = aFilePath.path;
}
return Task.spawn(function* () {
let [bookmarks, count] = yield PlacesBackups.getBookmarksTree();
--- a/toolkit/components/places/Bookmarks.jsm
+++ b/toolkit/components/places/Bookmarks.jsm
@@ -401,17 +401,17 @@ var Bookmarks = Object.freeze({
* - source: The change source, forwarded to all bookmark observers.
* Defaults to nsINavBookmarksService::SOURCE_DEFAULT.
*
* @return {Promise} resolved when the removal is complete.
* @resolves to an object representing the removed bookmark.
* @rejects if the provided guid doesn't match any existing bookmark.
* @throws if the arguments are invalid.
*/
- remove(guidOrInfo, options={}) {
+ remove(guidOrInfo, options = {}) {
let info = guidOrInfo;
if (!info)
throw new Error("Input should be a valid object");
if (typeof(guidOrInfo) != "object")
info = { guid: guidOrInfo };
// Disallow removing the root folders.
if ([this.rootGuid, this.menuGuid, this.toolbarGuid, this.unfiledGuid,
@@ -464,17 +464,17 @@ var Bookmarks = Object.freeze({
* @param {Object} [options={}]
* Additional options. Currently supports the following properties:
* - source: The change source, forwarded to all bookmark observers.
* Defaults to nsINavBookmarksService::SOURCE_DEFAULT.
*
* @return {Promise} resolved when the removal is complete.
* @resolves once the removal is complete.
*/
- eraseEverything: function(options={}) {
+ eraseEverything: function(options = {}) {
return PlacesUtils.withConnectionWrapper("Bookmarks.jsm: eraseEverything",
db => db.executeTransaction(function* () {
const folderGuids = [this.toolbarGuid, this.menuGuid, this.unfiledGuid,
this.mobileGuid];
yield removeFoldersContents(db, folderGuids, options);
const time = PlacesUtils.toPRTime(new Date());
for (let folderGuid of folderGuids) {
yield db.executeCached(
@@ -542,31 +542,31 @@ var Bookmarks = Object.freeze({
* an array of such objects. if no item is found, the returned
* promise is resolved to null.
* @rejects if an error happens while fetching.
* @throws if the arguments are invalid.
*
* @note Any unknown property in the info object is ignored. Known properties
* may be overwritten.
*/
- fetch(guidOrInfo, onResult=null) {
+ fetch(guidOrInfo, onResult = null) {
if (onResult && typeof onResult != "function")
throw new Error("onResult callback must be a valid function");
let info = guidOrInfo;
if (!info)
throw new Error("Input should be a valid object");
if (typeof(info) != "object")
info = { guid: guidOrInfo };
// Only one condition at a time can be provided.
let conditionsCount = [
v => v.hasOwnProperty("guid"),
v => v.hasOwnProperty("parentGuid") && v.hasOwnProperty("index"),
v => v.hasOwnProperty("url")
- ].reduce((old, fn) => old + fn(info)|0, 0);
+ ].reduce((old, fn) => old + fn(info) | 0, 0);
if (conditionsCount != 1)
throw new Error(`Unexpected number of conditions provided: ${conditionsCount}`);
// Even if we ignore any other unneeded property, we still validate any
// known property to reduce likelihood of hidden bugs.
let fetchInfo = validateBookmarkObject(info,
{ parentGuid: { requiredIf: b => b.hasOwnProperty("index") }
, index: { requiredIf: b => b.hasOwnProperty("parentGuid")
@@ -687,17 +687,17 @@ var Bookmarks = Object.freeze({
* Additional options. Currently supports the following properties:
* - source: The change source, forwarded to all bookmark observers.
* Defaults to nsINavBookmarksService::SOURCE_DEFAULT.
*
* @return {Promise} resolved when reordering is complete.
* @rejects if an error happens while reordering.
* @throws if the arguments are invalid.
*/
- reorder(parentGuid, orderedChildrenGuids, options={}) {
+ reorder(parentGuid, orderedChildrenGuids, options = {}) {
let info = { guid: parentGuid, source: this.SOURCES.DEFAULT };
info = validateBookmarkObject(info, { guid: { required: true } });
if (!Array.isArray(orderedChildrenGuids) || !orderedChildrenGuids.length)
throw new Error("Must provide a sorted array of children GUIDs.");
try {
orderedChildrenGuids.forEach(PlacesUtils.BOOKMARK_VALIDATORS.guid);
} catch (ex) {
--- a/toolkit/components/places/ColorConversion.js
+++ b/toolkit/components/places/ColorConversion.js
@@ -47,18 +47,18 @@ function rgb2xyz(r, g, b) {
* of the color in the Lab color space.
*/
function rgb2lab(r, g, b) {
let xyz = rgb2xyz(r, g, b),
x = xyz.x / 95.047,
y = xyz.y / 100,
z = xyz.z / 108.883;
- x = x > 0.008856 ? Math.pow(x, 1/3) : (7.787 * x) + (16 / 116);
- y = y > 0.008856 ? Math.pow(y, 1/3) : (7.787 * y) + (16 / 116);
- z = z > 0.008856 ? Math.pow(z, 1/3) : (7.787 * z) + (16 / 116);
+ x = x > 0.008856 ? Math.pow(x, 1 / 3) : (7.787 * x) + (16 / 116);
+ y = y > 0.008856 ? Math.pow(y, 1 / 3) : (7.787 * y) + (16 / 116);
+ z = z > 0.008856 ? Math.pow(z, 1 / 3) : (7.787 * z) + (16 / 116);
return {
lightness: (116 * y) - 16,
a: 500 * (x - y),
b: 200 * (y - z)
};
}
--- a/toolkit/components/places/History.jsm
+++ b/toolkit/components/places/History.jsm
@@ -941,17 +941,17 @@ var remove = Task.async(function*(db, {g
* @param pageInfo: (PageInfo)
* An PageInfo object into which to merge the data from updateInfo.
* Defaults to an empty object so that this method can be used
* to simply convert an updateInfo object into a PageInfo object.
*
* @return (PageInfo)
* A PageInfo object populated with data from updateInfo.
*/
-function mergeUpdateInfoIntoPageInfo(updateInfo, pageInfo={}) {
+function mergeUpdateInfoIntoPageInfo(updateInfo, pageInfo = {}) {
pageInfo.guid = updateInfo.guid;
if (!pageInfo.url) {
pageInfo.url = new URL(updateInfo.uri.spec);
pageInfo.title = updateInfo.title;
pageInfo.visits = updateInfo.visits.map(visit => {
return {
date: PlacesUtils.toDate(visit.visitDate),
transition: visit.transitionType,
--- a/toolkit/components/places/PlacesUtils.jsm
+++ b/toolkit/components/places/PlacesUtils.jsm
@@ -514,17 +514,17 @@ this.PlacesUtils = {
* - validIf: if the provided condition is not satisfied, then this
* property is invalid.
* - defaultValue: an undefined property should default to this value.
*
* @return a validated and normalized item.
* @throws if the object contains invalid data.
* @note any unknown properties are pass-through.
*/
- validateItemProperties(validators, props, behavior={}) {
+ validateItemProperties(validators, props, behavior = {}) {
if (!props)
throw new Error("Input should be a valid object");
// Make a shallow copy of `props` to avoid mutating the original object
// when filling in defaults.
let input = Object.assign({}, props);
let normalizedInput = {};
let required = new Set();
for (let prop in behavior) {
@@ -918,21 +918,21 @@ this.PlacesUtils = {
break;
case this.TYPE_X_MOZ_URL: {
let parts = blob.split("\n");
// data in this type has 2 parts per entry, so if there are fewer
// than 2 parts left, the blob is malformed and we should stop
// but drag and drop of files from the shell has parts.length = 1
if (parts.length != 1 && parts.length % 2)
break;
- for (let i = 0; i < parts.length; i=i+2) {
+ for (let i = 0; i < parts.length; i = i + 2) {
let uriString = parts[i];
let titleString = "";
- if (parts.length > i+1)
- titleString = parts[i+1];
+ if (parts.length > i + 1)
+ titleString = parts[i + 1];
else {
// for drag and drop of files, try to use the leafName as title
try {
titleString = this._uri(uriString).QueryInterface(Ci.nsIURL)
.fileName;
}
catch (e) {}
}
@@ -2140,17 +2140,17 @@ var Keywords = {
* or url property to find keywords for. If both properties are set,
* this returns their intersection.
* @param onResult [optional]
* Callback invoked for each found entry.
* @return {Promise}
* @resolves to an object in the form: { keyword, url, postData },
* or null if a keyword entry was not found.
*/
- fetch(keywordOrEntry, onResult=null) {
+ fetch(keywordOrEntry, onResult = null) {
if (typeof(keywordOrEntry) == "string")
keywordOrEntry = { keyword: keywordOrEntry };
if (keywordOrEntry === null || typeof(keywordOrEntry) != "object" ||
(("keyword" in keywordOrEntry) && typeof(keywordOrEntry.keyword) != "string"))
throw new Error("Invalid keyword");
let hasKeyword = "keyword" in keywordOrEntry;
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -1992,17 +1992,17 @@ UnifiedComplete.prototype = {
/**
* Properly cleans up when searching is completed.
*
* @param notify [optional]
* Indicates if we should notify the AutoComplete listener about our
* results or not.
*/
- finishSearch: function (notify=false) {
+ finishSearch: function (notify = false) {
TelemetryStopwatch.cancel(TELEMETRY_1ST_RESULT, this);
TelemetryStopwatch.cancel(TELEMETRY_6_FIRST_RESULTS, this);
// Clear state now to avoid race conditions, see below.
let search = this._currentSearch;
if (!search)
return;
this._lastLowResultsSearchSuggestion = search._lastLowResultsSearchSuggestion;
delete this._currentSearch;
--- a/toolkit/components/places/nsLivemarkService.js
+++ b/toolkit/components/places/nsLivemarkService.js
@@ -171,17 +171,17 @@ LivemarkService.prototype = {
throw new Components.Exception("Invalid arguments", Cr.NS_ERROR_INVALID_ARG);
}
let hasParentId = "parentId" in aLivemarkInfo;
let hasParentGuid = "parentGuid" in aLivemarkInfo;
let hasIndex = "index" in aLivemarkInfo;
// Must provide at least non-null parent guid/id, index and feedURI.
if ((!hasParentId && !hasParentGuid) ||
(hasParentId && aLivemarkInfo.parentId < 1) ||
- (hasParentGuid &&!/^[a-zA-Z0-9\-_]{12}$/.test(aLivemarkInfo.parentGuid)) ||
+ (hasParentGuid && !/^[a-zA-Z0-9\-_]{12}$/.test(aLivemarkInfo.parentGuid)) ||
(hasIndex && aLivemarkInfo.index < Ci.nsINavBookmarksService.DEFAULT_INDEX) ||
!(aLivemarkInfo.feedURI instanceof Ci.nsIURI) ||
(aLivemarkInfo.siteURI && !(aLivemarkInfo.siteURI instanceof Ci.nsIURI)) ||
(aLivemarkInfo.guid && !/^[a-zA-Z0-9\-_]{12}$/.test(aLivemarkInfo.guid))) {
throw new Components.Exception("Invalid arguments", Cr.NS_ERROR_INVALID_ARG);
}
return Task.spawn(function* () {
--- a/toolkit/components/places/nsTaggingService.js
+++ b/toolkit/components/places/nsTaggingService.js
@@ -105,17 +105,17 @@ TaggingService.prototype = {
* Array of tags. Entries can be tag names or concrete item id.
* @param trim [optional]
* Whether to trim passed-in named tags. Defaults to false.
* @return Array of tag objects like { id: number, name: string }.
*
* @throws Cr.NS_ERROR_INVALID_ARG if any element of the input array is not
* a valid tag.
*/
- _convertInputMixedTagsArray(aTags, trim=false) {
+ _convertInputMixedTagsArray(aTags, trim = false) {
// Handle sparse array with a .filter.
return aTags.filter(tag => tag !== undefined)
.map(idOrName => {
let tag = {};
if (typeof(idOrName) == "number" && this._tagFolders[idOrName]) {
// This is a tag folder id.
tag.id = idOrName;
// We can't know the name at this point, since a previous tag could
@@ -294,17 +294,17 @@ TaggingService.prototype = {
// nsITaggingService
getTagsForURI: function TS_getTagsForURI(aURI, aCount) {
if (!aURI)
throw Cr.NS_ERROR_INVALID_ARG;
var tags = [];
var bookmarkIds = PlacesUtils.bookmarks.getBookmarkIdsForURI(aURI);
- for (var i=0; i < bookmarkIds.length; i++) {
+ for (var i = 0; i < bookmarkIds.length; i++) {
var folderId = PlacesUtils.bookmarks.getFolderIdForItem(bookmarkIds[i]);
if (this._tagFolders[folderId])
tags.push(this._tagFolders[folderId]);
}
// sort the tag list
tags.sort(function(a, b) {
return a.toLowerCase().localeCompare(b.toLowerCase());
@@ -614,18 +614,18 @@ TagAutoCompleteSearch.prototype = {
var comments = [];
this._stopped = false;
// only search on characters for the last tag
var index = Math.max(searchString.lastIndexOf(","),
searchString.lastIndexOf(";"));
var before = '';
if (index != -1) {
- before = searchString.slice(0, index+1);
- searchString = searchString.slice(index+1);
+ before = searchString.slice(0, index + 1);
+ searchString = searchString.slice(index + 1);
// skip past whitespace
var m = searchString.match(/\s+/);
if (m) {
before += m[0];
searchString = searchString.slice(m[0].length);
}
}
--- a/toolkit/components/places/tests/bookmarks/test_405938_restore_queries.js
+++ b/toolkit/components/places/tests/bookmarks/test_405938_restore_queries.js
@@ -93,41 +93,41 @@ var test = {
clean: function () {},
validate: function validate() {
// Throw a wrench in the works by inserting some new bookmarks,
// ensuring folder ids won't be the same, when restoring.
for (let i = 0; i < 10; i++) {
PlacesUtils.bookmarks.
- insertBookmark(PlacesUtils.bookmarksMenuFolderId, uri("http://aaaa"+i), DEFAULT_INDEX, "");
+ insertBookmark(PlacesUtils.bookmarksMenuFolderId, uri("http://aaaa" + i), DEFAULT_INDEX, "");
}
var toolbar =
PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId,
false, true).root;
do_check_true(toolbar.childCount, 1);
var folderNode = toolbar.getChild(0);
do_check_eq(folderNode.type, folderNode.RESULT_TYPE_FOLDER);
do_check_eq(folderNode.title, this._testRootTitle);
folderNode.QueryInterface(Ci.nsINavHistoryQueryResultNode);
folderNode.containerOpen = true;
// |_count| folders + the query node
- do_check_eq(folderNode.childCount, this._count+3);
+ do_check_eq(folderNode.childCount, this._count + 3);
for (let i = 0; i < this._count; i++) {
var subFolder = folderNode.getChild(i);
- do_check_eq(subFolder.title, "folder"+i);
+ do_check_eq(subFolder.title, "folder" + i);
subFolder.QueryInterface(Ci.nsINavHistoryContainerResultNode);
subFolder.containerOpen = true;
do_check_eq(subFolder.childCount, 1);
var child = subFolder.getChild(0);
- do_check_eq(child.title, "bookmark"+i);
+ do_check_eq(child.title, "bookmark" + i);
do_check_true(uri(child.uri).equals(uri("http://" + i)))
}
// validate folder shortcut
this.validateQueryNode1(folderNode.getChild(this._count));
// validate folders query
this.validateQueryNode2(folderNode.getChild(this._count + 1));
--- a/toolkit/components/places/tests/bookmarks/test_417228-exclude-from-backup.js
+++ b/toolkit/components/places/tests/bookmarks/test_417228-exclude-from-backup.js
@@ -72,17 +72,17 @@ var test = {
false, false).root;
if (!aEmptyBookmarks) {
// since restore does not remove backup exclude items both
// roots should still exist.
do_check_eq(rootNode.childCount, PLACES_ROOTS_COUNT + 2);
// open exclude root and check it still contains one item
var restoreRootIndex = PLACES_ROOTS_COUNT;
- var excludeRootIndex = PLACES_ROOTS_COUNT+1;
+ var excludeRootIndex = PLACES_ROOTS_COUNT + 1;
var excludeRootNode = rootNode.getChild(excludeRootIndex);
do_check_eq(this._excludeRootTitle, excludeRootNode.title);
excludeRootNode.QueryInterface(Ci.nsINavHistoryQueryResultNode);
excludeRootNode.containerOpen = true;
do_check_eq(excludeRootNode.childCount, 1);
var excludeRootChildNode = excludeRootNode.getChild(0);
do_check_eq(excludeRootChildNode.uri, this._restoreRootExcludeURI.spec);
excludeRootNode.containerOpen = false;
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks.js
@@ -259,17 +259,17 @@ add_task(function* test_bookmarks() {
do_check_eq(bookmarksObserver._itemAddedIndex, 0);
// change item
bs.setItemTitle(newId5, "ESPN");
do_check_eq(bookmarksObserver._itemChangedId, newId5);
do_check_eq(bookmarksObserver._itemChangedProperty, "title");
// insert query item
- let uri6 = uri("place:domain=google.com&type="+
+ let uri6 = uri("place:domain=google.com&type=" +
Ci.nsINavHistoryQueryOptions.RESULTS_AS_SITE_QUERY);
let newId6 = bs.insertBookmark(testRoot, uri6, bs.DEFAULT_INDEX, "");
do_check_eq(bookmarksObserver._itemAddedParent, testRoot);
do_check_eq(bookmarksObserver._itemAddedIndex, 3);
// change item
bs.setItemTitle(newId6, "Google Sites");
do_check_eq(bookmarksObserver._itemChangedProperty, "title");
@@ -301,17 +301,17 @@ add_task(function* test_bookmarks() {
do_check_neq(bs.getIdForItemAt(testRoot, 0), workFolder);
// check the last item from within the old parent folder
do_check_neq(bs.getIdForItemAt(testRoot, -1), workFolder);
// check the index of the item within the new parent folder
do_check_eq(bs.getIdForItemAt(homeFolder, 1), workFolder);
// try to get index of the last item within the new parent folder
do_check_eq(bs.getIdForItemAt(homeFolder, -1), workFolder);
// XXX expose FolderCount, and check that the old parent has one less child?
- do_check_eq(getChildCount(testRoot), oldParentCC-1);
+ do_check_eq(getChildCount(testRoot), oldParentCC - 1);
// move item, appending, to different folder
bs.moveItem(newId5, testRoot, bs.DEFAULT_INDEX);
do_check_eq(bookmarksObserver._itemMovedId, newId5);
do_check_eq(bookmarksObserver._itemMovedOldParent, homeFolder);
do_check_eq(bookmarksObserver._itemMovedOldIndex, 0);
do_check_eq(bookmarksObserver._itemMovedNewParent, testRoot);
do_check_eq(bookmarksObserver._itemMovedNewIndex, 3);
@@ -374,17 +374,17 @@ add_task(function* test_bookmarks() {
query = hs.getNewQuery();
query.setFolders([testRoot], 1);
let result = hs.executeQuery(query, options);
let rootNode = result.root;
rootNode.containerOpen = true;
let cc = rootNode.childCount;
do_print("bookmark itemId test: CC = " + cc);
do_check_true(cc > 0);
- for (let i=0; i < cc; ++i) {
+ for (let i = 0; i < cc; ++i) {
let node = rootNode.getChild(i);
if (node.type == node.RESULT_TYPE_FOLDER ||
node.type == node.RESULT_TYPE_URI ||
node.type == node.RESULT_TYPE_SEPARATOR ||
node.type == node.RESULT_TYPE_QUERY) {
do_check_true(node.itemId > 0);
}
else {
--- a/toolkit/components/places/tests/bookmarks/test_bookmarks_notifications.js
+++ b/toolkit/components/places/tests/bookmarks/test_bookmarks_notifications.js
@@ -501,17 +501,17 @@ function expectNotifications() {
}
if (name.startsWith("onItem")) {
return (...origArgs) => {
let args = Array.from(origArgs, arg => {
if (arg && arg instanceof Ci.nsIURI)
return new URL(arg.spec);
if (arg && typeof(arg) == "number" && arg >= Date.now() * 1000)
- return new Date(parseInt(arg/1000));
+ return new Date(parseInt(arg / 1000));
return arg;
});
notifications.push({ name: name, arguments: args });
}
}
if (name in target)
return target[name];
--- a/toolkit/components/places/tests/bookmarks/test_keywords.js
+++ b/toolkit/components/places/tests/bookmarks/test_keywords.js
@@ -46,17 +46,17 @@ function expectNotifications() {
if (name.startsWith("onItemChanged")) {
return function(id, prop, isAnno, val, lastMod, itemType, parentId, guid, parentGuid, oldVal) {
if (prop != "keyword")
return;
let args = Array.from(arguments, arg => {
if (arg && arg instanceof Ci.nsIURI)
return new URL(arg.spec);
if (arg && typeof(arg) == "number" && arg >= Date.now() * 1000)
- return new Date(parseInt(arg/1000));
+ return new Date(parseInt(arg / 1000));
return arg;
});
notifications.push({ name: name, arguments: args });
}
}
return target[name];
}
--- a/toolkit/components/places/tests/browser/browser_colorAnalyzer.js
+++ b/toolkit/components/places/tests/browser/browser_colorAnalyzer.js
@@ -223,19 +223,19 @@ add_task(function* test_interestingColor
ctx.fillRect(3, 3, 3, 2);
}, 0xFF0000, "interestingColorPreferenceNotTooLenient analysis returns red");
});
var maxPixels = 144; // see ColorAnalyzer MAXIMUM_PIXELS const
// make sure that images larger than maxPixels*maxPixels fail
add_task(function* test_imageTooLarge() {
- yield canvasTest(1+maxPixels, 1+maxPixels, function(ctx) {
+ yield canvasTest(1 + maxPixels, 1 + maxPixels, function(ctx) {
ctx.fillStyle = "red";
- ctx.fillRect(0, 0, 1+maxPixels, 1+maxPixels);
+ ctx.fillRect(0, 0, 1 + maxPixels, 1 + maxPixels);
}, null, "imageTooLarge analysis fails");
});
// the rest of the tests are for coverage of "real" favicons
// exact color isn't terribly important, just make sure it's reasonable
const filePrefix = getRootDirectory(gTestPath) + "colorAnalyzer/";
add_task(function* test_categoryDiscover() {
--- a/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js
+++ b/toolkit/components/places/tests/browser/browser_favicon_setAndFetchFaviconForPage.js
@@ -6,17 +6,17 @@
function test() {
// Initialization
waitForExplicitFinish();
let windowsToClose = [];
let testURI = "https://www.mozilla.org/en-US/";
let favIconLocation =
"http://example.org/tests/toolkit/components/places/tests/browser/favicon-normal32.png";
let favIconURI = NetUtil.newURI(favIconLocation);
- let favIconMimeType= "image/png";
+ let favIconMimeType = "image/png";
let pageURI;
let favIconData;
function testOnWindow(aOptions, aCallback) {
whenNewWindowLoaded(aOptions, function(aWin) {
windowsToClose.push(aWin);
executeSoon(() => aCallback(aWin));
});
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteURI.js
@@ -48,17 +48,17 @@ function run_test() {
add_task(function* test_notifications_onDeleteURI() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
// Expire anything that is expirable.
setMaxPages(0);
for (let testIndex = 1; testIndex <= tests.length; testIndex++) {
- let currentTest = tests[testIndex -1];
+ let currentTest = tests[testIndex - 1];
print("\nTEST " + testIndex + ": " + currentTest.desc);
currentTest.receivedNotifications = 0;
// Setup visits.
let now = getExpirablePRTime();
for (let i = 0; i < currentTest.addPages; i++) {
let page = "http://" + testIndex + "." + i + ".mozilla.org/";
yield PlacesTestUtils.addVisits({ uri: uri(page), visitDate: now++ });
--- a/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
+++ b/toolkit/components/places/tests/expiration/test_notifications_onDeleteVisits.js
@@ -65,17 +65,17 @@ function run_test() {
add_task(function* test_notifications_onDeleteVisits() {
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
// Expire anything that is expirable.
setMaxPages(0);
for (let testIndex = 1; testIndex <= tests.length; testIndex++) {
- let currentTest = tests[testIndex -1];
+ let currentTest = tests[testIndex - 1];
print("\nTEST " + testIndex + ": " + currentTest.desc);
currentTest.receivedNotifications = 0;
// Setup visits.
let timeInMicroseconds = getExpirablePRTime(8);
function newTimeInMicroseconds() {
timeInMicroseconds = timeInMicroseconds + 1000;
--- a/toolkit/components/places/tests/expiration/test_pref_maxpages.js
+++ b/toolkit/components/places/tests/expiration/test_pref_maxpages.js
@@ -71,17 +71,17 @@ add_task(function* test_pref_maxpages()
do_throw("interval pref should not exist by default");
}
catch (ex) {}
// Set interval to a large value so we don't expire on it.
setInterval(3600); // 1h
for (let testIndex = 1; testIndex <= tests.length; testIndex++) {
- let currentTest = tests[testIndex -1];
+ let currentTest = tests[testIndex - 1];
print("\nTEST " + testIndex + ": " + currentTest.desc);
currentTest.receivedNotifications = 0;
// Setup visits.
let now = getExpirablePRTime();
for (let i = 0; i < currentTest.addPages; i++) {
let page = "http://" + testIndex + "." + i + ".mozilla.org/";
yield PlacesTestUtils.addVisits({ uri: uri(page), visitDate: now++ });
--- a/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
+++ b/toolkit/components/places/tests/favicons/test_replaceFaviconDataFromDataURL.js
@@ -324,28 +324,28 @@ const toBase64Table = 'ABCDEFGHIJKLMNOPQ
const base64Pad = '=';
function toBase64(data) {
let result = '';
let length = data.length;
let i;
// Convert every three bytes to 4 ascii characters.
for (i = 0; i < (length - 2); i += 3) {
result += toBase64Table[data[i] >> 2];
- result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)];
- result += toBase64Table[((data[i+1] & 0x0f) << 2) + (data[i+2] >> 6)];
- result += toBase64Table[data[i+2] & 0x3f];
+ result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
+ result += toBase64Table[((data[i + 1] & 0x0f) << 2) + (data[i + 2] >> 6)];
+ result += toBase64Table[data[i + 2] & 0x3f];
}
// Convert the remaining 1 or 2 bytes, pad out to 4 characters.
- if (length%3) {
- i = length - (length%3);
+ if (length % 3) {
+ i = length - (length % 3);
result += toBase64Table[data[i] >> 2];
- if ((length%3) == 2) {
- result += toBase64Table[((data[i] & 0x03) << 4) + (data[i+1] >> 4)];
- result += toBase64Table[(data[i+1] & 0x0f) << 2];
+ if ((length % 3) == 2) {
+ result += toBase64Table[((data[i] & 0x03) << 4) + (data[i + 1] >> 4)];
+ result += toBase64Table[(data[i + 1] & 0x0f) << 2];
result += base64Pad;
} else {
result += toBase64Table[(data[i] & 0x03) << 4];
result += base64Pad + base64Pad;
}
}
return result;
--- a/toolkit/components/places/tests/head_common.js
+++ b/toolkit/components/places/tests/head_common.js
@@ -213,17 +213,17 @@ function compareArrays(aArray1, aArray2)
if (aArray1.length != aArray2.length) {
print("compareArrays: array lengths differ\n");
return false;
}
for (let i = 0; i < aArray1.length; i++) {
if (aArray1[i] != aArray2[i]) {
print("compareArrays: arrays differ at index " + i + ": " +
- "(" + aArray1[i] + ") != (" + aArray2[i] +")\n");
+ "(" + aArray1[i] + ") != (" + aArray2[i] + ")\n");
return false;
}
}
return true;
}
--- a/toolkit/components/places/tests/queries/head_queries.js
+++ b/toolkit/components/places/tests/queries/head_queries.js
@@ -200,27 +200,27 @@ function* task_populateDB(aArray)
* resulting query.
* Its parameter is an object specifying which attributes you want to set.
* For ex:
* var myobj = new queryData({isVisit: true, uri:"http://mozilla.com", title="foo"});
* Note that it doesn't do any input checking on that object.
*/
function queryData(obj) {
this.isVisit = obj.isVisit ? obj.isVisit : false;
- this.isBookmark = obj.isBookmark ? obj.isBookmark: false;
+ this.isBookmark = obj.isBookmark ? obj.isBookmark : false;
this.uri = obj.uri ? obj.uri : "";
this.lastVisit = obj.lastVisit ? obj.lastVisit : today;
this.referrer = obj.referrer ? obj.referrer : null;
this.transType = obj.transType ? obj.transType : Ci.nsINavHistoryService.TRANSITION_TYPED;
this.isRedirect = obj.isRedirect ? obj.isRedirect : false;
this.isDetails = obj.isDetails ? obj.isDetails : false;
this.title = obj.title ? obj.title : "";
this.markPageAsTyped = obj.markPageAsTyped ? obj.markPageAsTyped : false;
this.isPageAnnotation = obj.isPageAnnotation ? obj.isPageAnnotation : false;
- this.removeAnnotation= obj.removeAnnotation ? true : false;
+ this.removeAnnotation = obj.removeAnnotation ? true : false;
this.annoName = obj.annoName ? obj.annoName : "";
this.annoVal = obj.annoVal ? obj.annoVal : "";
this.annoFlags = obj.annoFlags ? obj.annoFlags : 0;
this.annoExpiration = obj.annoExpiration ? obj.annoExpiration : 0;
this.isItemAnnotation = obj.isItemAnnotation ? obj.isItemAnnotation : false;
this.itemId = obj.itemId ? obj.itemId : 0;
this.annoMimeType = obj.annoMimeType ? obj.annoMimeType : "";
this.isTag = obj.isTag ? obj.isTag : false;
@@ -328,17 +328,17 @@ function isInResult(aQueryData, aRoot) {
// If we have an array, pluck out the first item. If an object, pluc out the
// URI, we just compare URI's here.
if ("uri" in aQueryData) {
uri = aQueryData.uri;
} else {
uri = aQueryData[0].uri;
}
- for (var i=0; i < aRoot.childCount; i++) {
+ for (var i = 0; i < aRoot.childCount; i++) {
if (uri == aRoot.getChild(i).uri) {
rv = true;
break;
}
}
if (!wasOpen)
aRoot.containerOpen = false;
return rv;
@@ -356,15 +356,15 @@ function displayResultSet(aRoot) {
aRoot.containerOpen = true;
if (!aRoot.hasChildren) {
// Something wrong? Empty result set?
do_print("Result Set Empty");
return;
}
- for (var i=0; i < aRoot.childCount; ++i) {
+ for (var i = 0; i < aRoot.childCount; ++i) {
do_print("Result Set URI: " + aRoot.getChild(i).uri + " Title: " +
aRoot.getChild(i).title + " Visit Time: " + aRoot.getChild(i).time);
}
if (!wasOpen)
aRoot.containerOpen = false;
}
--- a/toolkit/components/places/tests/queries/test_abstime-annotation-domain.js
+++ b/toolkit/components/places/tests/queries/test_abstime-annotation-domain.js
@@ -17,17 +17,17 @@ var beginTime = beginTimeDate.getTime();
var endTime = endTimeDate.getTime();
// Some range dates inside our query - mult by 1000 to convert to PRTIME
var jan7_800 = (beginTime + DAY_MSEC) * 1000;
var jan6_815 = (beginTime + (MIN_MSEC * 15)) * 1000;
var jan11_800 = (beginTime + (DAY_MSEC * 5)) * 1000;
var jan14_2130 = (endTime - DAY_MSEC) * 1000;
var jan15_2045 = (endTime - (MIN_MSEC * 45)) * 1000;
-var jan12_1730 = (endTime - (DAY_MSEC * 3) - (HOUR_MSEC*4)) * 1000;
+var jan12_1730 = (endTime - (DAY_MSEC * 3) - (HOUR_MSEC * 4)) * 1000;
// Dates outside our query - mult by 1000 to convert to PRTIME
var jan6_700 = (beginTime - HOUR_MSEC) * 1000;
var jan5_800 = (beginTime - DAY_MSEC) * 1000;
var dec27_800 = (beginTime - (DAY_MSEC * 10)) * 1000;
var jan15_2145 = (endTime + (MIN_MSEC * 15)) * 1000;
var jan16_2130 = (endTime + (DAY_MSEC)) * 1000;
var jan25_2130 = (endTime + (DAY_MSEC * 10)) * 1000;
--- a/toolkit/components/places/tests/queries/test_abstime-annotation-uri.js
+++ b/toolkit/components/places/tests/queries/test_abstime-annotation-uri.js
@@ -17,17 +17,17 @@ var beginTime = beginTimeDate.getTime();
var endTime = endTimeDate.getTime();
// Some range dates inside our query - mult by 1000 to convert to PRTIME
var jan7_800 = (beginTime + DAY_MSEC) * 1000;
var jan6_815 = (beginTime + (MIN_MSEC * 15)) * 1000;
var jan11_800 = (beginTime + (DAY_MSEC * 5)) * 1000;
var jan14_2130 = (endTime - DAY_MSEC) * 1000;
var jan15_2045 = (endTime - (MIN_MSEC * 45)) * 1000;
-var jan12_1730 = (endTime - (DAY_MSEC * 3) - (HOUR_MSEC*4)) * 1000;
+var jan12_1730 = (endTime - (DAY_MSEC * 3) - (HOUR_MSEC * 4)) * 1000;
// Dates outside our query - mult by 1000 to convert to PRTIME
var jan6_700 = (beginTime - HOUR_MSEC) * 1000;
var jan5_800 = (beginTime - DAY_MSEC) * 1000;
var dec27_800 = (beginTime - (DAY_MSEC * 10)) * 1000;
var jan15_2145 = (endTime + (MIN_MSEC * 15)) * 1000;
var jan16_2130 = (endTime + (DAY_MSEC)) * 1000;
var jan25_2130 = (endTime + (DAY_MSEC * 10)) * 1000;
--- a/toolkit/components/places/tests/queries/test_results-as-visit.js
+++ b/toolkit/components/places/tests/queries/test_results-as-visit.js
@@ -56,34 +56,34 @@ add_task(function* test_results_as_visit
options.resultType = options.RESULTS_AS_VISIT;
// Results
var result = PlacesUtils.history.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
do_print("Number of items in result set: " + root.childCount);
- for (let i=0; i < root.childCount; ++i) {
+ for (let i = 0; i < root.childCount; ++i) {
do_print("result: " + root.getChild(i).uri + " Title: " + root.getChild(i).title);
}
// Check our inital result set
compareArrayToResult(testData, root);
// If that passes, check liveupdate
// Add to the query set
do_print("Adding item to query")
var tmp = [];
- for (let i=0; i < 2; i++) {
+ for (let i = 0; i < 2; i++) {
tmp.push({ isVisit: true,
uri: "http://foo.com/added.html",
title: "ab moz" });
}
yield task_populateDB(tmp);
- for (let i=0; i < 2; i++)
+ for (let i = 0; i < 2; i++)
do_check_eq(root.getChild(i).title, "ab moz");
// Update an existing URI
do_print("Updating Item");
var change2 = [{ isVisit: true,
title: "moz",
uri: "http://foo.mail.com/changeme2.html" }];
yield task_populateDB(change2);
--- a/toolkit/components/places/tests/queries/test_searchterms-domain.js
+++ b/toolkit/components/places/tests/queries/test_searchterms-domain.js
@@ -74,17 +74,17 @@ add_task(function* test_searchterms_doma
options.resultType = options.RESULTS_AS_URI;
// Results
var result = PlacesUtils.history.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
do_print("Number of items in result set: " + root.childCount);
- for (var i=0; i < root.childCount; ++i) {
+ for (var i = 0; i < root.childCount; ++i) {
do_print("result: " + root.getChild(i).uri + " Title: " + root.getChild(i).title);
}
// Check our inital result set
compareArrayToResult(testData, root);
// If that passes, check liveupdate
// Add to the query set
--- a/toolkit/components/places/tests/queries/test_searchterms-uri.js
+++ b/toolkit/components/places/tests/queries/test_searchterms-uri.js
@@ -59,17 +59,17 @@ add_task(function* test_searchterms_uri(
options.resultType = options.RESULTS_AS_URI;
// Results
var result = PlacesUtils.history.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
do_print("Number of items in result set: " + root.childCount);
- for (var i=0; i < root.childCount; ++i) {
+ for (var i = 0; i < root.childCount; ++i) {
do_print("result: " + root.getChild(i).uri + " Title: " + root.getChild(i).title);
}
// Check our inital result set
compareArrayToResult(testData, root);
// live update.
do_print("change title");
--- a/toolkit/components/places/tests/queries/test_tags.js
+++ b/toolkit/components/places/tests/queries/test_tags.js
@@ -11,17 +11,17 @@
"use strict";
add_task(function* tags_getter_setter() {
do_print("Tags getter/setter should work correctly");
do_print("Without setting tags, tags getter should return empty array");
var [query, dummy] = makeQuery();
do_check_eq(query.tags.length, 0);
- do_print("Setting tags to an empty array, tags getter should return "+
+ do_print("Setting tags to an empty array, tags getter should return " +
"empty array");
[query, dummy] = makeQuery([]);
do_check_eq(query.tags.length, 0);
do_print("Setting a few tags, tags getter should return correct array");
var tags = ["bar", "baz", "foo"];
[query, dummy] = makeQuery(tags);
setsAreEqual(query.tags, tags, true);
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -280,25 +280,25 @@ var addBookmark = Task.async(function* (
});
}
if (aBookmarkObj.tags) {
PlacesUtils.tagging.tagURI(aBookmarkObj.uri, aBookmarkObj.tags);
}
});
-function addOpenPages(aUri, aCount=1, aUserContextId=0) {
+function addOpenPages(aUri, aCount = 1, aUserContextId = 0) {
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Ci.mozIPlacesAutoComplete);
for (let i = 0; i < aCount; i++) {
ac.registerOpenPage(aUri, aUserContextId);
}
}
-function removeOpenPages(aUri, aCount=1, aUserContextId=0) {
+function removeOpenPages(aUri, aCount = 1, aUserContextId = 0) {
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Ci.mozIPlacesAutoComplete);
for (let i = 0; i < aCount; i++) {
ac.unregisterOpenPage(aUri, aUserContextId);
}
}
function changeRestrict(aType, aChar) {
@@ -423,24 +423,24 @@ function setFaviconForHref(href, iconHre
true,
PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE,
resolve,
Services.scriptSecurityManager.getSystemPrincipal()
);
});
}
-function makeTestServer(port=-1) {
+function makeTestServer(port = -1) {
let httpServer = new HttpServer();
httpServer.start(port);
do_register_cleanup(() => httpServer.stop(() => {}));
return httpServer;
}
-function* addTestEngine(basename, httpServer=undefined) {
+function* addTestEngine(basename, httpServer = undefined) {
httpServer = httpServer || makeTestServer();
httpServer.registerDirectory("/", do_get_cwd());
let dataUrl =
"http://localhost:" + httpServer.identity.primaryPort + "/data/";
do_print("Adding engine: " + basename);
return yield new Promise(resolve => {
Services.obs.addObserver(function obs(subject, topic, data) {
--- a/toolkit/components/places/tests/unit/test_000_frecency.js
+++ b/toolkit/components/places/tests/unit/test_000_frecency.js
@@ -122,17 +122,17 @@ function* task_initializeBucket(bucket)
calculatedURI = uri("http://" + searchTerm + ".com/" +
bonusName + ":" + bonusValue + "/cutoff:" + cutoff +
"/weight:" + weight + "/frecency:" + frecency);
if (visitType == Ci.nsINavHistoryService.TRANSITION_BOOKMARK) {
matchTitle = searchTerm + "Bookmarked";
bmsvc.insertBookmark(bmsvc.unfiledBookmarksFolder, calculatedURI, bmsvc.DEFAULT_INDEX, matchTitle);
}
else
- matchTitle = calculatedURI.spec.substr(calculatedURI.spec.lastIndexOf("/")+1);
+ matchTitle = calculatedURI.spec.substr(calculatedURI.spec.lastIndexOf("/") + 1);
yield PlacesTestUtils.addVisits({
uri: calculatedURI,
transition: visitType,
visitDate: dateInPeriod
});
}
if (calculatedURI && frecency) {
--- a/toolkit/components/places/tests/unit/test_385397.js
+++ b/toolkit/components/places/tests/unit/test_385397.js
@@ -76,17 +76,17 @@ add_task(function* test_execute()
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
options.resultType = options.RESULTS_AS_VISIT;
root = PlacesUtils.history.executeQuery(PlacesUtils.history.getNewQuery(),
options).root;
root.containerOpen = true;
cc = root.childCount;
// 2 * TOTAL_SITES because we count the TYPED and LINK, but not EMBED or FRAMED
do_check_eq(cc, 2 * TOTAL_SITES);
- for (let i=0; i < TOTAL_SITES; i++) {
+ for (let i = 0; i < TOTAL_SITES; i++) {
let index = i * 2;
let node = root.getChild(index);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
node = root.getChild(++index);
do_check_eq(node.uri, site);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
@@ -104,17 +104,17 @@ add_task(function* test_execute()
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
options.maxResults = 10;
options.resultType = options.RESULTS_AS_URI;
root = PlacesUtils.history.executeQuery(PlacesUtils.history.getNewQuery(),
options).root;
root.containerOpen = true;
cc = root.childCount;
do_check_eq(cc, options.maxResults);
- for (let i=0; i < cc; i++) {
+ for (let i = 0; i < cc; i++) {
let node = root.getChild(i);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
// test without a maxResults, which executes a different query
@@ -127,16 +127,16 @@ add_task(function* test_execute()
options = PlacesUtils.history.getNewQueryOptions();
options.sortingMode = options.SORT_BY_DATE_DESCENDING;
options.resultType = options.RESULTS_AS_URI;
root = PlacesUtils.history.executeQuery(PlacesUtils.history.getNewQuery(),
options).root;
root.containerOpen = true;
cc = root.childCount;
do_check_eq(cc, TOTAL_SITES);
- for (let i=0; i < 10; i++) {
+ for (let i = 0; i < 10; i++) {
let node = root.getChild(i);
let site = "http://www.test-" + (TOTAL_SITES - 1 - i) + ".com/";
do_check_eq(node.uri, site);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
}
root.containerOpen = false;
});
--- a/toolkit/components/places/tests/unit/test_408221.js
+++ b/toolkit/components/places/tests/unit/test_408221.js
@@ -87,17 +87,17 @@ function ensure_tag_results(uris, search
};
input.onSearchComplete = function() {
do_check_eq(numSearchesStarted, 1);
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
do_check_eq(controller.matchCount, uris.length);
let vals = [];
- for (let i=0; i<controller.matchCount; i++) {
+ for (let i = 0; i < controller.matchCount; i++) {
// Keep the URL for later because order of tag results is undefined
vals.push(controller.getValueAt(i));
do_check_eq(controller.getStyleAt(i), "bookmark-tag");
}
// Sort the results then check if we have the right items
vals.sort().forEach((val, i) => do_check_eq(val, uris[i].spec))
if (current_test < (tests.length - 1)) {
--- a/toolkit/components/places/tests/unit/test_419792_node_tags_property.js
+++ b/toolkit/components/places/tests/unit/test_419792_node_tags_property.js
@@ -22,17 +22,17 @@ function run_test() {
toolbarNode.containerOpen = true;
// add a bookmark
var bookmarkURI = uri("http://foo.com");
var bookmarkId = bmsvc.insertBookmark(bmsvc.toolbarFolder, bookmarkURI,
bmsvc.DEFAULT_INDEX, "");
// get the node for the new bookmark
- var node = toolbarNode.getChild(toolbarNode.childCount-1);
+ var node = toolbarNode.getChild(toolbarNode.childCount - 1);
do_check_eq(node.itemId, bookmarkId);
// confirm there's no tags via the .tags property
do_check_eq(node.tags, null);
// add a tag
tagssvc.tagURI(bookmarkURI, ["foo"]);
do_check_eq(node.tags, "foo");
--- a/toolkit/components/places/tests/unit/test_429505_remove_shortcuts.js
+++ b/toolkit/components/places/tests/unit/test_429505_remove_shortcuts.js
@@ -24,12 +24,12 @@ function run_test() {
uri("place:folder=" + folderId), IDX, "");
var root = PlacesUtils.getFolderContents(PlacesUtils.toolbarFolderId, false, true).root;
var oldCount = root.childCount;
PlacesUtils.bookmarks.removeItem(queryId);
- do_check_eq(root.childCount, oldCount-1);
+ do_check_eq(root.childCount, oldCount - 1);
root.containerOpen = false;
}
--- a/toolkit/components/places/tests/unit/test_annotations.js
+++ b/toolkit/components/places/tests/unit/test_annotations.js
@@ -8,17 +8,17 @@
try {
var bmsvc = Cc["@mozilla.org/browser/nav-bookmarks-service;1"].getService(Ci.nsINavBookmarksService);
} catch (ex) {
do_throw("Could not get nav-bookmarks-service\n");
}
// Get annotation service
try {
- var annosvc= Cc["@mozilla.org/browser/annotation-service;1"].getService(Ci.nsIAnnotationService);
+ var annosvc = Cc["@mozilla.org/browser/annotation-service;1"].getService(Ci.nsIAnnotationService);
} catch (ex) {
do_throw("Could not get annotation service\n");
}
var annoObserver = {
PAGE_lastSet_URI: "",
PAGE_lastSet_AnnoName: "",
--- a/toolkit/components/places/tests/unit/test_frecency.js
+++ b/toolkit/components/places/tests/unit/test_frecency.js
@@ -94,17 +94,17 @@ function ensure_results_internal(uris, s
do_check_eq(numSearchesStarted, 1);
};
input.onSearchComplete = function() {
do_check_eq(numSearchesStarted, 1);
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
do_check_eq(controller.matchCount, uris.length);
- for (var i=0; i<controller.matchCount; i++) {
+ for (var i = 0; i < controller.matchCount; i++) {
do_check_eq(controller.getValueAt(i), uris[i].spec);
}
deferEnsureResults.resolve();
};
controller.startSearch(searchTerm);
}
--- a/toolkit/components/places/tests/unit/test_history.js
+++ b/toolkit/components/places/tests/unit/test_history.js
@@ -52,17 +52,17 @@ add_task(function* test_execute()
// TODO: using full visit crashes in xpcshell test
// options.resultType = options.RESULTS_AS_FULL_VISIT;
options.resultType = options.RESULTS_AS_VISIT;
var query = histsvc.getNewQuery();
var result = histsvc.executeQuery(query, options);
var root = result.root;
root.containerOpen = true;
var cc = root.childCount;
- for (var i=0; i < cc; ++i) {
+ for (var i = 0; i < cc; ++i) {
var node = root.getChild(i);
// test node properties in RESULTS_AS_VISIT
do_check_eq(node.uri, testURI.spec);
do_check_eq(node.type, Ci.nsINavHistoryResultNode.RESULT_TYPE_URI);
// TODO: change query type to RESULTS_AS_FULL_VISIT and test this
// do_check_eq(node.transitionType, histsvc.TRANSITION_TYPED);
}
root.containerOpen = false;
--- a/toolkit/components/places/tests/unit/test_history_autocomplete_tags.js
+++ b/toolkit/components/places/tests/unit/test_history_autocomplete_tags.js
@@ -90,17 +90,17 @@ function ensure_tag_results(uris, search
input.onSearchComplete = function() {
do_check_eq(numSearchesStarted, 1);
do_check_eq(controller.searchStatus,
uris.length ?
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH :
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH);
do_check_eq(controller.matchCount, uris.length);
let vals = [];
- for (let i=0; i<controller.matchCount; i++) {
+ for (let i = 0; i < controller.matchCount; i++) {
// Keep the URL for later because order of tag results is undefined
vals.push(controller.getValueAt(i));
do_check_eq(controller.getStyleAt(i), "bookmark-tag");
}
// Sort the results then check if we have the right items
vals.sort().forEach((val, i) => do_check_eq(val, uris[i].spec))
if (current_test < (tests.length - 1)) {
--- a/toolkit/components/places/tests/unit/test_history_sidebar.js
+++ b/toolkit/components/places/tests/unit/test_history_sidebar.js
@@ -31,17 +31,17 @@ function* task_add_normalized_visit(aURI
dateObj.setSeconds(0);
dateObj.setMilliseconds(0);
// Days where DST changes should be taken in count.
var previousDateObj = new Date(dateObj.getTime() + aDayOffset * 86400000);
var DSTCorrection = (dateObj.getTimezoneOffset() -
previousDateObj.getTimezoneOffset()) * 60 * 1000;
// Substract aDayOffset
var PRTimeWithOffset = (previousDateObj.getTime() - DSTCorrection) * 1000;
- var timeInMs = new Date(PRTimeWithOffset/1000);
+ var timeInMs = new Date(PRTimeWithOffset / 1000);
print("Adding visit to " + aURI.spec + " at " + timeInMs);
yield PlacesTestUtils.addVisits({
uri: aURI,
visitDate: PRTimeWithOffset
});
}
function days_for_x_months_ago(aNowObj, aMonths) {
@@ -49,17 +49,17 @@ function days_for_x_months_ago(aNowObj,
// Set day before month, otherwise we could try to calculate 30 February, or
// other nonexistent days.
oldTime.setDate(1);
oldTime.setMonth(aNowObj.getMonth() - aMonths);
oldTime.setHours(0);
oldTime.setMinutes(0);
oldTime.setSeconds(0);
// Stay larger for eventual timezone issues, add 2 days.
- return parseInt((aNowObj - oldTime) / (1000*60*60*24)) + 2;
+ return parseInt((aNowObj - oldTime) / (1000 * 60 * 60 * 24)) + 2;
}
var nowObj = new Date();
// This test relies on en-US locale
// Offset is number of days
/* eslint-disable comma-spacing */
var containers = [
{ label: "Today" , offset: 0 , visible: true },
@@ -82,23 +82,23 @@ var visibleContainers = containers.filte
* 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.
for (let i = 0; i < containers.length; i++) {
let container = containers[i];
- var testURI = uri("http://mirror"+i+".mozilla.com/b");
+ var testURI = uri("http://mirror" + i + ".mozilla.com/b");
yield task_add_normalized_visit(testURI, nowObj.getTime(), container.offset);
- testURI = uri("http://mirror"+i+".mozilla.com/a");
+ testURI = uri("http://mirror" + i + ".mozilla.com/a");
yield task_add_normalized_visit(testURI, nowObj.getTime(), container.offset);
- testURI = uri("http://mirror"+i+".google.com/b");
+ testURI = uri("http://mirror" + i + ".google.com/b");
yield task_add_normalized_visit(testURI, nowObj.getTime(), container.offset);
- testURI = uri("http://mirror"+i+".google.com/a");
+ testURI = uri("http://mirror" + i + ".google.com/a");
yield task_add_normalized_visit(testURI, nowObj.getTime(), container.offset);
// Bug 485703 - Hide date containers not containing additional entries
// compared to previous ones.
// Check after every new container is added.
check_visit(container.offset);
}
var options = hs.getNewQueryOptions();
--- a/toolkit/components/places/tests/unit/test_keywords.js
+++ b/toolkit/components/places/tests/unit/test_keywords.js
@@ -58,17 +58,17 @@ function expectBookmarkNotifications() {
if (name.startsWith("onItemChanged")) {
return function(itemId, property) {
if (property != "keyword")
return;
let args = Array.from(arguments, arg => {
if (arg && arg instanceof Ci.nsIURI)
return new URL(arg.spec);
if (arg && typeof(arg) == "number" && arg >= Date.now() * 1000)
- return new Date(parseInt(arg/1000));
+ return new Date(parseInt(arg / 1000));
return arg;
});
notifications.push({ name: name, arguments: args });
}
}
if (name in target)
return target[name];
--- a/toolkit/components/places/tests/unit/test_multi_queries.js
+++ b/toolkit/components/places/tests/unit/test_multi_queries.js
@@ -11,17 +11,17 @@
* The URI to add a visit for.
* @param aReferrer
* The referring URI for the given URI. This can be null.
*/
function* add_visit(aURI, aDayOffset, aTransition) {
yield PlacesTestUtils.addVisits({
uri: aURI,
transition: aTransition,
- visitDate: (Date.now() + aDayOffset*86400000) * 1000
+ visitDate: (Date.now() + aDayOffset * 86400000) * 1000
});
}
function run_test()
{
run_next_test();
}
--- a/toolkit/components/places/tests/unit/test_tag_autocomplete_search.js
+++ b/toolkit/components/places/tests/unit/test_tag_autocomplete_search.js
@@ -88,17 +88,17 @@ function ensure_tag_results(results, sea
if (results.length)
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_MATCH);
else
do_check_eq(controller.searchStatus,
Ci.nsIAutoCompleteController.STATUS_COMPLETE_NO_MATCH);
do_check_eq(controller.matchCount, results.length);
- for (var i=0; i<controller.matchCount; i++) {
+ for (var i = 0; i < controller.matchCount; i++) {
do_check_eq(controller.getValueAt(i), results[i]);
}
if (current_test < (tests.length - 1)) {
current_test++;
tests[current_test]();
}
else {
--- a/toolkit/components/printing/content/printPageSetup.js
+++ b/toolkit/components/printing/content/printPageSetup.js
@@ -94,17 +94,17 @@ function setOrientation()
if ((selection == gDialog.portrait && gPageWidth > gPageHeight) ||
(selection == gDialog.landscape && gPageWidth < gPageHeight)) {
// Swap width/height.
var temp = gPageHeight;
gPageHeight = gPageWidth;
gPageWidth = temp;
}
var div = gDoingMetric ? 100 : 10;
- style += "width:" + gPageWidth/div + unitString() + ";height:" + gPageHeight/div + unitString() + ";";
+ style += "width:" + gPageWidth / div + unitString() + ";height:" + gPageHeight / div + unitString() + ";";
gDialog.marginPage.setAttribute( "style", style );
}
// ---------------------------------------------------
function unitString()
{
return (gPrintSettings.paperSizeUnit == gPrintSettingsInterface.kPaperSizeInches) ? "in" : "mm";
}
@@ -120,33 +120,33 @@ function checkMargin( value, max, other
function changeMargin( node )
{
// Correct invalid input.
checkDouble(node);
// Reset the margin height/width for this node.
var val = node.value;
var nodeToStyle;
- var attr="width";
+ var attr = "width";
if ( node == gDialog.topInput ) {
nodeToStyle = gDialog.marginTop;
val = checkMargin( val, gPageHeight, gDialog.bottomInput );
attr = "height";
} else if ( node == gDialog.bottomInput ) {
nodeToStyle = gDialog.marginBottom;
val = checkMargin( val, gPageHeight, gDialog.topInput );
attr = "height";
} else if ( node == gDialog.leftInput ) {
nodeToStyle = gDialog.marginLeft;
val = checkMargin( val, gPageWidth, gDialog.rightInput );
} else {
nodeToStyle = gDialog.marginRight;
val = checkMargin( val, gPageWidth, gDialog.leftInput );
}
- var style = attr + ":" + (val/10) + unitString() + ";";
+ var style = attr + ":" + (val / 10) + unitString() + ";";
nodeToStyle.setAttribute( "style", style );
}
// ---------------------------------------------------
function changeMargins()
{
changeMargin( gDialog.topInput );
changeMargin( gDialog.bottomInput );
@@ -169,17 +169,17 @@ function customize( node )
node.custom = result.value;
}
}
}
// ---------------------------------------------------
function setHeaderFooter( node, value )
{
- node.value= hfValueToId(value);
+ node.value = hfValueToId(value);
if (node.value == 6) {
// Remember current Custom... value.
node.custom = value;
} else {
// Start with empty Custom... value.
node.custom = "";
}
}
@@ -238,17 +238,17 @@ function setPrinterDefaultsForSelectedPr
// First get any defaults from the printer
gPrintService.initPrintSettingsFromPrinter(gPrintSettings.printerName, gPrintSettings);
// now augment them with any values from last time
gPrintService.initPrintSettingsFromPrefs(gPrintSettings, true, gPrintSettingsInterface.kInitSaveAll);
if (gDoDebug) {
- dump("pagesetup/setPrinterDefaultsForSelectedPrinter: printerName='"+gPrintSettings.printerName+"', orientation='"+gPrintSettings.orientation+"'\n");
+ dump("pagesetup/setPrinterDefaultsForSelectedPrinter: printerName='" + gPrintSettings.printerName + "', orientation='" + gPrintSettings.orientation + "'\n");
}
}
// ---------------------------------------------------
function loadDialog()
{
var print_orientation = 0;
var print_margin_top = 0.5;
@@ -262,17 +262,17 @@ function loadDialog()
gPrintService = Components.classes["@mozilla.org/gfx/printsettings-service;1"];
if (gPrintService) {
gPrintService = gPrintService.getService();
if (gPrintService) {
gPrintService = gPrintService.QueryInterface(Components.interfaces.nsIPrintSettingsService);
}
}
} catch (ex) {
- dump("loadDialog: ex="+ex+"\n");
+ dump("loadDialog: ex=" + ex + "\n");
}
setPrinterDefaultsForSelectedPrinter();
gDialog.printBG.checked = gPrintSettings.printBGColors || gPrintSettings.printBGImages;
gDialog.shrinkToFit.checked = gPrintSettings.shrinkToFit;
@@ -293,22 +293,22 @@ function loadDialog()
print_orientation = gPrintSettings.orientation;
print_margin_top = convertMarginInchesToUnits(gPrintSettings.marginTop, gDoingMetric);
print_margin_left = convertMarginInchesToUnits(gPrintSettings.marginLeft, gDoingMetric);
print_margin_right = convertMarginInchesToUnits(gPrintSettings.marginRight, gDoingMetric);
print_margin_bottom = convertMarginInchesToUnits(gPrintSettings.marginBottom, gDoingMetric);
if (gDoDebug) {
- dump("print_orientation "+print_orientation+"\n");
+ dump("print_orientation " + print_orientation + "\n");
- dump("print_margin_top "+print_margin_top+"\n");
- dump("print_margin_left "+print_margin_left+"\n");
- dump("print_margin_right "+print_margin_right+"\n");
- dump("print_margin_bottom "+print_margin_bottom+"\n");
+ dump("print_margin_top " + print_margin_top + "\n");
+ dump("print_margin_left " + print_margin_left + "\n");
+ dump("print_margin_right " + print_margin_right + "\n");
+ dump("print_margin_bottom " + print_margin_bottom + "\n");
}
if (print_orientation == gPrintSettingsInterface.kPortraitOrientation) {
gDialog.orientation.selectedItem = gDialog.portrait;
} else if (print_orientation == gPrintSettingsInterface.kLandscapeOrientation) {
gDialog.orientation.selectedItem = gDialog.landscape;
}
@@ -423,20 +423,20 @@ function onAccept()
if (scaling > 500.0) {
scaling = 500.0;
}
scaling /= 100.0;
gPrintSettings.scaling = scaling;
if (gDoDebug) {
dump("******* Page Setup Accepting ******\n");
- dump("print_margin_top "+gDialog.topInput.value+"\n");
- dump("print_margin_left "+gDialog.leftInput.value+"\n");
- dump("print_margin_right "+gDialog.bottomInput.value+"\n");
- dump("print_margin_bottom "+gDialog.rightInput.value+"\n");
+ dump("print_margin_top " + gDialog.topInput.value + "\n");
+ dump("print_margin_left " + gDialog.leftInput.value + "\n");
+ dump("print_margin_right " + gDialog.bottomInput.value + "\n");
+ dump("print_margin_bottom " + gDialog.rightInput.value + "\n");
}
}
// set return value to "ok"
if (paramBlock) {
paramBlock.SetInt(0, 1);
} else {
dump("*** FATAL ERROR: No paramBlock\n");
--- a/toolkit/components/printing/content/printPreviewProgress.js
+++ b/toolkit/components/printing/content/printPreviewProgress.js
@@ -14,25 +14,25 @@ var printProgress = null;
var targetFile;
var docTitle = "";
var docURL = "";
var progressParams = null;
function ellipseString(aStr, doFront)
{
- if (aStr.length > 3 && (aStr.substr(0, 3) == "..." || aStr.substr(aStr.length-4, 3) == "..."))
+ if (aStr.length > 3 && (aStr.substr(0, 3) == "..." || aStr.substr(aStr.length - 4, 3) == "..."))
return aStr;
var fixedLen = 64;
if (aStr.length <= fixedLen)
return aStr;
if (doFront)
- return "..." + aStr.substr(aStr.length-fixedLen, fixedLen);
+ return "..." + aStr.substr(aStr.length - fixedLen, fixedLen);
return aStr.substr(0, fixedLen) + "...";
}
// all progress notifications are done through the nsIWebProgressListener implementation...
var progressListener = {
onStateChange: function (aWebProgress, aRequest, aStateFlags, aStatus)
@@ -116,17 +116,17 @@ function onUnload()
}
catch (e) {}
}
function getString (stringId) {
// Check if we've fetched this string already.
if (!(stringId in dialog.strings)) {
// Try to get it.
- var elem = document.getElementById( "dialog.strings."+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] = ""; }
--- a/toolkit/components/printing/content/printProgress.js
+++ b/toolkit/components/printing/content/printProgress.js
@@ -15,24 +15,24 @@ var targetFile;
var docTitle = "";
var docURL = "";
var progressParams = null;
var switchUI = true;
function ellipseString(aStr, doFront)
{
- if (aStr.length > 3 && (aStr.substr(0, 3) == "..." || aStr.substr(aStr.length-4, 3) == "...")) {
+ if (aStr.length > 3 && (aStr.substr(0, 3) == "..." || aStr.substr(aStr.length - 4, 3) == "...")) {
return aStr;
}
var fixedLen = 64;
if (aStr.length > fixedLen) {
if (doFront) {
- var endStr = aStr.substr(aStr.length-fixedLen, fixedLen);
+ var endStr = aStr.substr(aStr.length - fixedLen, fixedLen);
return "..." + endStr;
}
var frontStr = aStr.substr(0, fixedLen);
return frontStr + "...";
}
return aStr;
}
@@ -113,17 +113,17 @@ var progressListener = {
}
}
}
// Calculate percentage.
var percent;
if ( aMaxTotalProgress > 0 )
{
- percent = Math.round( (aCurTotalProgress*100)/aMaxTotalProgress );
+ percent = Math.round( (aCurTotalProgress * 100) / aMaxTotalProgress );
if ( percent > 100 )
percent = 100;
dialog.progress.removeAttribute( "mode");
// Advance progress meter.
dialog.progress.setAttribute( "value", percent );
@@ -165,17 +165,17 @@ var progressListener = {
throw Components.results.NS_NOINTERFACE;
}
};
function getString( stringId ) {
// Check if we've fetched this string already.
if (!(stringId in dialog.strings)) {
// Try to get it.
- var elem = document.getElementById( "dialog.strings."+stringId );
+ var elem = document.getElementById( "dialog.strings." + stringId );
try {
if ( elem
&&
elem.childNodes
&&
elem.childNodes[0]
&&
elem.childNodes[0].nodeValue ) {
@@ -190,17 +190,17 @@ function getString( stringId ) {
}
function loadDialog()
{
}
function replaceInsert( text, index, value ) {
var result = text;
- var regExp = new RegExp( "#"+index );
+ var regExp = new RegExp( "#" + index );
result = result.replace( regExp, value );
return result;
}
function onLoad() {
// Set global variables.
printProgress = window.arguments[0];
--- a/toolkit/components/printing/content/printUtils.js
+++ b/toolkit/components/printing/content/printUtils.js
@@ -90,17 +90,17 @@ var PrintUtils = {
PRINTPROMPTSVC.showPageSetup(window, printSettings, null);
if (gSavePrintSettings) {
// Page Setup data is a "native" setting on the Mac
var PSSVC = Components.classes["@mozilla.org/gfx/printsettings-service;1"]
.getService(Components.interfaces.nsIPrintSettingsService);
PSSVC.savePrintSettingsToPrefs(printSettings, true, printSettings.kInitSaveNativeData);
}
} catch (e) {
- dump("showPageSetup "+e+"\n");
+ dump("showPageSetup " + e + "\n");
return false;
}
return true;
},
/**
* Starts the process of printing the contents of a window.
*
@@ -458,17 +458,17 @@ var PrintUtils = {
.getService(Components.interfaces.nsIPrintSettingsService);
if (gPrintSettingsAreGlobal) {
printSettings = PSSVC.globalPrintSettings;
this.setPrinterDefaultsForSelectedPrinter(PSSVC, printSettings);
} else {
printSettings = PSSVC.newPrintSettings;
}
} catch (e) {
- dump("getPrintSettings: "+e+"\n");
+ dump("getPrintSettings: " + e + "\n");
}
return printSettings;
},
// This observer is called once the progress dialog has been "opened"
_obsPP:
{
observe: function(aSubject, aTopic, aData)
@@ -666,17 +666,17 @@ var PrintUtils = {
},
onKeyPressPP: function (aEvent)
{
var closeKey;
try {
closeKey = document.getElementById("key_close")
.getAttribute("key");
- closeKey = aEvent["DOM_VK_"+closeKey];
+ closeKey = aEvent["DOM_VK_" + closeKey];
} catch (e) {}
var isModif = aEvent.ctrlKey || aEvent.metaKey;
// Ctrl-W exits the PP
if (isModif &&
(aEvent.charCode == closeKey || aEvent.charCode == closeKey + 32)) {
PrintUtils.exitPrintPreview();
}
else if (isModif) {
--- a/toolkit/components/printing/content/printdialog.js
+++ b/toolkit/components/printing/content/printdialog.js
@@ -168,17 +168,17 @@ function setPrinterDefaultsForSelectedPr
// First get any defaults from the printer
printService.initPrintSettingsFromPrinter(gPrintSettings.printerName, gPrintSettings);
// now augment them with any values from last time
printService.initPrintSettingsFromPrefs(gPrintSettings, true, gPrintSetInterface.kInitSaveAll);
if (doDebug) {
- dump("setPrinterDefaultsForSelectedPrinter: printerName='"+gPrintSettings.printerName+"', paperName='"+gPrintSettings.paperName+"'\n");
+ dump("setPrinterDefaultsForSelectedPrinter: printerName='" + gPrintSettings.printerName + "', paperName='" + gPrintSettings.paperName + "'\n");
}
}
// ---------------------------------------------------
function displayPropertiesDialog()
{
gPrintSettings.numCopies = dialog.numCopiesInput.value;
try {
@@ -240,35 +240,35 @@ function loadDialog()
print_copies = gPrintSettings.numCopies;
print_frametype = gPrintSettings.printFrameType;
print_howToEnableUI = gPrintSettings.howToEnableFrameUI;
print_selection_radio_enabled = gPrintSettings.GetPrintOptions(gPrintSetInterface.kEnableSelectionRB);
}
if (doDebug) {
dump("loadDialog*********************************************\n");
- dump("print_tofile "+print_tofile+"\n");
- dump("print_frame "+print_frametype+"\n");
- dump("print_howToEnableUI "+print_howToEnableUI+"\n");
- dump("selection_radio_enabled "+print_selection_radio_enabled+"\n");
+ dump("print_tofile " + print_tofile + "\n");
+ dump("print_frame " + print_frametype + "\n");
+ dump("print_howToEnableUI " + print_howToEnableUI + "\n");
+ dump("selection_radio_enabled " + print_selection_radio_enabled + "\n");
}
dialog.printrangeGroup.selectedItem = dialog.allpagesRadio;
if (print_selection_radio_enabled) {
dialog.selectionRadio.removeAttribute("disabled");
} else {
dialog.selectionRadio.setAttribute("disabled", "true");
}
doPrintRange(dialog.rangeRadio.selected);
dialog.frompageInput.value = 1;
dialog.topageInput.value = 1;
dialog.numCopiesInput.value = print_copies;
if (doDebug) {
- dump("print_howToEnableUI: "+print_howToEnableUI+"\n");
+ dump("print_howToEnableUI: " + print_howToEnableUI + "\n");
}
// print frame
if (print_howToEnableUI == gPrintSetInterface.kFrameEnableAll) {
dialog.aslaidoutRadio.removeAttribute("disabled");
dialog.selectedframeRadio.removeAttribute("disabled");
dialog.eachframesepRadio.removeAttribute("disabled");
@@ -351,23 +351,23 @@ function onAccept()
frametype = gPrintSetInterface.kEachFrameSep;
} else {
frametype = gPrintSetInterface.kSelectedFrame;
}
}
gPrintSettings.printFrameType = frametype;
if (doDebug) {
dump("onAccept*********************************************\n");
- dump("frametype "+frametype+"\n");
- dump("numCopies "+gPrintSettings.numCopies+"\n");
- dump("printRange "+gPrintSettings.printRange+"\n");
- dump("printerName "+gPrintSettings.printerName+"\n");
- dump("startPageRange "+gPrintSettings.startPageRange+"\n");
- dump("endPageRange "+gPrintSettings.endPageRange+"\n");
- dump("printToFile "+gPrintSettings.printToFile+"\n");
+ dump("frametype " + frametype + "\n");
+ dump("numCopies " + gPrintSettings.numCopies + "\n");
+ dump("printRange " + gPrintSettings.printRange + "\n");
+ dump("printerName " + gPrintSettings.printerName + "\n");
+ dump("startPageRange " + gPrintSettings.startPageRange + "\n");
+ dump("endPageRange " + gPrintSettings.endPageRange + "\n");
+ dump("printToFile " + gPrintSettings.printToFile + "\n");
}
}
var saveToPrefs = false;
saveToPrefs = gPrefs.getBoolPref("print.save_print_settings");
if (saveToPrefs && printService != null) {
--- a/toolkit/components/printing/content/printjoboptions.js
+++ b/toolkit/components/printing/content/printjoboptions.js
@@ -43,17 +43,17 @@ function isListOfPrinterFeaturesAvailabl
return has_printerfeatures;
}
// ---------------------------------------------------
function getDoubleStr(val, dec)
{
var str = val.toString();
var inx = str.indexOf(".");
- return str.substring(0, inx+dec+1);
+ return str.substring(0, inx + dec + 1);
}
// ---------------------------------------------------
function initDialog()
{
gPrintBundle = document.getElementById("printBundle");
dialog = {};
@@ -97,17 +97,17 @@ paperListElement.prototype =
// remove the menupopup node child of the menulist.
this.paperListElement.removeChild(this.paperListElement.firstChild);
},
appendPaperNames:
function (aDataObject)
{
var popupNode = document.createElement("menupopup");
- for (var i=0;i<aDataObject.length;i++) {
+ for (var i = 0;i < aDataObject.length;i++) {
var paperObj = aDataObject[i];
var itemNode = document.createElement("menuitem");
var label;
try {
label = gPrintBundle.getString(paperObj.name);
}
catch (e) {
/* No name in string bundle ? Then build one manually (this
@@ -135,17 +135,17 @@ function createPaperArrayFromDefaults()
var paperWidths = [ 8.5, 8.5, 7.25, 148.0, 210.0, 287.0, 420.0, 594.0, 841.0];
var paperHeights = [11.0, 14.0, 10.50, 210.0, 297.0, 420.0, 594.0, 841.0, 1189.0];
var paperInches = [true, true, true, false, false, false, false, false, false];
// this is deprecated
var paperEnums = [0, 1, 2, 3, 4, 5, 6, 7, 8];
gPaperArray = new Array();
- for (var i=0;i<paperNames.length;i++) {
+ for (var i = 0;i < paperNames.length;i++) {
var obj = {};
obj.name = paperNames[i];
obj.width = paperWidths[i];
obj.height = paperHeights[i];
obj.inches = paperInches[i];
/* Calculate the width/height in millimeters */
if (paperInches[i]) {
@@ -171,17 +171,17 @@ function createPaperArrayFromPrinterFeat
gPaperArray = new Array();
var numPapers = gPrefs.getIntPref("print.tmp.printerfeatures." + printername + ".paper.count");
if (doDebug) {
dump("processing " + numPapers + " entries...\n");
}
- for (var i=0;i<numPapers;i++) {
+ for (var i = 0;i < numPapers;i++) {
var obj = {};
obj.name = gPrefs.getCharPref("print.tmp.printerfeatures." + printername + ".paper." + i + ".name");
obj.width_mm = gPrefs.getIntPref("print.tmp.printerfeatures." + printername + ".paper." + i + ".width_mm");
obj.height_mm = gPrefs.getIntPref("print.tmp.printerfeatures." + printername + ".paper." + i + ".height_mm");
obj.inches = gPrefs.getBoolPref("print.tmp.printerfeatures." + printername + ".paper." + i + ".is_inch");
/* Calculate the width/height in paper's native units (either inches or millimeters) */
if (obj.inches) {
@@ -245,39 +245,39 @@ function loadDialog()
print_paper_height = gPrintSettings.paperHeight;
print_paper_name = gPrintSettings.paperName;
print_color = gPrintSettings.printInColor;
print_jobtitle = gPrintSettings.title;
}
if (doDebug) {
dump("loadDialog******************************\n");
- dump("paperSizeType "+print_paper_unit+"\n");
- dump("paperWidth "+print_paper_width+"\n");
- dump("paperHeight "+print_paper_height+"\n");
- dump("paperName "+print_paper_name+"\n");
- dump("print_color "+print_color+"\n");
- dump("print_jobtitle "+print_jobtitle+"\n");
+ dump("paperSizeType " + print_paper_unit + "\n");
+ dump("paperWidth " + print_paper_width + "\n");
+ dump("paperHeight " + print_paper_height + "\n");
+ dump("paperName " + print_paper_name + "\n");
+ dump("print_color " + print_color + "\n");
+ dump("print_jobtitle " + print_jobtitle + "\n");
}
createPaperArray();
var paperSelectedInx = 0;
- for (var i=0;i<gPaperArray.length;i++) {
+ for (var i = 0;i < gPaperArray.length;i++) {
if (print_paper_name == gPaperArray[i].name) {
paperSelectedInx = i;
break;
}
}
if (doDebug) {
if (i == gPaperArray.length)
dump("loadDialog: No paper found.\n");
else
- dump("loadDialog: found paper '"+gPaperArray[paperSelectedInx].name+"'.\n");
+ dump("loadDialog: found paper '" + gPaperArray[paperSelectedInx].name + "'.\n");
}
createPaperSizeList(paperSelectedInx);
/* Enable/disable and/or hide/unhide widgets based in the information
* whether the selected printer and/or print module supports the matching
* feature or not */
if (isListOfPrinterFeaturesAvailable()) {
@@ -376,25 +376,25 @@ function onAccept()
gPrintSettings.edgeTop = dialog.topInput.value;
gPrintSettings.edgeBottom = dialog.bottomInput.value;
gPrintSettings.edgeLeft = dialog.leftInput.value;
gPrintSettings.edgeRight = dialog.rightInput.value;
if (doDebug) {
dump("onAccept******************************\n");
- dump("paperSizeUnit "+print_paper_unit+"\n");
- dump("paperWidth "+print_paper_width+"\n");
- dump("paperHeight "+print_paper_height+"\n");
- dump("paperName '"+print_paper_name+"'\n");
+ dump("paperSizeUnit " + print_paper_unit + "\n");
+ dump("paperWidth " + print_paper_width + "\n");
+ dump("paperHeight " + print_paper_height + "\n");
+ dump("paperName '" + print_paper_name + "'\n");
- dump("printInColor "+gPrintSettings.printInColor+"\n");
+ dump("printInColor " + gPrintSettings.printInColor + "\n");
}
} else {
- dump("************ onAccept gPrintSettings: "+gPrintSettings+"\n");
+ dump("************ onAccept gPrintSettings: " + gPrintSettings + "\n");
}
if (paramBlock) {
// set return value to "ok"
paramBlock.SetInt(0, 1);
} else {
dump("*** FATAL ERROR: paramBlock missing\n");
}
--- a/toolkit/components/prompts/src/nsPrompter.js
+++ b/toolkit/components/prompts/src/nsPrompter.js
@@ -190,17 +190,17 @@ var PromptUtilsTemp = {
let flags = authInfo.flags;
if (flags & Ci.nsIAuthInformation.NEED_DOMAIN) {
// Domain is separated from username by a backslash
let idx = username.indexOf("\\");
if (idx == -1) {
authInfo.username = username;
} else {
authInfo.domain = username.substring(0, idx);
- authInfo.username = username.substring(idx+1);
+ authInfo.username = username.substring(idx + 1);
}
} else {
authInfo.username = username;
}
authInfo.password = password;
},
/**
--- a/toolkit/components/prompts/test/test_subresources_prompts.html
+++ b/toolkit/components/prompts/test/test_subresources_prompts.html
@@ -148,17 +148,17 @@ add_task(function* runTestAuth()
yield promptDone;
yield iframe3Loaded;
checkEchoedAuthInfo({user: "mochiuser1", pass: "mochipass1"},
iframe_prompt.contentDocument);
// Cross-origin subresourse test.
// Force parent to not look for tab-modal prompts, as they're not used for auth prompts.
- isTabModal =false;
+ isTabModal = false;
state = {
msg : "http://example.com is requesting your username and password. " +
"WARNING: Your password will not be sent to the website you are currently visiting!",
title : "Authentication Required",
textValue : "",
passValue : "",
iconClass : "authentication-icon question-icon",
titleHidden : true,
--- a/toolkit/components/reader/AboutReader.jsm
+++ b/toolkit/components/reader/AboutReader.jsm
@@ -508,17 +508,17 @@ AboutReader.prototype = {
if (this._luxValues.length < luxValuesSize) {
// Use the first lux value to set the color scheme until our array equals luxValuesSize.
if (this._luxValues.length == 1) {
this._updateColorScheme(newLux);
}
return;
}
// Holds the average of the lux values collected in this._luxValues.
- let averageLuxValue = this._totalLux/luxValuesSize;
+ let averageLuxValue = this._totalLux / luxValuesSize;
this._updateColorScheme(averageLuxValue);
// Pop the oldest value off the array.
let oldLux = this._luxValues.pop();
// Subtract oldLux since it has been discarded from the array.
this._totalLux -= oldLux;
},
@@ -686,17 +686,17 @@ AboutReader.prototype = {
// If the image is at least as wide as the window, make it fill edge-to-edge on mobile.
if (img.naturalWidth >= windowWidth) {
img.setAttribute("moz-reader-full-width", true);
} else {
img.removeAttribute("moz-reader-full-width");
}
// If the image is at least half as wide as the body, center it on desktop.
- if (img.naturalWidth >= bodyWidth/2) {
+ if (img.naturalWidth >= bodyWidth / 2) {
img.setAttribute("moz-reader-center", true);
} else {
img.removeAttribute("moz-reader-center");
}
};
let imgs = this._doc.querySelectorAll(this._BLOCK_IMAGES_SELECTOR);
for (let i = imgs.length; --i >= 0;) {
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -347,17 +347,17 @@ function makeMoveToDeletedStatement(aGui
return null;
}
function generateGUID() {
// string like: "{f60d9eac-9421-4abc-8491-8e8322b063d4}"
let uuid = uuidService.generateUUID().toString();
let raw = ""; // A string with the low bytes set to random values
let bytes = 0;
- for (let i = 1; bytes < 12 ; i+= 2) {
+ for (let i = 1; bytes < 12 ; i += 2) {
// Skip dashes
if (uuid[i] == "-")
i++;
let hexVal = parseInt(uuid[i] + uuid[i + 1], 16);
raw += String.fromCharCode(hexVal);
bytes++;
}
return btoa(raw);
@@ -1012,19 +1012,19 @@ this.FormHistory = {
* with a very similar frecency are bucketed together with an alphabetical sort. This is
* to reduce the amount of moving around by entries while typing.
*/
let query = "/* do not warn (bug 496471): can't use an index */ " +
"SELECT value, " +
"ROUND( " +
"timesUsed / MAX(1.0, (lastUsed - firstUsed) / :timeGroupingSize) * " +
- "MAX(1.0, :maxTimeGroupings - (:now - lastUsed) / :timeGroupingSize) * "+
+ "MAX(1.0, :maxTimeGroupings - (:now - lastUsed) / :timeGroupingSize) * " +
"MAX(1.0, :agedWeight * (firstUsed < :expiryDate)) / " +
- ":bucketSize "+
+ ":bucketSize " +
", 3) AS frecency, " +
boundaryCalc + " AS boundaryBonuses " +
"FROM moz_formhistory " +
"WHERE fieldname=:fieldname " + where +
"ORDER BY ROUND(frecency * boundaryBonuses) DESC, UPPER(value) ASC";
let stmt = dbCreateAsyncStatement(query, params);
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -379,17 +379,17 @@ FormAutoComplete.prototype = {
for (let i = 0; i < entries.length; i++) {
let entry = entries[i];
// Remove results that do not contain the token
// XXX bug 394604 -- .toLowerCase can be wrong for some intl chars
if (searchTokens.some(tok => entry.textLowerCase.indexOf(tok) < 0))
continue;
this._calculateScore(entry, searchString, searchTokens);
this.log("Reusing autocomplete entry '" + entry.text +
- "' (" + entry.frecency +" / " + entry.totalScore + ")");
+ "' (" + entry.frecency + " / " + entry.totalScore + ")");
filteredEntries.push(entry);
}
filteredEntries.sort(sortBytotalScore);
wrappedResult.entries = filteredEntries;
// If we had datalistResults, re-merge them back into the filtered
// entries.
if (datalistResults) {
--- a/toolkit/components/satchel/nsFormHistory.js
+++ b/toolkit/components/satchel/nsFormHistory.js
@@ -425,17 +425,17 @@ FormHistory.prototype = {
/* ---- helpers ---- */
generateGUID : function() {
// string like: "{f60d9eac-9421-4abc-8491-8e8322b063d4}"
let uuid = this.uuidService.generateUUID().toString();
let raw = ""; // A string with the low bytes set to random values
let bytes = 0;
- for (let i = 1; bytes < 12 ; i+= 2) {
+ for (let i = 1; bytes < 12 ; i += 2) {
// Skip dashes
if (uuid[i] == "-")
i++;
let hexVal = parseInt(uuid[i] + uuid[i + 1], 16);
raw += String.fromCharCode(hexVal);
bytes++;
}
return btoa(raw);
--- a/toolkit/components/satchel/test/test_datalist_with_caching.html
+++ b/toolkit/components/satchel/test/test_datalist_with_caching.html
@@ -89,17 +89,17 @@ function waitForMenuChange(expectedCount
}
registerPopupShownListener(popupShownListener);
function checkMenuEntries(expectedValues) {
var actualValues = getMenuEntries();
is(actualValues.length, expectedValues.length, testNum + " Checking length of expected menu");
for (var i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], testNum + " Checking menu entry #"+i);
+ is(actualValues[i], expectedValues[i], testNum + " Checking menu entry #" + i);
}
function* runTests() {
testNum++;
restoreForm();
doKey("down");
yield expectPopup();
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -1051,17 +1051,17 @@ function waitForMenuChange(expectedCount
{
notifyMenuChanged(expectedCount, expectedFirstValue, runTest);
}
function checkMenuEntries(expectedValues, testNumber) {
var actualValues = getMenuEntries();
is(actualValues.length, expectedValues.length, testNumber + " Checking length of expected menu");
for (var i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], testNumber + " Checking menu entry #"+i);
+ is(actualValues[i], expectedValues[i], testNumber + " Checking menu entry #" + i);
}
function startTest() {
setupFormHistory(function() {
runTest();
});
}
--- a/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
@@ -485,17 +485,17 @@ function runTest() {
function waitForMenuChange(expectedCount) {
notifyMenuChanged(expectedCount, null, runTest);
}
function checkMenuEntries(expectedValues, testNumber) {
var actualValues = getMenuEntries();
is(actualValues.length, expectedValues.length, testNumber + " Checking length of expected menu");
for (var i = 0; i < expectedValues.length; i++)
- is(actualValues[i], expectedValues[i], testNumber + " Checking menu entry #"+i);
+ is(actualValues[i], expectedValues[i], testNumber + " Checking menu entry #" + i);
}
function startTest() {
setupFormHistory(runTest);
}
window.onload = startTest;
--- a/toolkit/components/satchel/test/unit/test_autocomplete.js
+++ b/toolkit/components/satchel/test/unit/test_autocomplete.js
@@ -54,18 +54,18 @@ add_test(function test0() {
var bucketSize = prefs.getIntPref("browser.formfill.bucketSize");
// ===== Tests with constant timesUsed and varying lastUsed date =====
// insert 2 records per bucket to check alphabetical sort within
now = 1000 * Date.now();
numRecords = Math.ceil(maxTimeGroupings / bucketSize) * 2;
let changes = [ ];
- for (let i = 0; i < numRecords; i+=2) {
- let useDate = now - (i/2 * bucketSize * timeGroupingSize);
+ for (let i = 0; i < numRecords; i += 2) {
+ let useDate = now - (i / 2 * bucketSize * timeGroupingSize);
changes.push({ op : "add", fieldname: "field1", value: "value" + padLeft(numRecords - 1 - i, 2),
timesUsed: 1, firstUsed: useDate, lastUsed: useDate });
changes.push({ op : "add", fieldname: "field1", value: "value" + padLeft(numRecords - 2 - i, 2),
timesUsed: 1, firstUsed: useDate, lastUsed: useDate });
}
updateFormHistory(changes, run_next_test);
@@ -94,32 +94,32 @@ add_test(function test2() {
});
add_test(function test3() {
do_log_info("Check search result ordering with empty search term");
let lastFound = numRecords;
fac.autoCompleteSearchAsync("field1", "", null, null, null, {
onSearchCompletion : function(aResults) {
- for (let i = 0; i < numRecords; i+=2) {
+ for (let i = 0; i < numRecords; i += 2) {
do_check_eq(parseInt(aResults.getValueAt(i + 1).substr(5), 10), --lastFound);
do_check_eq(parseInt(aResults.getValueAt(i).substr(5), 10), --lastFound);
}
run_next_test();
}
});
});
add_test(function test4() {
do_log_info("Check search result ordering with \"v\"");
let lastFound = numRecords;
fac.autoCompleteSearchAsync("field1", "v", null, null, null, {
onSearchCompletion : function(aResults) {
- for (let i = 0; i < numRecords; i+=2) {
+ for (let i = 0; i < numRecords; i += 2) {
do_check_eq(parseInt(aResults.getValueAt(i + 1).substr(5), 10), --lastFound);
do_check_eq(parseInt(aResults.getValueAt(i).substr(5), 10), --lastFound);
}
run_next_test();
}
});
});
--- a/toolkit/components/search/SearchSuggestionController.jsm
+++ b/toolkit/components/search/SearchSuggestionController.jsm
@@ -167,17 +167,17 @@ this.SearchSuggestionController.prototyp
* Note: If there was no remote results fetched, the fetching cannot be stopped and local results
* will still be returned because stopping relies on aborting the XMLHTTPRequest to reject the
* promise for Promise.all.
*/
stop: function() {
if (this._request) {
this._request.abort();
} else if (!this.maxRemoteResults) {
- Cu.reportError("SearchSuggestionController: Cannot stop fetching if remote results were not "+
+ Cu.reportError("SearchSuggestionController: Cannot stop fetching if remote results were not " +
"requested");
}
this._reset();
},
// Private methods
_fetchFormHistory: function(searchTerm) {
--- a/toolkit/components/search/nsSearchService.js
+++ b/toolkit/components/search/nsSearchService.js
@@ -1951,17 +1951,17 @@ Engine.prototype = {
*/
_parseImage: function SRCH_ENG_parseImage(aElement) {
LOG("_parseImage: Image textContent: \"" + limitURILength(aElement.textContent) + "\"");
let width = parseInt(aElement.getAttribute("width"), 10);
let height = parseInt(aElement.getAttribute("height"), 10);
let isPrefered = width == 16 && height == 16;
- if (isNaN(width) || isNaN(height) || width <= 0 || height <=0) {
+ if (isNaN(width) || isNaN(height) || width <= 0 || height <= 0) {
LOG("OpenSearch image element must have positive width and height.");
return;
}
this._setIcon(aElement.textContent, isPrefered, width, height);
},
/**
@@ -3781,18 +3781,18 @@ SearchService.prototype = {
for (let name in this._engines) {
let engine = this._engines[name];
var orderNumber = engine.getAttr("order");
// Since the DB isn't regularly cleared, and engine files may disappear
// without us knowing, we may already have an engine in this slot. If
// that happens, we just skip it - it will be added later on as an
// unsorted engine.
- if (orderNumber && !this.__sortedEngines[orderNumber-1]) {
- this.__sortedEngines[orderNumber-1] = engine;
+ if (orderNumber && !this.__sortedEngines[orderNumber - 1]) {
+ this.__sortedEngines[orderNumber - 1] = engine;
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
--- a/toolkit/components/search/tests/xpcshell/test_location_sync.js
+++ b/toolkit/components/search/tests/xpcshell/test_location_sync.js
@@ -87,15 +87,15 @@ add_task(function* test_simple() {
deepEqual(snapshot.counts, [1, 0, 0], hid);
break;
case Ci.nsITelemetry.HISTOGRAM_BOOLEAN:
// booleans aren't initialized at all, so should have all zeros.
deepEqual(snapshot.counts, [0, 0, 0], hid);
break;
case Ci.nsITelemetry.HISTOGRAM_EXPONENTIAL:
case Ci.nsITelemetry.HISTOGRAM_LINEAR:
- equal(snapshot.counts.reduce((a, b) => a+b), 0, hid);
+ equal(snapshot.counts.reduce((a, b) => a + b), 0, hid);
break;
default:
ok(false, "unknown histogram type " + snapshot.histogram_type + " for " + hid);
}
}
});
--- a/toolkit/components/startup/tests/unit/head_startup.js
+++ b/toolkit/components/startup/tests/unit/head_startup.js
@@ -3,17 +3,17 @@
const XULRUNTIME_CONTRACTID = "@mozilla.org/xre/runtime;1";
const XULRUNTIME_CID = Components.ID("7685dac8-3637-4660-a544-928c5ec0e714}");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var gAppInfo = null;
-function createAppInfo(ID, name, version, platformVersion="1.0") {
+function createAppInfo(ID, name, version, platformVersion = "1.0") {
let tmp = {};
Components.utils.import("resource://testing-common/AppInfo.jsm", tmp);
gAppInfo = tmp.newAppInfo({
ID, name, version, platformVersion,
crashReporter: true,
replacedLockTime: 0,
});
--- a/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
+++ b/toolkit/components/telemetry/TelemetryReportingPolicy.jsm
@@ -409,17 +409,17 @@ var TelemetryReportingPolicyImpl = {
observe: function(aSubject, aTopic, aData) {
if (aTopic != "sessionstore-windows-restored") {
return;
}
const isFirstRun = Preferences.get(PREF_FIRST_RUN, true);
const delay =
- isFirstRun ? NOTIFICATION_DELAY_FIRST_RUN_MSEC: NOTIFICATION_DELAY_NEXT_RUNS_MSEC;
+ isFirstRun ? NOTIFICATION_DELAY_FIRST_RUN_MSEC : NOTIFICATION_DELAY_NEXT_RUNS_MSEC;
this._startupNotificationTimerId = Policy.setShowInfobarTimeout(
// Calling |canUpload| eventually shows the infobar, if needed.
() => this._showInfobar(), delay);
// We performed at least a run, flip the firstRun preference.
Preferences.set(PREF_FIRST_RUN, false);
},
};
--- a/toolkit/components/telemetry/TelemetrySession.jsm
+++ b/toolkit/components/telemetry/TelemetrySession.jsm
@@ -392,17 +392,17 @@ var TelemetryScheduler = {
/**
* An helper function to save an aborted-session ping.
* @param {Number} now The current time, in milliseconds.
* @param {Object} [competingPayload=null] If we are coalescing the daily and the
* aborted-session pings, this is the payload for the former. Note
* that the reason field of this payload will be changed.
* @return {Promise} A promise resolved when the ping is saved.
*/
- _saveAbortedPing: function(now, competingPayload=null) {
+ _saveAbortedPing: function(now, competingPayload = null) {
this._lastSessionCheckpointTime = now;
return Impl._saveAbortedSessionPing(competingPayload)
.catch(e => this._log.error("_saveAbortedPing - Failed", e));
},
/**
* The notifications handler.
*/
@@ -1126,17 +1126,17 @@ var Impl = {
NS_ASSERT(amount !== undefined,
"telemetry accessed an unknown distinguished amount");
boundHandleMemoryReport(id, units, amount);
} catch (e) {
}
}
let b = (id, n) => h(id, Ci.nsIMemoryReporter.UNITS_BYTES, n);
let c = (id, n) => h(id, Ci.nsIMemoryReporter.UNITS_COUNT, n);
- let cc= (id, n) => h(id, Ci.nsIMemoryReporter.UNITS_COUNT_CUMULATIVE, n);
+ let cc = (id, n) => h(id, Ci.nsIMemoryReporter.UNITS_COUNT_CUMULATIVE, n);
let p = (id, n) => h(id, Ci.nsIMemoryReporter.UNITS_PERCENTAGE, n);
b("MEMORY_VSIZE", "vsize");
b("MEMORY_VSIZE_MAX_CONTIGUOUS", "vsizeMaxContiguous");
b("MEMORY_RESIDENT_FAST", "residentFast");
b("MEMORY_UNIQUE", "residentUnique");
b("MEMORY_HEAP_ALLOCATED", "heapAllocated");
p("MEMORY_HEAP_OVERHEAD_FRACTION", "heapOverheadFraction");
--- a/toolkit/components/telemetry/TelemetryStorage.jsm
+++ b/toolkit/components/telemetry/TelemetryStorage.jsm
@@ -70,32 +70,32 @@ const ARCHIVE_SIZE_PROBE_SPECIAL_VALUE =
const PENDING_PINGS_SIZE_PROBE_SPECIAL_VALUE = 17;
const UUID_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
/**
* This is thrown by |TelemetryStorage.loadPingFile| when reading the ping
* from the disk fails.
*/
-function PingReadError(message="Error reading the ping file", becauseNoSuchFile = false) {
+function PingReadError(message = "Error reading the ping file", becauseNoSuchFile = false) {
Error.call(this, message);
let error = new Error();
this.name = "PingReadError";
this.message = message;
this.stack = error.stack;
this.becauseNoSuchFile = becauseNoSuchFile;
}
PingReadError.prototype = Object.create(Error.prototype);
PingReadError.prototype.constructor = PingReadError;
/**
* This is thrown by |TelemetryStorage.loadPingFile| when parsing the ping JSON
* content fails.
*/
-function PingParseError(message="Error parsing ping content") {
+function PingParseError(message = "Error parsing ping content") {
Error.call(this, message);
let error = new Error();
this.name = "PingParseError";
this.message = message;
this.stack = error.stack;
}
PingParseError.prototype = Object.create(Error.prototype);
PingParseError.prototype.constructor = PingParseError;
--- a/toolkit/components/telemetry/tests/unit/head.js
+++ b/toolkit/components/telemetry/tests/unit/head.js
@@ -91,17 +91,17 @@ const PingServer = {
},
promiseNextPing: function() {
return this.promiseNextRequest().then(request => decodeRequestPayload(request));
},
promiseNextRequests: Task.async(function*(count) {
let results = [];
- for (let i=0; i<count; ++i) {
+ for (let i = 0; i < count; ++i) {
results.push(yield this.promiseNextRequest());
}
return results;
}),
promiseNextPings: function(count) {
return this.promiseNextRequests(count).then(requests => {
@@ -176,18 +176,18 @@ function loadAddonManager(...args) {
// used by system add-ons.
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
AddonTestUtils.registerDirectory("XREAppFeat", distroDir);
return AddonTestUtils.promiseStartupManager();
}
var gAppInfo = null;
-function createAppInfo(ID="xpcshell@tests.mozilla.org", name="XPCShell",
- version="1.0", platformVersion="1.0") {
+function createAppInfo(ID = "xpcshell@tests.mozilla.org", name = "XPCShell",
+ version = "1.0", platformVersion = "1.0") {
AddonTestUtils.createAppInfo(ID, name, version, platformVersion);
gAppInfo = AddonTestUtils.appInfo;
}
// Fake the timeout functions for the TelemetryScheduler.
function fakeSchedulerTimer(set, clear) {
let session = Cu.import("resource://gre/modules/TelemetrySession.jsm");
session.Policy.setSchedulerTickTimeout = set;
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySend.js
@@ -319,17 +319,17 @@ add_task(function* test_persistCurrentPi
const TEST_TYPE = "test-persistCurrentPingsOnShutdown";
const PING_COUNT = 5;
yield TelemetrySend.reset();
PingServer.stop();
Assert.equal(TelemetrySend.pendingPingCount, 0, "Should have no pending pings yet");
// Submit new pings that shouldn't be persisted yet.
let ids = [];
- for (let i=0; i<5; ++i) {
+ for (let i = 0; i < 5; ++i) {
ids.push(fakePingId("f", i));
TelemetryController.submitExternalPing(TEST_TYPE, {});
}
Assert.equal(TelemetrySend.pendingPingCount, PING_COUNT, "Should have the correct pending ping count");
// Triggering a shutdown should persist the pings.
yield TelemetrySend.shutdown();
--- a/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetrySession.js
@@ -231,18 +231,18 @@ function checkPayloadInfo(data) {
Assert.ok(stringCheck(data.previousBuildId));
}
Assert.ok(ALLOWED_REASONS.find(r => r == data.reason),
"Payload must contain an allowed reason.");
Assert.ok(Date.parse(data.subsessionStartDate) >= Date.parse(data.sessionStartDate));
Assert.ok(data.profileSubsessionCounter >= data.subsessionCounter);
- Assert.ok(data.timezoneOffset >= -12*60, "The timezone must be in a valid range.");
- Assert.ok(data.timezoneOffset <= 12*60, "The timezone must be in a valid range.");
+ Assert.ok(data.timezoneOffset >= -12 * 60, "The timezone must be in a valid range.");
+ Assert.ok(data.timezoneOffset <= 12 * 60, "The timezone must be in a valid range.");
}
function checkScalars(processes) {
// Check that the scalars section is available in the ping payload.
const parentProcess = processes.parent;
Assert.ok("scalars" in parentProcess, "The scalars section must be available in the parent process.");
Assert.ok("keyedScalars" in parentProcess, "The keyedScalars section must be available in the parent process.");
Assert.equal(typeof parentProcess.scalars, "object", "The scalars entry must be an object.");
--- a/toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
+++ b/toolkit/components/telemetry/tests/unit/test_nsITelemetry.js
@@ -5,17 +5,17 @@ const INT_MAX = 0x7FFFFFFF;
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/TelemetryUtils.jsm", this);
// Return an array of numbers from lower up to, excluding, upper
function numberRange(lower, upper)
{
let a = [];
- for (let i=lower; i<upper; ++i) {
+ for (let i = lower; i < upper; ++i) {
a.push(i);
}
return a;
}
function expect_fail(f) {
let failed = false;
try {
@@ -55,17 +55,17 @@ function compareHistograms(h1, h2) {
for (let i = 0; i < s1.ranges.length; i++)
do_check_eq(s1.ranges[i], s2.ranges[i]);
}
function check_histogram(histogram_type, name, min, max, bucket_count) {
var h = Telemetry.getHistogramById(name);
var r = h.snapshot().ranges;
var sum = 0;
- for (let i=0;i<r.length;i++) {
+ for (let i = 0;i < r.length;i++) {
var v = r[i];
sum += v;
h.add(v);
}
var s = h.snapshot();
// verify properties
do_check_eq(sum, s.sum);
@@ -141,17 +141,17 @@ add_task(function* test_noSerialization(
});
add_task(function* test_boolean_histogram() {
var h = Telemetry.getHistogramById("TELEMETRY_TEST_BOOLEAN");
var r = h.snapshot().ranges;
// boolean histograms ignore numeric parameters
do_check_eq(uneval(r), uneval([0, 1, 2]))
var sum = 0
- for (var i=0;i<r.length;i++) {
+ for (var i = 0;i < r.length;i++) {
var v = r[i];
sum += v;
h.add(v);
}
h.add(true);
h.add(false);
var s = h.snapshot();
do_check_eq(s.histogram_type, Telemetry.HISTOGRAM_BOOLEAN);
@@ -449,17 +449,17 @@ add_task(function* test_keyed_boolean_hi
"ranges": [0, 1, 2],
"counts": [0, 1, 0]
};
let testHistograms = numberRange(0, 3).map(i => JSON.parse(JSON.stringify(histogramBase)));
let testKeys = [];
let testSnapShot = {};
let h = Telemetry.getKeyedHistogramById(KEYED_ID);
- for (let i=0; i<2; ++i) {
+ for (let i = 0; i < 2; ++i) {
let key = KEYS[i];
h.add(key, true);
testSnapShot[key] = testHistograms[i];
testKeys.push(key);
Assert.deepEqual(h.keys().sort(), testKeys);
Assert.deepEqual(h.snapshot(), testSnapShot);
}
@@ -496,21 +496,21 @@ add_task(function* test_keyed_count_hist
"ranges": [0, 1, 2],
"counts": [1, 0, 0]
};
let testHistograms = numberRange(0, 5).map(i => JSON.parse(JSON.stringify(histogramBase)));
let testKeys = [];
let testSnapShot = {};
let h = Telemetry.getKeyedHistogramById(KEYED_ID);
- for (let i=0; i<4; ++i) {
+ for (let i = 0; i < 4; ++i) {
let key = KEYS[i];
- let value = i*2 + 1;
+ let value = i * 2 + 1;
- for (let k=0; k<value; ++k) {
+ for (let k = 0; k < value; ++k) {
h.add(key);
}
testHistograms[i].counts[0] = value;
testHistograms[i].sum = value;
testSnapShot[key] = testHistograms[i];
testKeys.push(key);
Assert.deepEqual(h.keys().sort(), testKeys);
--- a/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
+++ b/toolkit/components/thumbnails/BackgroundPageThumbs.jsm
@@ -54,17 +54,17 @@ const BackgroundPageThumbs = {
* @opt onDone A function that will be asynchronously called when the
* capture is complete or times out. It's called as
* onDone(url),
* where `url` is the captured URL.
* @opt timeout The capture will time out after this many milliseconds have
* elapsed after the capture has progressed to the head of
* the queue and started. Defaults to 30000 (30 seconds).
*/
- capture: function (url, options={}) {
+ capture: function (url, options = {}) {
if (!PageThumbs._prefEnabled()) {
if (options.onDone)
schedule(() => options.onDone(url));
return;
}
this._captureQueue = this._captureQueue || [];
this._capturesByURL = this._capturesByURL || new Map();
@@ -89,17 +89,17 @@ const BackgroundPageThumbs = {
* Asynchronously captures a thumbnail of the given URL if one does not
* already exist. Otherwise does nothing.
*
* @param url The URL to capture.
* @param options An optional object that configures the capture. See
* capture() for description.
* @return {Promise} A Promise that resolves when this task completes
*/
- captureIfMissing: Task.async(function* (url, options={}) {
+ captureIfMissing: Task.async(function* (url, options = {}) {
// The fileExistsForURL call is an optimization, potentially but unlikely
// incorrect, and no big deal when it is. After the capture is done, we
// atomically test whether the file exists before writing it.
let exists = yield PageThumbsStorage.fileExistsForURL(url);
if (exists) {
if (options.onDone) {
options.onDone(url);
}
--- a/toolkit/components/tooltiptext/tests/browser_bug581947.js
+++ b/toolkit/components/tooltiptext/tests/browser_bug581947.js
@@ -15,17 +15,17 @@ function check(aBrowser, aElementName, a
"No tooltip should be shown when the element is valid");
e.setCustomValidity('foo');
if (aBarred) {
ok(!tttp.getNodeText(e, {}, {}),
"No tooltip should be shown when the element is barred from constraint validation");
} else {
ok(tttp.getNodeText(e, {}, {}),
- e.tagName + " " +"A tooltip should be shown when the element isn't valid");
+ e.tagName + " " + "A tooltip should be shown when the element isn't valid");
}
e.setAttribute('title', '');
ok (!tttp.getNodeText(e, {}, {}),
"No tooltip should be shown if the title attribute is set");
e.removeAttribute('title');
contentElement.setAttribute('novalidate', '');
--- a/toolkit/components/utils/simpleServices.js
+++ b/toolkit/components/utils/simpleServices.js
@@ -269,17 +269,17 @@ AddonLocalizationConverter.prototype = {
},
convert(aStream, aFromType, aToType, aContext) {
this.checkTypes(aFromType, aToType);
let addonId = this.getAddonId(aContext);
let string = (
aStream.available() ?
- NetUtil.readInputStreamToString(aStream, aStream.available()): ""
+ NetUtil.readInputStreamToString(aStream, aStream.available()) : ""
);
return this.convertToStream(addonId, string);
},
asyncConvertData(aFromType, aToType, aListener, aContext) {
this.checkTypes(aFromType, aToType);
this.addonId = this.getAddonId(aContext);
this.listener = aListener;
--- a/toolkit/components/workerloader/tests/utils_mainthread.js
+++ b/toolkit/components/workerloader/tests/utils_mainthread.js
@@ -1,26 +1,26 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function worker_handler(worker) {
worker.onerror = function(error) {
error.preventDefault();
- ok(false, "error "+ error.message);
+ ok(false, "error " + error.message);
};
worker.onmessage = function(msg) {
// ok(true, "MAIN: onmessage " + JSON.stringify(msg.data));
switch (msg.data.kind) {
case "is":
SimpleTest.ok(msg.data.outcome, msg.data.description +
- "( "+ msg.data.a + " ==? " + msg.data.b + ")" );
+ "( " + msg.data.a + " ==? " + msg.data.b + ")" );
return;
case "isnot":
SimpleTest.ok(msg.data.outcome, msg.data.description +
- "( "+ msg.data.a + " !=? " + msg.data.b + ")" );
+ "( " + msg.data.a + " !=? " + msg.data.b + ")" );
return;
case "ok":
SimpleTest.ok(msg.data.condition, msg.data.description);
return;
case "info":
SimpleTest.info(msg.data.description);
return;
case "finish":
--- a/toolkit/components/workerloader/tests/worker_handler.js
+++ b/toolkit/components/workerloader/tests/worker_handler.js
@@ -1,26 +1,26 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
function worker_handler(worker) {
worker.onerror = function(error) {
error.preventDefault();
- ok(false, "error "+error);
+ ok(false, "error " + error);
}
worker.onmessage = function(msg) {
ok(true, "MAIN: onmessage " + JSON.stringify(msg.data));
switch (msg.data.kind) {
case "is":
SimpleTest.ok(msg.data.outcome, msg.data.description +
- "( "+ msg.data.a + " ==? " + msg.data.b + ")" );
+ "( " + msg.data.a + " ==? " + msg.data.b + ")" );
return;
case "isnot":
SimpleTest.ok(msg.data.outcome, msg.data.description +
- "( "+ msg.data.a + " !=? " + msg.data.b + ")" );
+ "( " + msg.data.a + " !=? " + msg.data.b + ")" );
return;
case "ok":
SimpleTest.ok(msg.data.condition, msg.data.description);
return;
case "info":
SimpleTest.info(msg.data.description);
return;
case "finish":
--- a/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js
+++ b/toolkit/components/xulstore/tests/xpcshell/test_XULStore.js
@@ -102,17 +102,17 @@ add_task(function* testTruncation() {
// Long id names should trigger an exception
Assert.throws(() => XULStore.setValue(browserURI, dos, "foo", "foo"), /NS_ERROR_ILLEGAL_VALUE/);
// Long attr names should trigger an exception
Assert.throws(() => XULStore.setValue(browserURI, "foo", dos, "foo"), /NS_ERROR_ILLEGAL_VALUE/);
// Long values should be truncated
XULStore.setValue(browserURI, "dos", "dos", dos);
- dos =XULStore.getValue(browserURI, "dos", "dos");
+ dos = XULStore.getValue(browserURI, "dos", "dos");
do_check_true(dos.length == 4096)
XULStore.removeValue(browserURI, "dos", "dos")
});
add_task(function* testGetValue() {
// Get non-existing property
checkValue(browserURI, "side-window", "height", "");
--- a/toolkit/content/aboutAbout.js
+++ b/toolkit/content/aboutAbout.js
@@ -15,17 +15,17 @@ function findAbouts() {
var ios = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService);
for (var cid in Cc) {
var result = cid.match(/@mozilla.org\/network\/protocol\/about;1\?what\=(.*)$/);
if (result) {
var aboutType = result[1];
var contract = "@mozilla.org/network/protocol/about;1?what=" + aboutType;
try {
var am = Cc[contract].getService(Ci.nsIAboutModule);
- var uri = ios.newURI("about:"+aboutType, null, null);
+ var uri = ios.newURI("about:" + aboutType, null, null);
var flags = am.getURIFlags(uri);
if (!(flags & Ci.nsIAboutModule.HIDE_FROM_ABOUTABOUT)) {
gProtocols.push(aboutType);
}
} catch (e) {
// getService might have thrown if the component doesn't actually
// implement nsIAboutModule
}
--- a/toolkit/content/aboutTelemetry.js
+++ b/toolkit/content/aboutTelemetry.js
@@ -170,17 +170,17 @@ function removeAllChildNodes(node) {
node.removeChild(node.lastChild);
}
}
/**
* Pad a number to two digits with leading "0".
*/
function padToTwoDigits(n) {
- return (n > 9) ? n: "0" + n;
+ return (n > 9) ? n : "0" + n;
}
/**
* Return yesterdays date with the same time.
*/
function yesterday(date) {
let d = new Date(date);
d.setDate(d.getDate() - 1);
--- a/toolkit/content/browser-content.js
+++ b/toolkit/content/browser-content.js
@@ -1151,20 +1151,20 @@ var ViewSelectionSource = {
// Only bother with the selection if it can be remapped. Don't mess with
// leaf elements (such as <isindex>) that secretly use anynomous content
// for their display appearance.
var canDrawSelection = ancestorContainer.hasChildNodes();
var tmpNode;
if (canDrawSelection) {
var i;
- for (i = startPath ? startPath.length-1 : -1; i >= 0; i--) {
+ for (i = startPath ? startPath.length - 1 : -1; i >= 0; i--) {
startContainer = startContainer.childNodes.item(startPath[i]);
}
- for (i = endPath ? endPath.length-1 : -1; i >= 0; i--) {
+ for (i = endPath ? endPath.length - 1 : -1; i >= 0; i--) {
endContainer = endContainer.childNodes.item(endPath[i]);
}
// add special markers to record the extent of the selection
// note: |startOffset| and |endOffset| are interpreted either as
// offsets in the text data or as child indices (see the Range spec)
// (here, munging the end point first to keep the start point safe...)
if (endContainer.nodeType == Node.TEXT_NODE ||
@@ -1264,17 +1264,17 @@ var ViewSelectionSource = {
+ '<html>'
+ '<head><title>' + title + '</title>'
+ '<link rel="stylesheet" type="text/css" href="' + VIEW_SOURCE_CSS + '">'
+ '<style type="text/css">'
+ '#target { border: dashed 1px; background-color: lightyellow; }'
+ '</style>'
+ '</head>'
+ '<body id="viewsource"' + wrapClass
- + ' onload="document.title=\''+title+'\'; document.getElementById(\'target\').scrollIntoView(true)">'
+ + ' onload="document.title=\'' + title + '\'; document.getElementById(\'target\').scrollIntoView(true)">'
+ '<pre>'
+ this.getOuterMarkup(topNode, 0)
+ '</pre></body></html>'
; // end
return { uri: "data:text/html;charset=utf-8," + encodeURIComponent(source),
drawSelection: false, baseURI: node.ownerDocument.baseURI };
},
--- a/toolkit/content/contentAreaUtils.js
+++ b/toolkit/content/contentAreaUtils.js
@@ -183,17 +183,17 @@ function saveImageURL(aURL, aFileName, a
internalSave(aURL, null, aFileName, aContentDisp, aContentType,
aShouldBypassCache, aFilePickerTitleKey, null, aReferrer,
null, aSkipPrompt, null, aIsContentWindowPrivate);
}
// This is like saveDocument, but takes any browser/frame-like element
// (nsIFrameLoaderOwner) and saves the current document inside it,
// whether in-process or out-of-process.
-function saveBrowser(aBrowser, aSkipPrompt, aOuterWindowID=0)
+function saveBrowser(aBrowser, aSkipPrompt, aOuterWindowID = 0)
{
if (!aBrowser) {
throw "Must have a browser when calling saveBrowser";
}
let persistable = aBrowser.QueryInterface(Ci.nsIFrameLoaderOwner)
.frameLoader
.QueryInterface(Ci.nsIWebBrowserPersistable);
let stack = Components.stack.caller;
@@ -1129,17 +1129,17 @@ function validateFileName(aFileName)
!(dangerousChars.indexOf(aFileName[i]) >= 0) ? aFileName[i]
: "_";
// Last character should not be a space
processed = processed.trim();
// If a large part of the filename has been sanitized, then we
// will use a default filename instead
- if (processed.replace(/_/g, "").length <= processed.length/2) {
+ if (processed.replace(/_/g, "").length <= processed.length / 2) {
// We purposefully do not use a localized default filename,
// which we could have done using
// ContentAreaUtils.stringBundle.GetStringFromName("DefaultSaveFileName")
// since it may contain invalid characters.
var original = processed;
processed = "download";
// Preserve a suffix, if there is one
--- a/toolkit/content/customizeToolbar.js
+++ b/toolkit/content/customizeToolbar.js
@@ -33,17 +33,17 @@ function InitWithToolbox(aToolbox)
gToolboxDocument = gToolbox.ownerDocument;
gToolbox.customizing = true;
forEachCustomizableToolbar(function (toolbar) {
toolbar.setAttribute("customizing", "true");
});
gPaletteBox = document.getElementById("palette-box");
var elts = getRootElements();
- for (let i=0; i < elts.length; i++) {
+ for (let i = 0; i < elts.length; i++) {
elts[i].addEventListener("dragstart", onToolbarDragStart, true);
elts[i].addEventListener("dragover", onToolbarDragOver, true);
elts[i].addEventListener("dragexit", onToolbarDragExit, true);
elts[i].addEventListener("drop", onToolbarDrop, true);
}
initDialog();
}
@@ -114,17 +114,17 @@ function repositionDialog(aWindow)
var screenY = gToolbox.boxObject.screenY + gToolbox.boxObject.height;
aWindow.moveTo(screenX, screenY);
}
function removeToolboxListeners()
{
var elts = getRootElements();
- for (let i=0; i < elts.length; i++) {
+ for (let i = 0; i < elts.length; i++) {
elts[i].removeEventListener("dragstart", onToolbarDragStart, true);
elts[i].removeEventListener("dragover", onToolbarDragOver, true);
elts[i].removeEventListener("dragexit", onToolbarDragExit, true);
elts[i].removeEventListener("drop", onToolbarDrop, true);
}
}
/**
@@ -169,32 +169,32 @@ function persistCurrentSets()
var customIndex = toolbar.hasAttribute("customindex");
if (customIndex) {
if (!toolbar.hasChildNodes()) {
// Remove custom toolbars whose contents have been removed.
gToolbox.removeChild(toolbar);
} else if (gToolbox.toolbarset) {
// Persist custom toolbar info on the <toolbarset/>
- gToolbox.toolbarset.setAttribute("toolbar"+(++customCount),
+ gToolbox.toolbarset.setAttribute("toolbar" + (++customCount),
toolbar.toolbarName + ":" + currentSet);
- gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
+ gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar" + customCount);
}
}
if (!customIndex) {
// Persist the currentset attribute directly on hardcoded toolbars.
gToolboxDocument.persist(toolbar.id, "currentset");
}
});
// Remove toolbarX attributes for removed toolbars.
- while (gToolbox.toolbarset && gToolbox.toolbarset.hasAttribute("toolbar"+(++customCount))) {
- gToolbox.toolbarset.removeAttribute("toolbar"+customCount);
- gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar"+customCount);
+ while (gToolbox.toolbarset && gToolbox.toolbarset.hasAttribute("toolbar" + (++customCount))) {
+ gToolbox.toolbarset.removeAttribute("toolbar" + customCount);
+ gToolboxDocument.persist(gToolbox.toolbarset.id, "toolbar" + customCount);
}
}
/**
* Wraps all items in all customizable toolbars in a toolbox.
*/
function wrapToolbarItems()
{
@@ -218,17 +218,17 @@ function getRootElements()
}
/**
* Unwraps all items in all customizable toolbars in a toolbox.
*/
function unwrapToolbarItems()
{
let elts = getRootElements();
- for (let i=0; i < elts.length; i++) {
+ for (let i = 0; i < elts.length; i++) {
let paletteItems = elts[i].getElementsByTagName("toolbarpaletteitem");
let paletteItem;
while ((paletteItem = paletteItems.item(0)) != null) {
let toolbarItem = paletteItem.firstChild;
restoreItemForToolbar(toolbarItem, paletteItem);
paletteItem.parentNode.replaceChild(toolbarItem, paletteItem);
}
}
@@ -238,17 +238,17 @@ function unwrapToolbarItems()
* Creates a wrapper that can be used to contain a toolbaritem and prevent
* it from receiving UI events.
*/
function createWrapper(aId, aDocument)
{
var wrapper = aDocument.createElementNS("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul",
"toolbarpaletteitem");
- wrapper.id = "wrapper-"+aId;
+ wrapper.id = "wrapper-" + aId;
return wrapper;
}
/**
* Wraps an item that has been cloned from a template and adds
* it to the end of the palette.
*/
function wrapPaletteItem(aPaletteItem)
@@ -436,20 +436,20 @@ function setWrapperType(aItem, aWrapper)
aWrapper.setAttribute("type", aItem.firstChild.localName);
}
}
function setDragActive(aItem, aValue)
{
var node = aItem;
var direction = window.getComputedStyle(aItem, null).direction;
- var value = direction == "ltr"? "left" : "right";
+ var value = direction == "ltr" ? "left" : "right";
if (aItem.localName == "toolbar") {
node = aItem.lastChild;
- value = direction == "ltr"? "right" : "left";
+ value = direction == "ltr" ? "right" : "left";
}
if (!node)
return;
if (aValue) {
if (!node.hasAttribute("dragover"))
node.setAttribute("dragover", value);
@@ -718,22 +718,22 @@ function onToolbarDrop(aEvent)
var draggedItemId = aEvent.dataTransfer.getData("text/toolbarwrapper-id/" + documentId);
if (gCurrentDragOverItem.id == draggedItemId)
return;
var toolbar = aEvent.target;
while (toolbar.localName != "toolbar")
toolbar = toolbar.parentNode;
- var draggedPaletteWrapper = document.getElementById("wrapper-"+draggedItemId);
+ var draggedPaletteWrapper = document.getElementById("wrapper-" + draggedItemId);
if (!draggedPaletteWrapper) {
// The wrapper has been dragged from the toolbar.
// Get the wrapper from the toolbar document and make sure that
// it isn't being dropped on itself.
- let wrapper = gToolboxDocument.getElementById("wrapper-"+draggedItemId);
+ let wrapper = gToolboxDocument.getElementById("wrapper-" + draggedItemId);
if (wrapper == gCurrentDragOverItem)
return;
// Don't allow non-removable kids (e.g., the menubar) to move.
if (wrapper.firstChild.getAttribute("removable") != "true")
return;
// Remove the item from its place in the toolbar.
@@ -757,17 +757,17 @@ function onToolbarDrop(aEvent)
// Create a new wrapper for the item. We don't know the id yet.
let wrapper = createWrapper("", gToolboxDocument);
// Ask the toolbar to clone the item's template, place it inside the wrapper, and insert it in the toolbar.
var newItem = toolbar.insertItem(draggedItemId, gCurrentDragOverItem == toolbar ? null : gCurrentDragOverItem, wrapper);
// Prepare the item and wrapper to look good on the toolbar.
cleanupItemForToolbar(newItem, wrapper);
- wrapper.id = "wrapper-"+newItem.id;
+ wrapper.id = "wrapper-" + newItem.id;
wrapper.flex = newItem.flex;
// Remove the wrapper from the palette.
if (draggedItemId != "separator" &&
draggedItemId != "spring" &&
draggedItemId != "spacer")
gPaletteBox.removeChild(draggedPaletteWrapper);
}
@@ -790,17 +790,17 @@ function onPaletteDragOver(aEvent)
function onPaletteDrop(aEvent)
{
if (isUnwantedDragEvent(aEvent)) {
return;
}
var documentId = gToolboxDocument.documentElement.id;
var itemId = aEvent.dataTransfer.getData("text/toolbarwrapper-id/" + documentId);
- var wrapper = gToolboxDocument.getElementById("wrapper-"+itemId);
+ var wrapper = gToolboxDocument.getElementById("wrapper-" + itemId);
if (wrapper) {
// Don't allow non-removable kids (e.g., the menubar) to move.
if (wrapper.firstChild.getAttribute("removable") != "true")
return;
var wrapperType = wrapper.getAttribute("type");
if (wrapperType != "separator" &&
wrapperType != "spacer" &&
--- a/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
+++ b/toolkit/content/tests/chrome/file_autocomplete_with_composition.js
@@ -71,17 +71,17 @@ nsDoTestsForAutoCompleteWithComposition.
},
_checkResult: function ()
{
var test = this._tests[this._testingIndex];
this._is(this._getTargetValue(), test.value,
this._description + ", " + test.description + ": value");
this._is(this._controller.searchString, test.searchString,
- this._description + ", " + test.description +": searchString");
+ this._description + ", " + test.description + ": searchString");
this._is(this._controller.input.popupOpen, test.popup,
this._description + ", " + test.description + ": popupOpen");
this._doTests();
},
_testingIndex: -1,
_tests: [
// Simple composition when popup hasn't been shown.
--- a/toolkit/content/tests/chrome/xul_selectcontrol.js
+++ b/toolkit/content/tests/chrome/xul_selectcontrol.js
@@ -348,17 +348,17 @@ function test_nsIDOMXULSelectControlElem
var dontSelectDisabled = (behaviourContains(element.localName, "dont-select-disabled"));
// 'mouse select' - check if clicking an item selects it
synthesizeMouseExpectEvent(seconditem, 2, 2, {}, element,
dontSelectDisabled ? "!select" : "select",
testid + "mouse select disabled");
test_nsIDOMXULSelectControlElement_States(element, testid + "mouse select disabled", 4,
- dontSelectDisabled ? firstitem: seconditem, dontSelectDisabled ? 0 : 1,
+ dontSelectDisabled ? firstitem : seconditem, dontSelectDisabled ? 0 : 1,
dontSelectDisabled ? "first" : "second");
if (dontSelectDisabled) {
// test whether disabling an item won't allow it to be selected
synthesizeKeyExpectEvent(forwardKey, {}, element, "select", testid + "key down disabled");
test_nsIDOMXULSelectControlElement_States(element, testid + "key down disabled", 4, thirditem, 2, "third");
synthesizeKeyExpectEvent(backKey, {}, element, "select", testid + "key up disabled");
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/TileManager.js
@@ -150,17 +150,17 @@ TileManager.prototype = {
function appendNonDirtyTile(tile) {
if (!tile.isDirty())
this._appendTileSafe(tile);
}
if (destCriticalRect)
this._tileCache.forEachIntersectingRect(destCriticalRect, false, appendNonDirtyTile, this);
let end = Date.now();
- dump("start: " + (end-start) + "\n")
+ dump("start: " + (end - start) + "\n")
},
beginCriticalMove: function beginCriticalMove(destCriticalRect) {
/*
function appendNonDirtyTile(tile) {
if (!tile.isDirty())
this._appendTileSafe(tile);
}
@@ -232,17 +232,17 @@ TileManager.prototype = {
}
// }
}
}
}
}
let end = Date.now();
- dump("start: " + (end-start) + "\n")
+ dump("start: " + (end - start) + "\n")
},
endCriticalMove: function endCriticalMove(destCriticalRect, doCriticalPaint) {
let start = Date.now();
let tc = this._tileCache;
let cr = this._criticalRect;
--- a/toolkit/content/tests/fennec-tile-testapp/chrome/content/WidgetStack.js
+++ b/toolkit/content/tests/fennec-tile-testapp/chrome/content/WidgetStack.js
@@ -74,18 +74,18 @@ wsBorder.prototype = {
/*
* wsRect class
*
* Rectangle class, with both x/y/w/h and t/l/b/r accessors.
*/
function wsRect(x, y, w, h) {
this.left = x;
this.top = y;
- this.right = x+w;
- this.bottom = y+h;
+ 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; },
@@ -100,18 +100,18 @@ wsRect.prototype = {
this.bottom -= diff;
},
set width(v) { this.right = this.left + v; },
set height(v) { this.bottom = this.top + v; },
setRect: function(x, y, w, h) {
this.left = x;
this.top = y;
- this.right = x+w;
- this.bottom = y+h;
+ this.right = x + w;
+ this.bottom = y + h;
return this;
},
setBounds: function(t, l, b, r) {
this.top = t;
this.left = l;
this.bottom = b;
@@ -170,17 +170,17 @@ wsRect.prototype = {
// return a new wsRect that is the union of that one and this one
union: function(rect) {
let l = Math.min(this.left, rect.left);
let r = Math.max(this.right, rect.right);
let t = Math.min(this.top, rect.top);
let b = Math.max(this.bottom, rect.bottom);
- return new wsRect(l, t, r-l, b-t);
+ return new wsRect(l, t, r - l, b - t);
},
toString: function() {
return "[" + this.x + "," + this.y + "," + this.width + "," + this.height + "]";
},
expandBy: function(b) {
this.left += b.left;
@@ -271,17 +271,17 @@ wsRect.prototype = {
* given a strict subset rect as the argument.
*/
expandToContain: function extendTo(rect) {
let l = Math.min(this.left, rect.left);
let r = Math.max(this.right, rect.right);
let t = Math.min(this.top, rect.top);
let b = Math.max(this.bottom, rect.bottom);
- return this.setRect(l, t, r-l, b-t);
+ return this.setRect(l, t, r - l, b - t);
},
round: function round(scale) {
if (!scale) scale = 1;
this.left = Math.floor(this.left * scale) / scale;
this.top = Math.floor(this.top * scale) / scale;
this.right = Math.ceil(this.right * scale) / scale;
@@ -974,22 +974,22 @@ WidgetStack.prototype = {
let alreadyKnownDistance = this._dragState.barrierState[i] || 0;
// log2("alreadyKnownDistance", alreadyKnownDistance);
let dbx = 0;
// 100 <= 100 && 100-(-5) > 100
- if ((vr.left <= b.x && vr.left+dx > b.x) ||
- (vr.left >= b.x && vr.left+dx < b.x))
+ if ((vr.left <= b.x && vr.left + dx > b.x) ||
+ (vr.left >= b.x && vr.left + dx < b.x))
{
dbx = b.x - vr.left;
- } else if ((vr.right <= b.x && vr.right+dx > b.x) ||
- (vr.right >= b.x && vr.right+dx < b.x))
+ } else if ((vr.right <= b.x && vr.right + dx > b.x) ||
+ (vr.right >= b.x && vr.right + dx < b.x))
{
dbx = b.x - vr.right;
} else {
delete this._dragState.barrierState[i];
continue;
}
let leftoverDistance = dbx - dx;
@@ -1028,22 +1028,22 @@ WidgetStack.prototype = {
let alreadyKnownDistance = this._dragState.barrierState[i] || 0;
// log2("alreadyKnownDistance", alreadyKnownDistance);
let dby = 0;
// 100 <= 100 && 100-(-5) > 100
- if ((vr.top <= b.y && vr.top+dy > b.y) ||
- (vr.top >= b.y && vr.top+dy < b.y))
+ if ((vr.top <= b.y && vr.top + dy > b.y) ||
+ (vr.top >= b.y && vr.top + dy < b.y))
{
dby = b.y - vr.top;
- } else if ((vr.bottom <= b.y && vr.bottom+dy > b.y) ||
- (vr.bottom >= b.y && vr.bottom+dy < b.y))
+ } else if ((vr.bottom <= b.y && vr.bottom + dy > b.y) ||
+ (vr.bottom >= b.y && vr.bottom + dy < b.y))
{
dby = b.y - vr.bottom;
} else {
delete this._dragState.barrierState[i];
continue;
}
let leftoverDistance = dby - dy;
--- a/toolkit/content/tests/widgets/popup_shared.js
+++ b/toolkit/content/tests/widgets/popup_shared.js
@@ -103,17 +103,17 @@ function eventOccurred(event)
}
var events = test.events;
if (typeof events == "function")
events = events();
if (events) {
if (events.length <= gTestEventIndex) {
ok(false, "Extra " + event.type + " event fired for " + event.target.id +
- " " +gPopupTests[gTestIndex].testname);
+ " " + gPopupTests[gTestIndex].testname);
return;
}
var eventitem = events[gTestEventIndex].split(" ");
var matches;
if (eventitem[1] == "#tooltip") {
is(event.originalTarget.localName, "tooltip",
test.testname + " event.originalTarget.localName is 'tooltip'");
--- a/toolkit/content/tests/widgets/tree_shared.js
+++ b/toolkit/content/tests/widgets/tree_shared.js
@@ -28,17 +28,17 @@ function testtag_tree(treeid, treerowinf
}
document.addEventListener("keypress", preventDefault, false);
var multiple = (seltype == "multiple");
var tree = document.getElementById(treeid);
var treerowinfo = document.getElementById(treerowinfoid);
var rowInfo;
- if (testid =="tree view")
+ if (testid == "tree view")
rowInfo = getCustomTreeViewCellInfo();
else
rowInfo = convertDOMtoTreeRowInfo(treerowinfo, 0, { value: -1 });
var columnInfo = (columnstype == "simple") ? columns_simpletree : columns_hiertree;
is(tree.view.selection.currentColumn, null, testid + " initial currentColumn");
is(tree.selType, seltype == "multiple" ? "" : seltype, testid + " seltype");
@@ -109,17 +109,17 @@ function testtag_tree(treeid, treerowinf
inputField.value = "Second Value";
tree.stopEditing(false);
is(tree.view.getCellText(1, ecolumn), "Changed Value", testid + "edit cell no accept");
tree.editable = false;
// do the sorting tests last as it will cause the rows to rearrange
// skip them for the custom tree view
- if (testid !="tree view")
+ if (testid != "tree view")
testtag_tree_TreeView_rows_sort(tree, testid, rowInfo);
testtag_tree_wheel(tree);
document.removeEventListener("keypress", preventDefault, false);
SimpleTest.finish();
}
--- a/toolkit/content/widgets/autocomplete.xml
+++ b/toolkit/content/widgets/autocomplete.xml
@@ -867,17 +867,17 @@
</method>
<method name="selectBy">
<parameter name="aReverse"/>
<parameter name="aPage"/>
<body><![CDATA[
try {
var amount = aPage ? 5 : 1;
- this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this.tree.view.rowCount-1);
+ this.selectedIndex = this.getNextIndex(aReverse, amount, this.selectedIndex, this.tree.view.rowCount - 1);
if (this.selectedIndex == -1) {
this.input._focus();
}
} catch (ex) {
// do nothing - occasionally timer-related js errors happen here
// e.g. "this.selectedIndex has no properties", when you type fast and hit a
// navigation key before this popup has opened
}
@@ -966,17 +966,17 @@ extends="chrome://global/content/binding
<parameter name="aReverse"/>
<parameter name="aAmount"/>
<parameter name="aIndex"/>
<parameter name="aMaxRow"/>
<body><![CDATA[
if (aMaxRow < 0)
return -1;
- var newIdx = aIndex + (aReverse?-1:1)*aAmount;
+ var newIdx = aIndex + (aReverse ? -1 : 1) * aAmount;
if (aReverse && aIndex == -1 || newIdx > aMaxRow && aIndex != aMaxRow)
newIdx = aMaxRow;
else if (!aReverse && aIndex == -1 || newIdx < 0 && aIndex != 0)
newIdx = 0;
if (newIdx < 0 && aIndex == 0 || newIdx > aMaxRow && aIndex == aMaxRow)
aIndex = -1;
else
--- a/toolkit/content/widgets/button.xml
+++ b/toolkit/content/widgets/button.xml
@@ -193,17 +193,17 @@
if (this.accessKey.toLowerCase() == charPressedLower) {
this.click();
return;
}
// Search for accesskey in the list of buttons for this doc and each subdoc
// Get the buttons for the main document and all sub-frames
for (var frameCount = -1; frameCount < window.top.frames.length; frameCount++) {
- var doc = (frameCount == -1)? window.top.document:
+ var doc = (frameCount == -1) ? window.top.document :
window.top.frames[frameCount].document
if (this.fireAccessKeyButton(doc.documentElement, charPressedLower))
return;
}
// Test anonymous buttons
var dlg = window.top.document;
var buttonBox = dlg.getAnonymousElementByAttribute(dlg.documentElement,
--- a/toolkit/content/widgets/dialog.xml
+++ b/toolkit/content/widgets/dialog.xml
@@ -128,18 +128,18 @@
window.moveTo( newX, newY );
]]>
</body>
</method>
<method name="centerWindowOnScreen">
<body>
<![CDATA[
- var xOffset = screen.availWidth/2 - window.outerWidth/2;
- var yOffset = screen.availHeight/2 - window.outerHeight/2;
+ var xOffset = screen.availWidth / 2 - window.outerWidth / 2;
+ var yOffset = screen.availHeight / 2 - window.outerHeight / 2;
xOffset = xOffset > 0 ? xOffset : 0;
yOffset = yOffset > 0 ? yOffset : 0;
window.moveTo(xOffset, yOffset);
]]>
</body>
</method>
@@ -247,32 +247,32 @@
// add the label and oncommand handler to each button
for (dlgtype in buttons) {
var button = buttons[dlgtype];
button.addEventListener("command", this._handleButtonCommand, true);
// don't override custom labels with pre-defined labels on explicit buttons
if (!button.hasAttribute("label")) {
// dialog attributes override the default labels in dialog.properties
- if (this.hasAttribute("buttonlabel"+dlgtype)) {
- button.setAttribute("label", this.getAttribute("buttonlabel"+dlgtype));
- if (this.hasAttribute("buttonaccesskey"+dlgtype))
- button.setAttribute("accesskey", this.getAttribute("buttonaccesskey"+dlgtype));
+ if (this.hasAttribute("buttonlabel" + dlgtype)) {
+ button.setAttribute("label", this.getAttribute("buttonlabel" + dlgtype));
+ if (this.hasAttribute("buttonaccesskey" + dlgtype))
+ button.setAttribute("accesskey", this.getAttribute("buttonaccesskey" + dlgtype));
} else if (dlgtype != "extra1" && dlgtype != "extra2") {
- button.setAttribute("label", this.mStrBundle.GetStringFromName("button-"+dlgtype));
- var accessKey = this.mStrBundle.GetStringFromName("accesskey-"+dlgtype);
+ button.setAttribute("label", this.mStrBundle.GetStringFromName("button-" + dlgtype));
+ var accessKey = this.mStrBundle.GetStringFromName("accesskey-" + dlgtype);
if (accessKey)
button.setAttribute("accesskey", accessKey);
}
}
// allow specifying alternate icons in the dialog header
if (!button.hasAttribute("icon")) {
// if there's an icon specified, use that
- if (this.hasAttribute("buttonicon"+dlgtype))
- button.setAttribute("icon", this.getAttribute("buttonicon"+dlgtype));
+ if (this.hasAttribute("buttonicon" + dlgtype))
+ button.setAttribute("icon", this.getAttribute("buttonicon" + dlgtype));
// otherwise set defaults
else
switch (dlgtype) {
case "accept":
button.setAttribute("icon", "accept");
break;
case "cancel":
button.setAttribute("icon", "cancel");
@@ -306,17 +306,17 @@
// hide/show the buttons we want
for (dlgtype in buttons)
buttons[dlgtype].hidden = !shown[dlgtype];
// show the spacer on Windows only when the extra2 button is present
if (/Win/.test(navigator.platform)) {
var spacer = document.getAnonymousElementByAttribute(this, "anonid", "spacer");
spacer.removeAttribute("hidden");
- spacer.setAttribute("flex", shown["extra2"]?"1":"0");
+ spacer.setAttribute("flex", shown["extra2"] ? "1" : "0");
}
}
]]>
</body>
</method>
<method name="_setDefaultButton">
<parameter name="aNewDefault"/>
@@ -375,23 +375,23 @@
</body>
</method>
<method name="_fireButtonEvent">
<parameter name="aDlgType"/>
<body>
<![CDATA[
var event = document.createEvent("Events");
- event.initEvent("dialog"+aDlgType, true, true);
+ event.initEvent("dialog" + aDlgType, true, true);
// handle dom event handlers
var noCancel = this.dispatchEvent(event);
// handle any xml attribute event handlers
- var handler = this.getAttribute("ondialog"+aDlgType);
+ var handler = this.getAttribute("ondialog" + aDlgType);
if (handler != "") {
var fn = new Function("event", handler);
var returned = fn(event);
if (returned == false)
noCancel = false;
}
return noCancel;
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -52,18 +52,18 @@
// Look to see if there is a toolbarset.
this.toolbarset = this.firstChild;
while (this.toolbarset && this.toolbarset.localName != "toolbarset")
this.toolbarset = toolbarset.nextSibling;
if (this.toolbarset) {
// Create each toolbar described by the toolbarset.
var index = 0;
- while (toolbarset.hasAttribute("toolbar"+(++index))) {
- var toolbarInfo = toolbarset.getAttribute("toolbar"+index);
+ while (toolbarset.hasAttribute("toolbar" + (++index))) {
+ var toolbarInfo = toolbarset.getAttribute("toolbar" + index);
var infoSplit = toolbarInfo.split(":");
this.appendCustomToolbar(infoSplit[0], infoSplit[1]);
}
}
]]>
</constructor>
<method name="appendCustomToolbar">
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -140,23 +140,23 @@
if (this.columns) {
// update the ordinal position of each column to assure that it is
// an odd number and 2 positions above its next sibling
var cols = [];
var i;
for (var col = this.columns.getFirstColumn(); col; col = col.getNext())
cols.push(col.element);
for (i = 0; i < cols.length; ++i)
- cols[i].setAttribute("ordinal", (i*2)+1);
+ cols[i].setAttribute("ordinal", (i * 2) + 1);
// update the ordinal positions of splitters to even numbers, so that
// they are in between columns
var splitters = this.getElementsByTagName("splitter");
for (i = 0; i < splitters.length; ++i)
- splitters[i].setAttribute("ordinal", (i+1)*2);
+ splitters[i].setAttribute("ordinal", (i + 1) * 2);
}
this._columnsDirty = false;
]]></body>
</method>
<method name="_reorderColumn">
<parameter name="aColMove"/>
<parameter name="aColBefore"/>
--- a/toolkit/content/widgets/videocontrols.xml
+++ b/toolkit/content/widgets/videocontrols.xml
@@ -1097,17 +1097,17 @@
hideClickToPlay : function () {
let videoHeight = this.video.clientHeight;
let videoWidth = this.video.clientWidth;
// The play button will animate to 3x its size. This
// shows the animation unless the video is too small
// to show 2/3 of the animation.
let animationScale = 2;
- if (this._overlayPlayButtonHeight * animationScale > (videoHeight - this._controlBarHeight)||
+ if (this._overlayPlayButtonHeight * animationScale > (videoHeight - this._controlBarHeight) ||
this._overlayPlayButtonWidth * animationScale > videoWidth) {
this.clickToPlay.setAttribute("immediate", "true");
this.clickToPlay.hidden = true;
} else {
this.clickToPlay.removeAttribute("immediate");
}
this.clickToPlay.setAttribute("fadeout", "true");
},
--- a/toolkit/crashreporter/CrashSubmit.jsm
+++ b/toolkit/crashreporter/CrashSubmit.jsm
@@ -290,17 +290,17 @@ Submitter.prototype = {
formData.append("upload_file_minidump", new File(this.dump.path));
if (this.memory) {
formData.append("memory_report", new File(this.memory.path));
}
if (this.additionalDumps.length > 0) {
let names = [];
for (let i of this.additionalDumps) {
names.push(i.name);
- formData.append("upload_file_minidump_"+i.name,
+ formData.append("upload_file_minidump_" + i.name,
new File(i.dump.path));
}
}
let manager = Services.crashmanager;
let submissionID = manager.generateSubmissionID();
xhr.addEventListener("readystatechange", (evt) => {
--- a/toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js
+++ b/toolkit/crashreporter/test/browser/browser_aboutCrashesResubmit.js
@@ -16,17 +16,17 @@ function cleanup_and_finish() {
*/
function check_crash_list(crashes) {
let doc = content.document;
let crashlinks = doc.getElementsByClassName("crashReport");
Assert.equal(crashlinks.length, crashes.length,
"about:crashes lists correct number of crash reports");
// no point in checking this if the lists aren't the same length
if (crashlinks.length == crashes.length) {
- for (let i=0; i<crashes.length; i++) {
+ for (let i = 0; i < crashes.length; i++) {
Assert.equal(crashlinks[i].id, crashes[i].id, i + ": crash ID is correct");
if (crashes[i].pending) {
// we set the breakpad.reportURL pref in test()
Assert.equal(crashlinks[i].getAttribute("href"),
"http://example.com/browser/toolkit/crashreporter/about/throttling",
"pending URL links to the correct static page");
}
}
--- a/toolkit/crashreporter/test/browser/head.js
+++ b/toolkit/crashreporter/test/browser/head.js
@@ -61,17 +61,17 @@ function cleanup_fake_appdir() {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]
.getService(Ci.nsIProperties);
dirSvc.QueryInterface(Ci.nsIDirectoryService)
.unregisterProvider(_provider);
// undefine our value so future calls get the real value
try {
dirSvc.undefine("UAppData");
} catch (ex) {
- dump("cleanup_fake_appdir: dirSvc.undefine failed: " + ex.message +"\n");
+ dump("cleanup_fake_appdir: dirSvc.undefine failed: " + ex.message + "\n");
}
}
function add_fake_crashes(crD, count) {
let results = [];
let uuidGenerator = Cc["@mozilla.org/uuid-generator;1"]
.getService(Ci.nsIUUIDGenerator);
let submitdir = crD.clone();
--- a/toolkit/crashreporter/test/unit/head_crashreporter.js
+++ b/toolkit/crashreporter/test/unit/head_crashreporter.js
@@ -48,17 +48,17 @@ function do_crash(setup, callback, canRe
let process = Components.classes["@mozilla.org/process/util;1"]
.createInstance(Components.interfaces.nsIProcess);
process.init(bin);
let args = ['-g', greD.path,
'-f', headfile.path];
if (setup) {
if (typeof(setup) == "function")
// funky, but convenient
- setup = "("+setup.toSource()+")();";
+ setup = "(" + setup.toSource() + ")();";
args.push('-e', setup);
}
args.push('-f', tailfile.path);
let env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
let crashD = do_get_tempdir();
@@ -142,17 +142,17 @@ function do_content_crash(setup, callbac
.getService(Components.interfaces.nsICrashReporter);
crashReporter.minidumpPath = do_get_tempdir();
let headfile = do_get_file("../unit/crasher_subprocess_head.js");
let tailfile = do_get_file("../unit/crasher_subprocess_tail.js");
if (setup) {
if (typeof(setup) == "function")
// funky, but convenient
- setup = "("+setup.toSource()+")();";
+ setup = "(" + setup.toSource() + ")();";
}
let handleCrash = function() {
try {
handleMinidump(callback);
} catch (x) {
do_report_unexpected_exception(x);
}
--- a/toolkit/identity/Identity.jsm
+++ b/toolkit/identity/Identity.jsm
@@ -247,17 +247,17 @@ IDService.prototype = {
* @param aScheme
* (string) (optional) Protocol to use. Default is https.
* This is necessary because we are unable to test
* https.
*
* @param aCallback
*
*/
- _fetchWellKnownFile: function _fetchWellKnownFile(aDomain, aCallback, aScheme='https') {
+ _fetchWellKnownFile: function _fetchWellKnownFile(aDomain, aCallback, aScheme = 'https') {
// XXX bug 769854 make tests https and remove aScheme option
let url = aScheme + '://' + aDomain + "/.well-known/browserid";
log("_fetchWellKnownFile:", url);
// this appears to be a more successful way to get at xmlhttprequest (which supposedly will close with a window
let req = Cc["@mozilla.org/xmlextras/xmlhttprequest;1"]
.createInstance(Ci.nsIXMLHttpRequest);
@@ -273,17 +273,17 @@ IDService.prototype = {
}
try {
let idpParams = req.response;
// Verify that the IdP returned a valid configuration
if (! (idpParams.provisioning &&
idpParams.authentication &&
idpParams['public-key'])) {
- let errStr= "Invalid well-known file from: " + aDomain;
+ let errStr = "Invalid well-known file from: " + aDomain;
log("_fetchWellKnownFile:", errStr);
return aCallback(errStr);
}
let callbackObj = {
domain: aDomain,
idpParams: idpParams,
};
--- a/toolkit/identity/jwcrypto.jsm
+++ b/toolkit/identity/jwcrypto.jsm
@@ -96,17 +96,17 @@ jwcryptoClass.prototype = {
* The number of milliseconds that must be added to the local clock
* for it to agree with the server. For example, if the local clock
* if two minutes fast, localtimeOffsetMsec would be -120000
*
* @param now (options)
* Current date in milliseconds. Useful for mocking clock
* skew in testing.
*/
- getExpiration: function(duration=DURATION_MS, localtimeOffsetMsec=0, now=Date.now()) {
+ getExpiration: function(duration = DURATION_MS, localtimeOffsetMsec = 0, now = Date.now()) {
return now + localtimeOffsetMsec + duration;
},
isCertValid: function(aCert, aCallback) {
// XXX check expiration, bug 769850
aCallback(true);
},
--- a/toolkit/modules/CharsetMenu.jsm
+++ b/toolkit/modules/CharsetMenu.jsm
@@ -115,17 +115,17 @@ function UpdateDetectorMenu(event) {
if (menuitem) {
menuitem.setAttribute("checked", "true");
}
}
var gDetectorInfoCache, gCharsetInfoCache, gPinnedInfoCache;
var CharsetMenu = {
- build: function(parent, deprecatedShowAccessKeys=true, showDetector=true) {
+ build: function(parent, deprecatedShowAccessKeys = true, showDetector = true) {
if (!deprecatedShowAccessKeys) {
Deprecated.warning("CharsetMenu no longer supports building a menu with no access keys.",
"https://bugzilla.mozilla.org/show_bug.cgi?id=1088710");
}
function createDOMNode(doc, nodeInfo) {
let node = doc.createElement("menuitem");
node.setAttribute("type", "radio");
node.setAttribute("name", nodeInfo.name + "Group");
@@ -185,17 +185,17 @@ var CharsetMenu = {
return kAutoDetectors.map(([detectorName, nodeId]) => ({
label: this._getDetectorLabel(detectorName),
accesskey: this._getDetectorAccesskey(detectorName),
name: "detector",
value: nodeId
}));
},
- getCharsetInfo: function(charsets, sort=true) {
+ getCharsetInfo: function(charsets, sort = true) {
let list = Array.from(charsets, charset => ({
label: this._getCharsetLabel(charset),
accesskey: this._getCharsetAccessKey(charset),
name: "charset",
value: charset
}));
if (sort) {
--- a/toolkit/modules/FinderHighlighter.jsm
+++ b/toolkit/modules/FinderHighlighter.jsm
@@ -1465,17 +1465,17 @@ FinderHighlighter.prototype = {
let range = this._findRange(fSelection, textNode, offset);
if (range) {
// If the text was inserted before the highlight
// adjust the highlight's bounds accordingly
if (textNode == range.startContainer &&
offset == range.startOffset) {
range.setStart(range.startContainer,
- range.startOffset+aString.length);
+ range.startOffset + aString.length);
} else if (textNode != range.endContainer ||
offset != range.endOffset) {
// The edit occurred within the highlight - any addition of text
// will result in the text no longer being a match,
// so remove the highlighting
fSelection.removeRange(range);
if (fSelection.rangeCount == 0) {
this._removeEditorListeners(editor);
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -331,17 +331,17 @@ function GMPAddon(addon) {
GMPAddon.prototype = {
/**
* Returns a string representation of the addon
*/
toString: function() {
return this.id + " (" +
"isValid: " + this.isValid +
", isInstalled: " + this.isInstalled +
- ", hashFunction: " + this.hashFunction+
+ ", hashFunction: " + this.hashFunction +
", hashValue: " + this.hashValue +
(this.size !== undefined ? ", size: " + this.size : "" ) +
")";
},
/**
* If all the fields aren't specified don't consider this addon valid
* @return true if the addon is parsed and valid
*/
--- a/toolkit/modules/Geometry.jsm
+++ b/toolkit/modules/Geometry.jsm
@@ -114,18 +114,18 @@ Rect.prototype = {
isEmpty: function isEmpty() {
return this.left >= this.right || this.top >= this.bottom;
},
setRect: function(x, y, w, h) {
this.left = x;
this.top = y;
- this.right = x+w;
- this.bottom = y+h;
+ this.right = x + w;
+ this.bottom = y + h;
return this;
},
setBounds: function(l, t, r, b) {
this.top = t;
this.left = l;
this.bottom = b;
@@ -223,17 +223,17 @@ Rect.prototype = {
expandToContain: function expandToContain(other) {
if (this.isEmpty()) return this.copyFrom(other);
if (other.isEmpty()) return this;
let l = Math.min(this.left, other.left);
let r = Math.max(this.right, other.right);
let t = Math.min(this.top, other.top);
let b = Math.max(this.bottom, other.bottom);
- return this.setRect(l, t, r-l, b-t);
+ return this.setRect(l, t, r - l, b - t);
},
/**
* Expands to the smallest rectangle that contains original rectangle and is bounded
* by lines with integer coefficients.
*/
expandToIntegers: function round() {
this.left = Math.floor(this.left);
--- a/toolkit/modules/Log.jsm
+++ b/toolkit/modules/Log.jsm
@@ -694,17 +694,17 @@ ParameterFormatter.prototype = {
/*
* Appenders
* These can be attached to Loggers to log to different places
* Simply subclass and override doAppend to implement a new one
*/
function Appender(formatter) {
this._name = "Appender";
- this._formatter = formatter? formatter : new BasicFormatter();
+ this._formatter = formatter ? formatter : new BasicFormatter();
}
Appender.prototype = {
level: Log.Level.All,
append: function App_append(message) {
if (message) {
this.doAppend(this._formatter.format(message));
}
@@ -917,17 +917,17 @@ FileAppender.prototype = {
/**
* Bounded File appender
*
* Writes output to file using OS.File. After the total message size
* (as defined by formatted.length) exceeds maxSize, existing messages
* will be discarded, and subsequent writes will be appended to a new log file.
*/
-function BoundedFileAppender(path, formatter, maxSize=2*ONE_MEGABYTE) {
+function BoundedFileAppender(path, formatter, maxSize = 2 * ONE_MEGABYTE) {
FileAppender.call(this, path, formatter);
this._name = "BoundedFileAppender";
this._size = 0;
this._maxSize = maxSize;
this._closeFilePromise = null;
}
BoundedFileAppender.prototype = {
--- a/toolkit/modules/NewTabUtils.jsm
+++ b/toolkit/modules/NewTabUtils.jsm
@@ -96,17 +96,17 @@ function LinksStorage() {
// regardless, so, on next upgrade, the migration steps will run again.
// For this reason, they should also be able to run multiple times, even
// on top of an already up-to-date storage.
}
} catch (ex) {
// Something went wrong in the update process, we can't recover from here,
// so just clear the storage and start from scratch (dataloss!).
Components.utils.reportError(
- "Unable to migrate the newTab storage to the current version. "+
+ "Unable to migrate the newTab storage to the current version. " +
"Restarting from scratch.\n" + ex);
this.clear();
}
// Set the version to the current one.
this._storedVersion = this._version;
}
@@ -423,20 +423,20 @@ var PinnedLinks = {
*/
unpin: function PinnedLinks_unpin(aLink) {
let index = this._indexOfLink(aLink);
if (index == -1)
return;
let links = this.links;
links[index] = null;
// trim trailing nulls
- let i=links.length-1;
+ let i = links.length - 1;
while (i >= 0 && links[i] == null)
i--;
- links.splice(i +1);
+ links.splice(i + 1);
this.save();
},
/**
* Saves the current list of pinned links.
*/
save: function PinnedLinks_save() {
Storage.set("pinnedLinks", this.links);
@@ -1016,17 +1016,17 @@ var Links = {
* Update the siteMap cache based on the link given and whether we need
* to increment or decrement it. We do this by iterating over all stored providers
* to find which provider this link already exists in. For providers that
* have this link, we will adjust siteMap for them accordingly.
*
* @param aLink The link that will affect siteMap
* @param increment A boolean for whether to increment or decrement siteMap
*/
- _adjustSiteMapAndNotify: function(aLink, increment=true) {
+ _adjustSiteMapAndNotify: function(aLink, increment = true) {
for (let [provider, cache] of this._providers) {
// We only update siteMap if aLink is already stored in linkMap.
if (cache.linkMap.get(aLink.url)) {
if (increment) {
this._incrementSiteMap(cache.siteMap, aLink);
continue;
}
this._decrementSiteMap(cache.siteMap, aLink);
@@ -1139,17 +1139,17 @@ var Links = {
* @param aProvider The provider whose link changed.
* @param aLink The link that changed. If the link is new, it must have all
* of the _sortProperties. Otherwise, it may have as few or as
* many as is convenient.
* @param aIndex The current index of the changed link in the sortedLinks
cache in _providers. Defaults to -1 if the provider doesn't know the index
* @param aDeleted Boolean indicating if the provider has deleted the link.
*/
- onLinkChanged: function Links_onLinkChanged(aProvider, aLink, aIndex=-1, aDeleted=false) {
+ onLinkChanged: function Links_onLinkChanged(aProvider, aLink, aIndex = -1, aDeleted = false) {
if (!("url" in aLink))
throw new Error("Changed links must have a url property");
let links = this._providers.get(aProvider);
if (!links)
// This is not an error, it just means that between the time the provider
// was added and the future time we call getLinks on it, it notified us of
// a change.
--- a/toolkit/modules/PopupNotifications.jsm
+++ b/toolkit/modules/PopupNotifications.jsm
@@ -129,17 +129,17 @@ Notification.prototype = {
get anchorElement() {
let iconBox = this.owner.iconBox;
let anchorElement = getAnchorFromBrowser(this.browser, this.anchorID);
if (!iconBox)
return anchorElement;
if (!anchorElement && this.anchorID)
- anchorElement = iconBox.querySelector("#"+this.anchorID);
+ anchorElement = iconBox.querySelector("#" + this.anchorID);
// Use a default anchor icon if it's available
if (!anchorElement)
anchorElement = iconBox.querySelector("#default-notification-icon") ||
iconBox;
return anchorElement;
},
@@ -769,17 +769,17 @@ PopupNotifications.prototype = {
this.panel.appendChild(popupnotification);
// The popupnotification may be hidden if we got it from the chrome
// document rather than creating it ad hoc.
popupnotification.hidden = false;
}, this);
},
- _setNotificationUIState(notification, state={}) {
+ _setNotificationUIState(notification, state = {}) {
notification.setAttribute("mainactiondisabled", state.disableMainAction || "false");
if (state.warningLabel) {
notification.setAttribute("warninglabel", state.warningLabel);
notification.setAttribute("warninghidden", "false");
} else {
notification.setAttribute("warninghidden", "true");
}
--- a/toolkit/modules/ProfileAge.jsm
+++ b/toolkit/modules/ProfileAge.jsm
@@ -66,48 +66,48 @@ this.ProfileAge.prototype = {
getPath: function (file) {
return OS.Path.join(this.profilePath, file);
},
/**
* Return a promise which resolves to the JSON contents
* of the time file, using the already read value if possible.
*/
- getTimes: function (file="times.json") {
+ getTimes: function (file = "times.json") {
if (this._times) {
return Promise.resolve(this._times);
}
return this.readTimes(file).then(
times => {
return this.times = times || {};
}
);
},
/**
* Return a promise which resolves to the JSON contents
* of the time file in this accessor's profile.
*/
- readTimes: function (file="times.json") {
+ readTimes: function (file = "times.json") {
return CommonUtils.readJSON(this.getPath(file));
},
/**
* Return a promise representing the writing of `contents`
* to `file` in the specified profile.
*/
- writeTimes: function (contents, file="times.json") {
+ writeTimes: function (contents, file = "times.json") {
return CommonUtils.writeJSON(contents, this.getPath(file));
},
/**
* Merge existing contents with a 'created' field, writing them
* to the specified file. Promise, naturally.
*/
- computeAndPersistCreated: function (existingContents, file="times.json") {
+ computeAndPersistCreated: function (existingContents, file = "times.json") {
let path = this.getPath(file);
function onOldest(oldest) {
let contents = existingContents || {};
contents.created = oldest;
this._times = contents;
return this.writeTimes(contents, path)
.then(function onSuccess() {
return oldest;
@@ -180,17 +180,17 @@ this.ProfileAge.prototype = {
/**
* Record (and persist) when a profile reset happened. We just store a
* single value - the timestamp of the most recent reset - but there is scope
* to keep a list of reset times should our health-reporter successor
* be able to make use of that.
* Returns a promise that is resolved once the file has been written.
*/
- recordProfileReset: function (time=Date.now(), file="times.json") {
+ recordProfileReset: function (time = Date.now(), file = "times.json") {
return this.getTimes(file).then(
times => {
times.reset = time;
return this.writeTimes(times, file);
}
);
},
--- a/toolkit/modules/Promise-backend.js
+++ b/toolkit/modules/Promise-backend.js
@@ -293,29 +293,29 @@ PendingErrors.addObserver(function(detai
let error = Cc['@mozilla.org/scripterror;1'].createInstance(Ci.nsIScriptError);
if (!error || !Services.console) {
// Too late during shutdown to use the nsIConsole
dump("*************************\n");
dump(generalDescription);
dump("On: " + details.date + "\n");
dump("Full message: " + details.message + "\n");
- dump("Full stack: " + (details.stack||"not available") + "\n");
+ dump("Full stack: " + (details.stack || "not available") + "\n");
dump("*************************\n");
return;
}
let message = details.message;
if (details.stack) {
message += "\nFull Stack: " + details.stack;
}
error.init(
/* message*/ generalDescription +
"Date: " + details.date + "\nFull Message: " + message,
/* sourceName*/ details.fileName,
- /* sourceLine*/ details.lineNumber?("" + details.lineNumber):0,
+ /* sourceLine*/ details.lineNumber ? ("" + details.lineNumber) : 0,
/* lineNumber*/ details.lineNumber || 0,
/* columnNumber*/ 0,
/* flags*/ Ci.nsIScriptError.errorFlag,
/* category*/ "chrome javascript");
Services.console.logMessage(error);
});
@@ -945,21 +945,21 @@ Handler.prototype = {
// We suspect that the exception is a programmer error, so we now
// display it using dump(). Note that we do not use Cu.reportError as
// we assume that this is a programming error, so we do not want end
// users to see it. Also, if the programmer handles errors correctly,
// they will either treat the error or log them somewhere.
dump("*************************\n");
dump("A coding exception was thrown in a Promise " +
- ((nextStatus == STATUS_RESOLVED) ? "resolution":"rejection") +
+ ((nextStatus == STATUS_RESOLVED) ? "resolution" : "rejection") +
" callback.\n");
dump("See https://developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise\n\n");
dump("Full message: " + ex + "\n");
- dump("Full stack: " + (("stack" in ex)?ex.stack:"not available") + "\n");
+ dump("Full stack: " + (("stack" in ex) ? ex.stack : "not available") + "\n");
dump("*************************\n");
}
// Additionally, reject the next promise.
nextStatus = STATUS_REJECTED;
nextValue = ex;
}
--- a/toolkit/modules/SpatialNavigation.jsm
+++ b/toolkit/modules/SpatialNavigation.jsm
@@ -52,17 +52,17 @@ function dump(a) {
function dumpRect(desc, rect) {
dump(desc + " " + Math.round(rect.left) + " " + Math.round(rect.top) + " " +
Math.round(rect.right) + " " + Math.round(rect.bottom) + " width:" +
Math.round(rect.width) + " height:" + Math.round(rect.height));
}
function dumpNodeCoord(desc, node) {
let rect = node.getBoundingClientRect();
- dump(desc + " " + node.tagName + " x:" + Math.round(rect.left + rect.width/2) +
+ dump(desc + " " + node.tagName + " x:" + Math.round(rect.left + rect.width / 2) +
" y:" + Math.round(rect.top + rect.height / 2));
}
// modifier values
const kAlt = "alt";
const kShift = "shift";
const kCtrl = "ctrl";
--- a/toolkit/modules/Sqlite.jsm
+++ b/toolkit/modules/Sqlite.jsm
@@ -202,17 +202,17 @@ XPCOMUtils.defineLazyGetter(this, "Barri
* a garbage collection of a finalization witness in
* OpenedConnection. When the witness detects a garbage collection,
* this object can be used to close the connection.
*
* This object contains more methods than just `close`. When
* OpenedConnection needs to use the methods in this object, it will
* dispatch its method calls here.
*/
-function ConnectionData(connection, identifier, options={}) {
+function ConnectionData(connection, identifier, options = {}) {
this._log = Log.repository.getLoggerWithMessagePrefix("Sqlite.Connection",
identifier + ": ");
this._log.info("Opened");
this._dbConn = connection;
// This is a unique identifier for the connection, generated through
// getIdentifierByPath. It may be used for logging or as a key in Maps.
@@ -402,17 +402,17 @@ ConnectionData.prototype = Object.freeze
return this._barrier.wait().then(() => {
if (!this._dbConn) {
return undefined;
}
return this._finalize();
});
},
- clone: function (readOnly=false) {
+ clone: function (readOnly = false) {
this.ensureOpen();
this._log.debug("Request to clone connection.");
let options = {
connection: this._dbConn,
readOnly: readOnly,
};
@@ -466,17 +466,17 @@ ConnectionData.prototype = Object.freeze
} else {
this._log.debug("Calling asyncClose().");
this._dbConn.asyncClose(markAsClosed);
this._dbConn = null;
}
return this._deferredClose.promise;
},
- executeCached: function (sql, params=null, onRow=null) {
+ executeCached: function (sql, params = null, onRow = null) {
this.ensureOpen();
if (!sql) {
throw new Error("sql argument is empty.");
}
let statement = this._cachedStatements.get(sql);
if (!statement) {
@@ -500,17 +500,17 @@ ConnectionData.prototype = Object.freeze
);
} catch (ex) {
this._startIdleShrinkTimer();
throw ex;
}
});
},
- execute: function (sql, params=null, onRow=null) {
+ execute: function (sql, params = null, onRow = null) {
if (typeof(sql) != "string") {
throw new Error("Must define SQL to execute as a string: " + sql);
}
this.ensureOpen();
let statement = this._dbConn.createAsyncStatement(sql);
let index = this._anonymousCounter++;
@@ -1128,17 +1128,17 @@ function wrapStorageConnection(options)
* (mozIStorageConnection) Underlying SQLite connection.
* @param identifier
* (string) The unique identifier of this database. It may be used for
* logging or as a key in Maps.
* @param options [optional]
* (object) Options to control behavior of connection. See
* `openConnection`.
*/
-function OpenedConnection(connection, identifier, options={}) {
+function OpenedConnection(connection, identifier, options = {}) {
// Store all connection data in a field distinct from the
// witness. This enables us to store an additional reference to this
// field without preventing garbage collection of
// OpenedConnection. On garbage collection, we will still be able to
// close the database using this extra reference.
this._connectionData = new ConnectionData(connection, identifier, options);
// Store the extra reference in a map with connection identifier as
@@ -1228,17 +1228,17 @@ OpenedConnection.prototype = Object.free
* (boolean) - If true the clone will be read-only. If the original
* connection is already read-only, the clone will be, regardless of
* this option. If the original connection is using the shared cache,
* this parameter will be ignored and the clone will be as privileged as
* the original connection.
*
* @return Promise<OpenedConnection>
*/
- clone: function (readOnly=false) {
+ clone: function (readOnly = false) {
return this._connectionData.clone(readOnly);
},
executeBeforeShutdown: function(name, task) {
return this._connectionData.executeBeforeShutdown(this, name, task);
},
/**
@@ -1294,17 +1294,17 @@ OpenedConnection.prototype = Object.free
*
* @param name
* (string) The name of the registered statement to execute.
* @param params optional
* (Array or object) Parameters to bind.
* @param onRow optional
* (function) Callback to receive each row from result.
*/
- executeCached: function (sql, params=null, onRow=null) {
+ executeCached: function (sql, params = null, onRow = null) {
if (isInvalidBoundLikeQuery(sql)) {
throw new Error("Please enter a LIKE clause with bindings");
}
return this._connectionData.executeCached(sql, params, onRow);
},
/**
* Execute a one-shot SQL statement.
@@ -1316,17 +1316,17 @@ OpenedConnection.prototype = Object.free
*
* @param sql
* (string) SQL to execute.
* @param params optional
* (Array or Object) Parameters to bind to the statement.
* @param onRow optional
* (function) Callback to receive result of a single row.
*/
- execute: function (sql, params=null, onRow=null) {
+ execute: function (sql, params = null, onRow = null) {
if (isInvalidBoundLikeQuery(sql)) {
throw new Error("Please enter a LIKE clause with bindings");
}
return this._connectionData.execute(sql, params, onRow);
},
/**
* Whether a transaction is currently in progress.
@@ -1368,17 +1368,17 @@ OpenedConnection.prototype = Object.free
* be resolved to whatever value the supplied function resolves to. If
* the transaction is rolled back, the promise is rejected.
*
* @param func
* (function) What to perform as part of the transaction.
* @param type optional
* One of the TRANSACTION_* constants attached to this type.
*/
- executeTransaction: function (func, type=this.TRANSACTION_DEFERRED) {
+ executeTransaction: function (func, type = this.TRANSACTION_DEFERRED) {
if (this.TRANSACTION_TYPES.indexOf(type) == -1) {
throw new Error("Unknown transaction type: " + type);
}
return this._connectionData.executeTransaction(() => func(this), type);
},
/**
--- a/toolkit/modules/WindowsRegistry.jsm
+++ b/toolkit/modules/WindowsRegistry.jsm
@@ -18,17 +18,17 @@ var WindowsRegistry = {
* @param aKey
* The key name.
* @param [aRegistryNode=0]
* Optionally set to nsIWindowsRegKey.WOW64_64 (or nsIWindowsRegKey.WOW64_32)
* to access a 64-bit (32-bit) key from either a 32-bit or 64-bit application.
* @return The key value or undefined if it doesn't exist. If the key is
* a REG_MULTI_SZ, an array is returned.
*/
- readRegKey: function(aRoot, aPath, aKey, aRegistryNode=0) {
+ readRegKey: function(aRoot, aPath, aKey, aRegistryNode = 0) {
const kRegMultiSz = 7;
const kMode = Ci.nsIWindowsRegKey.ACCESS_READ | aRegistryNode;
let registry = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
try {
registry.open(aRoot, aPath, kMode);
if (registry.hasValue(aKey)) {
let type = registry.getValueType(aKey);
@@ -61,17 +61,17 @@ var WindowsRegistry = {
* The registry path to the key.
* @param aKey
* The key name.
* @param [aRegistryNode=0]
* Optionally set to nsIWindowsRegKey.WOW64_64 (or nsIWindowsRegKey.WOW64_32)
* to access a 64-bit (32-bit) key from either a 32-bit or 64-bit application.
* @return True if the key was removed or never existed, false otherwise.
*/
- removeRegKey: function(aRoot, aPath, aKey, aRegistryNode=0) {
+ removeRegKey: function(aRoot, aPath, aKey, aRegistryNode = 0) {
let registry = Cc["@mozilla.org/windows-registry-key;1"].
createInstance(Ci.nsIWindowsRegKey);
let result = false;
try {
let mode = Ci.nsIWindowsRegKey.ACCESS_QUERY_VALUE |
Ci.nsIWindowsRegKey.ACCESS_SET_VALUE |
aRegistryNode;
registry.open(aRoot, aPath, mode);
--- a/toolkit/modules/tests/PromiseTestUtils.jsm
+++ b/toolkit/modules/tests/PromiseTestUtils.jsm
@@ -215,17 +215,17 @@ this.PromiseTestUtils = {
this._rejectionIgnoreFns.splice(index, 1);
continue;
}
// Report the error. This operation can throw an exception, depending on
// the configuration of the test suite that handles the assertion.
Assert.ok(false,
`A promise chain failed to handle a rejection:` +
- ` ${rejection.message} - rejection date: ${rejection.date}`+
+ ` ${rejection.message} - rejection date: ${rejection.date}` +
` - stack: ${rejection.stack}`);
}
},
/**
* Fails the test if any rejection indicated by expectUncaughtRejection has
* not yet been reported at this time.
*
--- a/toolkit/modules/tests/browser/browser_Troubleshoot.js
+++ b/toolkit/modules/tests/browser/browser_Troubleshoot.js
@@ -505,17 +505,17 @@ function validateObject_object(obj, sche
// Don't care what obj's properties are.
return;
// First check that all the schema's properties match the object.
for (let prop in schema.properties)
validateObject(obj[prop], schema.properties[prop]);
// Now check that the object doesn't have any properties not in the schema.
for (let prop in obj)
if (!(prop in schema.properties))
- throw validationErr("Object has property "+prop+" not in schema", obj, schema);
+ throw validationErr("Object has property " + prop + " not in schema", obj, schema);
}
function validateObject_array(array, schema) {
if (typeof(schema.items) != "object")
// Don't care what the array's elements are.
return;
array.forEach(elt => validateObject(elt, schema.items));
}
--- a/toolkit/modules/tests/xpcshell/test_DeferredTask.js
+++ b/toolkit/modules/tests/xpcshell/test_DeferredTask.js
@@ -55,41 +55,41 @@ add_test(function test_arm_simple()
add_test(function test_arm_delay_respected()
{
let executed1 = false;
let executed2 = false;
new DeferredTask(function () {
executed1 = true;
do_check_false(executed2);
- }, 1*T).arm();
+ }, 1 * T).arm();
new DeferredTask(function () {
executed2 = true;
do_check_true(executed1);
run_next_test();
- }, 2*T).arm();
+ }, 2 * T).arm();
});
/**
* 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());
+ do_timeout(2 * T, () => deferredTask.arm());
// The "arm" call should not have introduced further delays.
- do_timeout(5*T, function () {
+ do_timeout(5 * T, function () {
do_check_true(executed);
run_next_test();
});
});
/**
* Checks that a task runs only once when armed multiple times synchronously.
*/
@@ -150,121 +150,121 @@ add_test(function test_arm_recursive()
*/
add_test(function test_arm_async()
{
let finishedExecution = false;
let finishedExecutionAgain = false;
// Create a task that will run later.
let deferredTask = new DeferredTask(function* () {
- yield promiseTimeout(4*T);
+ yield promiseTimeout(4 * T);
if (!finishedExecution) {
finishedExecution = true;
} else if (!finishedExecutionAgain) {
finishedExecutionAgain = true;
}
- }, 2*T);
+ }, 2 * T);
deferredTask.arm();
// While the task is running, call "arm" again. This will result in a wait
// of 2*T until the task finishes, then another 2*T for the normal task delay
// specified on construction.
- do_timeout(4*T, function () {
+ do_timeout(4 * T, function () {
do_check_true(deferredTask.isRunning);
do_check_false(finishedExecution);
deferredTask.arm();
});
// This will fail in case the task was started without waiting 2*T after it
// has finished.
- do_timeout(7*T, function () {
+ do_timeout(7 * T, function () {
do_check_false(deferredTask.isRunning);
do_check_true(finishedExecution);
});
// This is in the middle of the second execution.
- do_timeout(10*T, function () {
+ do_timeout(10 * T, function () {
do_check_true(deferredTask.isRunning);
do_check_false(finishedExecutionAgain);
});
// Wait enough time to verify that the task was executed as expected.
- do_timeout(13*T, function () {
+ do_timeout(13 * T, function () {
do_check_false(deferredTask.isRunning);
do_check_true(finishedExecutionAgain);
run_next_test();
});
});
/**
* Checks that an armed task can be disarmed.
*/
add_test(function test_disarm()
{
// Create a task that will run later.
let deferredTask = new DeferredTask(function () {
do_throw("This task should not run.");
- }, 2*T);
+ }, 2 * T);
deferredTask.arm();
// Disable execution later, but before the task starts.
- do_timeout(1*T, () => deferredTask.disarm());
+ do_timeout(1 * T, () => deferredTask.disarm());
// Wait enough time to verify that the task did not run.
- do_timeout(3*T, run_next_test);
+ do_timeout(3 * T, run_next_test);
});
/**
* 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 () {
+ do_timeout(2 * T, function () {
deferredTask.disarm();
deferredTask.arm();
});
- do_timeout(5*T, function () {
+ do_timeout(5 * T, function () {
do_check_false(executed);
});
- do_timeout(7*T, function () {
+ do_timeout(7 * T, function () {
do_check_true(executed);
run_next_test();
});
});
/**
* Checks that calling "disarm" while an asynchronous task is running does not
* prevent the task to finish.
*/
add_test(function test_disarm_async()
{
let finishedExecution = false;
let deferredTask = new DeferredTask(function* () {
deferredTask.arm();
- yield promiseTimeout(2*T);
+ yield promiseTimeout(2 * T);
finishedExecution = true;
- }, 1*T);
+ }, 1 * T);
deferredTask.arm();
- do_timeout(2*T, function () {
+ do_timeout(2 * T, function () {
do_check_true(deferredTask.isRunning);
do_check_true(deferredTask.isArmed);
do_check_false(finishedExecution);
deferredTask.disarm();
});
- do_timeout(4*T, function () {
+ do_timeout(4 * T, function () {
do_check_false(deferredTask.isRunning);
do_check_false(deferredTask.isArmed);
do_check_true(finishedExecution);
run_next_test();
});
});
/**
@@ -273,28 +273,28 @@ add_test(function test_disarm_async()
*/
add_test(function test_disarm_immediate_async()
{
let executed = false;
let deferredTask = new DeferredTask(function* () {
do_check_false(executed);
executed = true;
- yield promiseTimeout(2*T);
- }, 1*T);
+ yield promiseTimeout(2 * T);
+ }, 1 * T);
deferredTask.arm();
- do_timeout(2*T, function () {
+ do_timeout(2 * T, function () {
do_check_true(deferredTask.isRunning);
do_check_false(deferredTask.isArmed);
deferredTask.arm();
deferredTask.disarm();
});
- do_timeout(4*T, function () {
+ do_timeout(4 * T, function () {
do_check_true(executed);
do_check_false(deferredTask.isRunning);
do_check_false(deferredTask.isArmed);
run_next_test();
});
});
/**
@@ -324,20 +324,20 @@ add_test(function test_isArmed_isRunning
add_test(function test_finalize()
{
let executed = false;
let timePassed = false;
let deferredTask = new DeferredTask(function () {
do_check_false(timePassed);
executed = true;
- }, 2*T);
+ }, 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();
});
});
@@ -367,24 +367,24 @@ 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);
+ yield promiseTimeout(1 * T);
// Just before finishing, indicate if we completed the second execution.
if (executed) {
do_check_true(deferredTask.isRunning);
executedAgain = true;
} else {
executed = true;
}
- }, 2*T);
+ }, 2 * T);
deferredTask.arm();
});
--- a/toolkit/modules/tests/xpcshell/test_NewTabUtils.js
+++ b/toolkit/modules/tests/xpcshell/test_NewTabUtils.js
@@ -324,17 +324,17 @@ function TestProvider(getLinksFn) {
this.getLinks = getLinksFn;
this._observers = new Set();
}
TestProvider.prototype = {
addObserver: function (observer) {
this._observers.add(observer);
},
- notifyLinkChanged: function (link, index=-1, deleted=false) {
+ notifyLinkChanged: function (link, index = -1, deleted = false) {
this._notifyObservers("onLinkChanged", link, index, deleted);
},
notifyManyLinksChanged: function () {
this._notifyObservers("onManyLinksChanged");
},
_notifyObservers: function () {
let observerMethodName = arguments[0];
let args = Array.prototype.slice.call(arguments, 1);
--- a/toolkit/modules/tests/xpcshell/test_Promise.js
+++ b/toolkit/modules/tests/xpcshell/test_Promise.js
@@ -118,17 +118,17 @@ tests.push(make_promise_test(
if (--expected == 0) {
result.resolve();
}
}));
};
// Install a number of observers before resolving
let i;
- for (i = 0; i < SIZE/2; ++i) {
+ for (i = 0; i < SIZE / 2; ++i) {
install_observer(i);
}
source.resolve(RESULT);
// Install remaining observers
for (;i < SIZE; ++i) {
install_observer(i);
@@ -246,17 +246,17 @@ tests.push(make_promise_test(
if (--expected == 0) {
result.resolve();
}
}));
};
// Install a number of observers before resolving
let i;
- for (i = 0; i < SIZE/2; ++i) {
+ for (i = 0; i < SIZE / 2; ++i) {
install_observer(i);
}
observed.resolve(RESULT);
// Install remaining observers
for (;i < SIZE; ++i) {
install_observer(i);
--- a/toolkit/modules/tests/xpcshell/test_session_recorder.js
+++ b/toolkit/modules/tests/xpcshell/test_session_recorder.js
@@ -10,17 +10,17 @@ Cu.import("resource://gre/modules/Sessio
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://services-common/utils.js");
function run_test() {
run_next_test();
}
-function monkeypatchStartupInfo(recorder, start=new Date(), offset=500) {
+function monkeypatchStartupInfo(recorder, start = new Date(), offset = 500) {
Object.defineProperty(recorder, "_getStartupInfo", {
value: function _getStartupInfo() {
return {
process: start,
main: new Date(start.getTime() + offset),
firstPaint: new Date(start.getTime() + 2 * offset),
sessionRestored: new Date(start.getTime() + 3 * offset),
};
@@ -240,17 +240,17 @@ add_task(function* test_multiple_session
let sessions = recorder.getPreviousSessions();
do_check_eq(Object.keys(sessions).length, 10);
for (let [i, session] of Object.entries(sessions)) {
do_check_eq(session.activeTicks, i);
if (i > 0) {
- do_check_true(session.startDate.getTime() > sessions[i-1].startDate.getTime());
+ do_check_true(session.startDate.getTime() > sessions[i - 1].startDate.getTime());
}
}
// #6 is preserved since >=.
let threshold = sessions[6].startDate;
recorder.pruneOldSessions(threshold);
sessions = recorder.getPreviousSessions();
--- a/toolkit/modules/tests/xpcshell/test_sqlite.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite.js
@@ -35,44 +35,44 @@ function sleep(ms) {
}
// When testing finalization, use this to tell Sqlite.jsm to not throw
// an uncatchable `Promise.reject`
function failTestsOnAutoClose(enabled) {
Cu.getGlobalForObject(Sqlite).Debugging.failTestsOnAutoClose = enabled;
}
-function getConnection(dbName, extraOptions={}) {
+function getConnection(dbName, extraOptions = {}) {
let path = dbName + ".sqlite";
let options = {path: path};
for (let [k, v] of Object.entries(extraOptions)) {
options[k] = v;
}
return Sqlite.openConnection(options);
}
-function* getDummyDatabase(name, extraOptions={}) {
+function* getDummyDatabase(name, extraOptions = {}) {
const TABLES = {
dirs: "id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT",
files: "id INTEGER PRIMARY KEY AUTOINCREMENT, dir_id INTEGER, path TEXT",
};
let c = yield getConnection(name, extraOptions);
c._initialStatementCount = 0;
for (let [k, v] of Object.entries(TABLES)) {
yield c.execute("CREATE TABLE " + k + "(" + v + ")");
c._initialStatementCount++;
}
return c;
}
-function* getDummyTempDatabase(name, extraOptions={}) {
+function* getDummyTempDatabase(name, extraOptions = {}) {
const TABLES = {
dirs: "id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT",
files: "id INTEGER PRIMARY KEY AUTOINCREMENT, dir_id INTEGER, path TEXT",
};
let c = yield getConnection(name, extraOptions);
c._initialStatementCount = 0;
--- a/toolkit/modules/tests/xpcshell/test_sqlite_shutdown.js
+++ b/toolkit/modules/tests/xpcshell/test_sqlite_shutdown.js
@@ -10,27 +10,27 @@ do_get_profile();
Cu.import("resource://gre/modules/osfile.jsm");
// OS.File doesn't like to be first imported during shutdown
Cu.import("resource://gre/modules/Sqlite.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/AsyncShutdown.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
-function getConnection(dbName, extraOptions={}) {
+function getConnection(dbName, extraOptions = {}) {
let path = dbName + ".sqlite";
let options = {path: path};
for (let [k, v] of Object.entries(extraOptions)) {
options[k] = v;
}
return Sqlite.openConnection(options);
}
-function* getDummyDatabase(name, extraOptions={}) {
+function* getDummyDatabase(name, extraOptions = {}) {
const TABLES = {
dirs: "id INTEGER PRIMARY KEY AUTOINCREMENT, path TEXT",
files: "id INTEGER PRIMARY KEY AUTOINCREMENT, dir_id INTEGER, path TEXT",
};
let c = yield getConnection(name, extraOptions);
c._initialStatementCount = 0;
--- a/toolkit/mozapps/extensions/content/extensions.xml
+++ b/toolkit/mozapps/extensions/content/extensions.xml
@@ -104,17 +104,17 @@
<method name="_hover">
<parameter name="aScore"/>
<body><![CDATA[
if (this.showRating != "user")
return;
var stars = this.stars;
for (let i = 0; i < stars.length; i++)
- stars[i].setAttribute("on", i <= (aScore -1));
+ stars[i].setAttribute("on", i <= (aScore - 1));
]]></body>
</method>
</implementation>
<handlers>
<handler event="mouseout">
this._updateStars();
--- a/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
+++ b/toolkit/mozapps/extensions/internal/XPIProviderUtils.js
@@ -87,17 +87,17 @@ const PROP_JSON_FIELDS = ["id", "syncGUI
"softDisabled", "foreignInstall", "hasBinaryComponents",
"strictCompatibility", "locales", "targetApplications",
"targetPlatforms", "multiprocessCompatible", "signedState",
"seen", "dependencies", "hasEmbeddedWebExtension"];
// Properties that should be migrated where possible from an old database. These
// shouldn't include properties that can be read directly from install.rdf files
// or calculated
-const DB_MIGRATE_METADATA= ["installDate", "userDisabled", "softDisabled",
+const DB_MIGRATE_METADATA = ["installDate", "userDisabled", "softDisabled",
"sourceURI", "applyBackgroundUpdates",
"releaseNotesURI", "foreignInstall", "syncGUID"];
// Time to wait before async save of XPI JSON database, in milliseconds
const ASYNC_SAVE_DELAY_MS = 20;
const PREFIX_ITEM_URI = "urn:mozilla:item:";
const RDFURI_ITEM_ROOT = "urn:mozilla:item:root"
--- a/toolkit/mozapps/extensions/test/browser/head.js
+++ b/toolkit/mozapps/extensions/test/browser/head.js
@@ -546,17 +546,17 @@ function promiseAddonsByIDs(aIDs) {
AddonManager.getAddonsByIDs(aIDs, resolve);
});
}
/**
* Install an add-on and call a callback when complete.
*
* The callback will receive the Addon for the installed add-on.
*/
-function install_addon(path, cb, pathPrefix=TESTROOT) {
+function install_addon(path, cb, pathPrefix = TESTROOT) {
let p = new Promise((resolve, reject) => {
AddonManager.getInstallForURL(pathPrefix + path, (install) => {
install.addListener({
onInstallEnded: () => resolve(install.addon),
});
install.install();
}, "application/x-xpinstall");
--- a/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_backgroundupdate.js
@@ -84,17 +84,17 @@ function run_test_2() {
minVersion: "1",
maxVersion: "1"
}],
name: "Test Addon 3",
}, profileDir);
// Background update uses a different pref, if set
Services.prefs.setCharPref("extensions.update.background.url",
- "http://localhost:" + gPort +"/data/test_backgroundupdate.rdf");
+ "http://localhost:" + gPort + "/data/test_backgroundupdate.rdf");
restartManager();
// Do hotfix checks
Services.prefs.setCharPref("extensions.hotfix.id", "hotfix@tests.mozilla.org");
Services.prefs.setCharPref("extensions.hotfix.url", "http://localhost:" + gPort + "/missing.rdf");
let installCount = 0;
let completeCount = 0;
--- a/toolkit/mozapps/extensions/test/xpcshell/test_bug324121.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_bug324121.js
@@ -6,17 +6,17 @@
// Disables security checking our updates which haven't been signed
Services.prefs.setBoolPref("extensions.checkUpdateSecurity", false);
// Get the HTTP server.
Components.utils.import("resource://testing-common/httpd.js");
var testserver;
var next_test = null;
-var gItemsNotChecked =[];
+var gItemsNotChecked = [];
var ADDONS = [ {id: "bug324121_1@tests.mozilla.org",
addon: "test_bug324121_1",
shouldCheck: false },
{id: "bug324121_2@tests.mozilla.org",
addon: "test_bug324121_2",
shouldCheck: true },
{id: "bug324121_3@tests.mozilla.org",
--- a/toolkit/mozapps/extensions/test/xpcshell/test_startup.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_startup.js
@@ -279,21 +279,21 @@ function run_test_1() {
});
}
// Test that modified items are detected and items in other install locations
// are ignored
function run_test_2() {
addon1.version = "1.1";
writeInstallRDFForExtension(addon1, userDir);
- addon2.version="2.1";
+ addon2.version = "2.1";
writeInstallRDFForExtension(addon2, profileDir);
- addon2.version="2.2";
+ addon2.version = "2.2";
writeInstallRDFForExtension(addon2, globalDir);
- addon2.version="2.3";
+ addon2.version = "2.3";
writeInstallRDFForExtension(addon2, userDir);
var dest = profileDir.clone();
dest.append(do_get_expected_addon_name("addon3@tests.mozilla.org"));
dest.remove(true);
gCachePurged = false;
restartManager();
check_startup_changes(AddonManager.STARTUP_CHANGE_INSTALLED, []);
--- a/toolkit/mozapps/extensions/test/xpcshell/test_strictcompatibility.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_strictcompatibility.js
@@ -78,17 +78,17 @@ var addon6 = {
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.1",
maxVersion: "0.2"
}]
};
// Dictionary - incompatible in strict compatibility mode
-var addon7= {
+var addon7 = {
id: "addon7@tests.mozilla.org",
version: "1.0",
name: "Test 7",
type: "64",
targetApplications: [{
id: "xpcshell@tests.mozilla.org",
minVersion: "0.8",
maxVersion: "0.9"
--- a/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_webextension.js
@@ -246,17 +246,17 @@ add_task(function*() {
let installrdf_id = "first-webextension2@tests.mozilla.org";
let first_addon = yield promiseAddonByID(installrdf_id);
do_check_neq(first_addon, null);
do_check_false(first_addon.appDisabled);
do_check_true(first_addon.isActive);
do_check_false(first_addon.isSystem);
- let manifestjson_id= "last-webextension2@tests.mozilla.org";
+ let manifestjson_id = "last-webextension2@tests.mozilla.org";
let last_addon = yield promiseAddonByID(manifestjson_id);
do_check_eq(last_addon, null);
yield promiseRestartManager();
});
// Test that the "options_ui" manifest section is processed correctly.
add_task(function* test_options_ui() {
--- a/toolkit/mozapps/preferences/changemp.js
+++ b/toolkit/mozapps/preferences/changemp.js
@@ -9,17 +9,17 @@ const nsIPK11TokenDB = Components.interf
const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
const nsPKCS11ModuleDB = "@mozilla.org/security/pkcs11moduledb;1";
const nsIPKCS11ModuleDB = Components.interfaces.nsIPKCS11ModuleDB;
const nsIPKCS11Slot = Components.interfaces.nsIPKCS11Slot;
const nsIPK11Token = Components.interfaces.nsIPK11Token;
var params;
-var tokenName="";
+var tokenName = "";
var pw1;
function init()
{
pw1 = document.getElementById("pw1");
process();
}
@@ -158,65 +158,65 @@ function setPassword()
function setPasswordStrength()
{
// Here is how we weigh the quality of the password
// number of characters
// numbers
// non-alpha-numeric chars
// upper and lower case characters
- var pw=document.getElementById('pw1').value;
+ var pw = document.getElementById('pw1').value;
// length of the password
- var pwlength=(pw.length);
- if (pwlength>5)
- pwlength=5;
+ var pwlength = (pw.length);
+ if (pwlength > 5)
+ pwlength = 5;
// use of numbers in the password
var numnumeric = pw.replace (/[0-9]/g, "");
- var numeric=(pw.length - numnumeric.length);
- if (numeric>3)
- numeric=3;
+ var numeric = (pw.length - numnumeric.length);
+ if (numeric > 3)
+ numeric = 3;
// use of symbols in the password
var symbols = pw.replace (/\W/g, "");
- var numsymbols=(pw.length - symbols.length);
- if (numsymbols>3)
- numsymbols=3;
+ var numsymbols = (pw.length - symbols.length);
+ if (numsymbols > 3)
+ numsymbols = 3;
// use of uppercase in the password
var numupper = pw.replace (/[A-Z]/g, "");
- var upper=(pw.length - numupper.length);
- if (upper>3)
- upper=3;
+ var upper = (pw.length - numupper.length);
+ if (upper > 3)
+ upper = 3;
- var pwstrength=((pwlength*10)-20) + (numeric*10) + (numsymbols*15) + (upper*10);
+ var pwstrength = ((pwlength * 10) - 20) + (numeric * 10) + (numsymbols * 15) + (upper * 10);
// make sure we're give a value between 0 and 100
if ( pwstrength < 0 ) {
pwstrength = 0;
}
if ( pwstrength > 100 ) {
pwstrength = 100;
}
- var mymeter=document.getElementById('pwmeter');
+ var mymeter = document.getElementById('pwmeter');
mymeter.value = pwstrength;
return;
}
function checkPasswords()
{
- var pw1=document.getElementById('pw1').value;
- var pw2=document.getElementById('pw2').value;
- var ok=document.documentElement.getButton("accept");
+ var pw1 = document.getElementById('pw1').value;
+ var pw2 = document.getElementById('pw2').value;
+ var ok = document.documentElement.getButton("accept");
var oldpwbox = document.getElementById("oldpw");
if (oldpwbox) {
var initpw = oldpwbox.getAttribute("inited");
if (initpw == "empty" && pw1 == "") {
// The token has already been initialized, therefore this dialog
// was called with the intention to change the password.