Bug 1528751 - Add a custom eslint rule to check "consistent" if bracing. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D20753
This commit is contained in:
@@ -93,8 +93,9 @@ var tabPreviewPanelHelper = {
|
|||||||
if (host._prevFocus) {
|
if (host._prevFocus) {
|
||||||
Services.focus.setFocus(host._prevFocus, Ci.nsIFocusManager.FLAG_NOSCROLL);
|
Services.focus.setFocus(host._prevFocus, Ci.nsIFocusManager.FLAG_NOSCROLL);
|
||||||
host._prevFocus = null;
|
host._prevFocus = null;
|
||||||
} else
|
} else {
|
||||||
gBrowser.selectedBrowser.focus();
|
gBrowser.selectedBrowser.focus();
|
||||||
|
}
|
||||||
|
|
||||||
if (host.tabToSelect) {
|
if (host.tabToSelect) {
|
||||||
gBrowser.selectedTab = host.tabToSelect;
|
gBrowser.selectedTab = host.tabToSelect;
|
||||||
|
|||||||
@@ -517,9 +517,9 @@ var FullScreen = {
|
|||||||
// toggles chrome when moving mouse to the top, it doesn't go away again.
|
// toggles chrome when moving mouse to the top, it doesn't go away again.
|
||||||
if (aEvent.type == "popupshown" && !FullScreen._isChromeCollapsed &&
|
if (aEvent.type == "popupshown" && !FullScreen._isChromeCollapsed &&
|
||||||
aEvent.target.localName != "tooltip" && aEvent.target.localName != "window" &&
|
aEvent.target.localName != "tooltip" && aEvent.target.localName != "window" &&
|
||||||
aEvent.target.getAttribute("nopreventnavboxhide") != "true")
|
aEvent.target.getAttribute("nopreventnavboxhide") != "true") {
|
||||||
FullScreen._isPopupOpen = true;
|
FullScreen._isPopupOpen = true;
|
||||||
else if (aEvent.type == "popuphidden" && aEvent.target.localName != "tooltip" &&
|
} else if (aEvent.type == "popuphidden" && aEvent.target.localName != "tooltip" &&
|
||||||
aEvent.target.localName != "window") {
|
aEvent.target.localName != "window") {
|
||||||
FullScreen._isPopupOpen = false;
|
FullScreen._isPopupOpen = false;
|
||||||
// Try again to hide toolbar when we close the popup.
|
// Try again to hide toolbar when we close the popup.
|
||||||
|
|||||||
@@ -794,9 +794,9 @@ var BookmarksEventHandler = {
|
|||||||
// Check whether the tooltipNode is a Places node.
|
// Check whether the tooltipNode is a Places node.
|
||||||
// In such a case use it, otherwise check for targetURI attribute.
|
// In such a case use it, otherwise check for targetURI attribute.
|
||||||
var tooltipNode = aDocument.tooltipNode;
|
var tooltipNode = aDocument.tooltipNode;
|
||||||
if (tooltipNode._placesNode)
|
if (tooltipNode._placesNode) {
|
||||||
node = tooltipNode._placesNode;
|
node = tooltipNode._placesNode;
|
||||||
else {
|
} else {
|
||||||
// This is a static non-Places node.
|
// This is a static non-Places node.
|
||||||
targetURI = tooltipNode.getAttribute("targetURI");
|
targetURI = tooltipNode.getAttribute("targetURI");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2791,8 +2791,9 @@ function UpdateUrlbarSearchSplitterState() {
|
|||||||
splitter.className = "chromeclass-toolbar-additional";
|
splitter.className = "chromeclass-toolbar-additional";
|
||||||
}
|
}
|
||||||
urlbar.parentNode.insertBefore(splitter, ibefore);
|
urlbar.parentNode.insertBefore(splitter, ibefore);
|
||||||
} else if (splitter)
|
} else if (splitter) {
|
||||||
splitter.remove();
|
splitter.remove();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdatePageProxyState() {
|
function UpdatePageProxyState() {
|
||||||
@@ -3970,9 +3971,9 @@ const BrowserSearch = {
|
|||||||
get icon() { return browser.mIconURL; },
|
get icon() { return browser.mIconURL; },
|
||||||
});
|
});
|
||||||
|
|
||||||
if (hidden)
|
if (hidden) {
|
||||||
browser.hiddenEngines = engines;
|
browser.hiddenEngines = engines;
|
||||||
else {
|
} else {
|
||||||
browser.engines = engines;
|
browser.engines = engines;
|
||||||
if (browser == gBrowser.selectedBrowser)
|
if (browser == gBrowser.selectedBrowser)
|
||||||
this.updateOpenSearchBadge();
|
this.updateOpenSearchBadge();
|
||||||
@@ -5406,9 +5407,9 @@ nsBrowserAccess.prototype = {
|
|||||||
let win, needToFocusWin;
|
let win, needToFocusWin;
|
||||||
|
|
||||||
// try the current window. if we're in a popup, fall back on the most recent browser window
|
// try the current window. if we're in a popup, fall back on the most recent browser window
|
||||||
if (window.toolbar.visible)
|
if (window.toolbar.visible) {
|
||||||
win = window;
|
win = window;
|
||||||
else {
|
} else {
|
||||||
win = BrowserWindowTracker.getTopWindow({private: aIsPrivate});
|
win = BrowserWindowTracker.getTopWindow({private: aIsPrivate});
|
||||||
needToFocusWin = true;
|
needToFocusWin = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -479,9 +479,9 @@ async function makeGeneralTab(metaViewRows, docInfo) {
|
|||||||
let length = metaViewRows.length;
|
let length = metaViewRows.length;
|
||||||
|
|
||||||
var metaGroup = document.getElementById("metaTags");
|
var metaGroup = document.getElementById("metaTags");
|
||||||
if (!length)
|
if (!length) {
|
||||||
metaGroup.style.visibility = "hidden";
|
metaGroup.style.visibility = "hidden";
|
||||||
else {
|
} else {
|
||||||
document.l10n.setAttributes(document.getElementById("metaTagsCaption"),
|
document.l10n.setAttributes(document.getElementById("metaTagsCaption"),
|
||||||
"general-meta-tags", {"tags": length});
|
"general-meta-tags", {"tags": length});
|
||||||
|
|
||||||
@@ -916,19 +916,20 @@ function makeBlockImage(url) {
|
|||||||
|
|
||||||
var checkbox = document.getElementById("blockImage");
|
var checkbox = document.getElementById("blockImage");
|
||||||
var imagePref = Services.prefs.getIntPref("permissions.default.image");
|
var imagePref = Services.prefs.getIntPref("permissions.default.image");
|
||||||
if (!(/^https?:/.test(url)) || imagePref == 2)
|
if (!(/^https?:/.test(url)) || imagePref == 2) {
|
||||||
// We can't block the images from this host because either is is not
|
// We can't block the images from this host because either is is not
|
||||||
// for http(s) or we don't load images at all
|
// for http(s) or we don't load images at all
|
||||||
checkbox.hidden = true;
|
checkbox.hidden = true;
|
||||||
else {
|
} else {
|
||||||
var uri = Services.io.newURI(url);
|
var uri = Services.io.newURI(url);
|
||||||
if (uri.host) {
|
if (uri.host) {
|
||||||
checkbox.hidden = false;
|
checkbox.hidden = false;
|
||||||
document.l10n.setAttributes(checkbox, "media-block-image", {"website": uri.host});
|
document.l10n.setAttributes(checkbox, "media-block-image", {"website": uri.host});
|
||||||
var perm = permissionManager.testPermission(uri, "image");
|
var perm = permissionManager.testPermission(uri, "image");
|
||||||
checkbox.checked = perm == nsIPermissionManager.DENY_ACTION;
|
checkbox.checked = perm == nsIPermissionManager.DENY_ACTION;
|
||||||
} else
|
} else {
|
||||||
checkbox.hidden = true;
|
checkbox.hidden = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -965,8 +966,9 @@ function setItemValue(id, value) {
|
|||||||
if (value) {
|
if (value) {
|
||||||
item.parentNode.collapsed = false;
|
item.parentNode.collapsed = false;
|
||||||
item.value = value;
|
item.value = value;
|
||||||
} else
|
} else {
|
||||||
item.parentNode.collapsed = true;
|
item.parentNode.collapsed = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatNumber(number) {
|
function formatNumber(number) {
|
||||||
|
|||||||
@@ -38,13 +38,15 @@ function onLoadPermission(uri, principal) {
|
|||||||
var hostText = document.getElementById("hostText");
|
var hostText = document.getElementById("hostText");
|
||||||
hostText.value = gPermURI.displayPrePath;
|
hostText.value = gPermURI.displayPrePath;
|
||||||
|
|
||||||
for (var i of gPermissions)
|
for (var i of gPermissions) {
|
||||||
initRow(i);
|
initRow(i);
|
||||||
|
}
|
||||||
Services.obs.addObserver(permissionObserver, "perm-changed");
|
Services.obs.addObserver(permissionObserver, "perm-changed");
|
||||||
onUnloadRegistry.push(onUnloadPermission);
|
onUnloadRegistry.push(onUnloadPermission);
|
||||||
permTab.hidden = false;
|
permTab.hidden = false;
|
||||||
} else
|
} else {
|
||||||
permTab.hidden = true;
|
permTab.hidden = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUnloadPermission() {
|
function onUnloadPermission() {
|
||||||
|
|||||||
@@ -238,8 +238,9 @@ function securityOnLoad(uri, windowInfo) {
|
|||||||
if (info.cert) {
|
if (info.cert) {
|
||||||
security._cert = info.cert;
|
security._cert = info.cert;
|
||||||
viewCert.collapsed = false;
|
viewCert.collapsed = false;
|
||||||
} else
|
} else {
|
||||||
viewCert.collapsed = true;
|
viewCert.collapsed = true;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set Privacy & History section text */
|
/* Set Privacy & History section text */
|
||||||
|
|
||||||
@@ -316,9 +317,8 @@ function setText(id, value) {
|
|||||||
return;
|
return;
|
||||||
if (element.localName == "textbox" || element.localName == "label")
|
if (element.localName == "textbox" || element.localName == "label")
|
||||||
element.value = value;
|
element.value = value;
|
||||||
else {
|
else
|
||||||
element.textContent = value;
|
element.textContent = value;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewCertHelper(parent, cert) {
|
function viewCertHelper(parent, cert) {
|
||||||
|
|||||||
@@ -172,9 +172,10 @@ function checkMenuItem(actualItem, actualEnabled, expectedItem, expectedEnabled,
|
|||||||
"checking item #" + index / 2 + " (" + expectedItem + ") has checked attr");
|
"checking item #" + index / 2 + " (" + expectedItem + ") has checked attr");
|
||||||
is(actualEnabled.disabled, expectedEnabled.disabled,
|
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)
|
} else if (expectedEnabled != null) {
|
||||||
is(actualEnabled, expectedEnabled,
|
is(actualEnabled, expectedEnabled,
|
||||||
"checking item #" + index / 2 + " (" + expectedItem + ") enabled state");
|
"checking item #" + index / 2 + " (" + expectedItem + ") enabled state");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|||||||
@@ -277,9 +277,9 @@ var gTests = [
|
|||||||
let Perms = Services.perms;
|
let Perms = Services.perms;
|
||||||
let uri = gBrowser.selectedBrowser.documentURI;
|
let uri = gBrowser.selectedBrowser.documentURI;
|
||||||
let devicePerms = Perms.testExactPermission(uri, aDevice);
|
let devicePerms = Perms.testExactPermission(uri, aDevice);
|
||||||
if (aExpected === undefined)
|
if (aExpected === undefined) {
|
||||||
is(devicePerms, Perms.UNKNOWN_ACTION, "no " + aDevice + " persistent permissions");
|
is(devicePerms, Perms.UNKNOWN_ACTION, "no " + aDevice + " persistent permissions");
|
||||||
else {
|
} else {
|
||||||
is(devicePerms, aExpected ? Perms.ALLOW_ACTION : Perms.DENY_ACTION,
|
is(devicePerms, aExpected ? Perms.ALLOW_ACTION : Perms.DENY_ACTION,
|
||||||
aDevice + " persistently " + (aExpected ? "allowed" : "denied"));
|
aDevice + " persistently " + (aExpected ? "allowed" : "denied"));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,31 +389,33 @@ nsBrowserContentHandler.prototype = {
|
|||||||
chromeParam == "chrome://browser/content/preferences/preferences.xul") {
|
chromeParam == "chrome://browser/content/preferences/preferences.xul") {
|
||||||
openPreferences(cmdLine, {origin: "commandLineLegacy"});
|
openPreferences(cmdLine, {origin: "commandLineLegacy"});
|
||||||
cmdLine.preventDefault = true;
|
cmdLine.preventDefault = true;
|
||||||
} else try {
|
} else {
|
||||||
let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
|
try {
|
||||||
let isLocal = uri => {
|
let resolvedURI = resolveURIInternal(cmdLine, chromeParam);
|
||||||
let localSchemes = new Set(["chrome", "file", "resource"]);
|
let isLocal = uri => {
|
||||||
if (uri instanceof Ci.nsINestedURI) {
|
let localSchemes = new Set(["chrome", "file", "resource"]);
|
||||||
uri = uri.QueryInterface(Ci.nsINestedURI).innerMostURI;
|
if (uri instanceof Ci.nsINestedURI) {
|
||||||
|
uri = uri.QueryInterface(Ci.nsINestedURI).innerMostURI;
|
||||||
|
}
|
||||||
|
return localSchemes.has(uri.scheme);
|
||||||
|
};
|
||||||
|
if (isLocal(resolvedURI)) {
|
||||||
|
// If the URI is local, we are sure it won't wrongly inherit chrome privs
|
||||||
|
let features = "chrome,dialog=no,all" + this.getFeatures(cmdLine);
|
||||||
|
// Provide 1 null argument, as openWindow has a different behavior
|
||||||
|
// when the arg count is 0.
|
||||||
|
let argArray = Cc["@mozilla.org/array;1"]
|
||||||
|
.createInstance(Ci.nsIMutableArray);
|
||||||
|
argArray.appendElement(null);
|
||||||
|
Services.ww.openWindow(null, resolvedURI.spec, "_blank", features, argArray);
|
||||||
|
cmdLine.preventDefault = true;
|
||||||
|
} else {
|
||||||
|
dump("*** Preventing load of web URI as chrome\n");
|
||||||
|
dump(" If you're trying to load a webpage, do not pass --chrome.\n");
|
||||||
}
|
}
|
||||||
return localSchemes.has(uri.scheme);
|
} catch (e) {
|
||||||
};
|
Cu.reportError(e);
|
||||||
if (isLocal(resolvedURI)) {
|
|
||||||
// If the URI is local, we are sure it won't wrongly inherit chrome privs
|
|
||||||
let features = "chrome,dialog=no,all" + this.getFeatures(cmdLine);
|
|
||||||
// Provide 1 null argument, as openWindow has a different behavior
|
|
||||||
// when the arg count is 0.
|
|
||||||
let argArray = Cc["@mozilla.org/array;1"]
|
|
||||||
.createInstance(Ci.nsIMutableArray);
|
|
||||||
argArray.appendElement(null);
|
|
||||||
Services.ww.openWindow(null, resolvedURI.spec, "_blank", features, argArray);
|
|
||||||
cmdLine.preventDefault = true;
|
|
||||||
} else {
|
|
||||||
dump("*** Preventing load of web URI as chrome\n");
|
|
||||||
dump(" If you're trying to load a webpage, do not pass --chrome.\n");
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
Cu.reportError(e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (cmdLine.handleFlag("preferences", false)) {
|
if (cmdLine.handleFlag("preferences", false)) {
|
||||||
|
|||||||
@@ -751,8 +751,9 @@ var PlacesUIUtils = {
|
|||||||
// Use (no title) for non-standard URIs (data:, javascript:, ...)
|
// Use (no title) for non-standard URIs (data:, javascript:, ...)
|
||||||
title = "";
|
title = "";
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
title = aNode.title;
|
title = aNode.title;
|
||||||
|
}
|
||||||
|
|
||||||
return title || this.getString("noTitle");
|
return title || this.getString("noTitle");
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -369,8 +369,9 @@ PlacesViewBase.prototype = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this._domNodes.set(aPlacesNode, popup);
|
this._domNodes.set(aPlacesNode, popup);
|
||||||
} else
|
} else {
|
||||||
throw "Unexpected node";
|
throw "Unexpected node";
|
||||||
|
}
|
||||||
|
|
||||||
element.setAttribute("label", PlacesUIUtils.getBestTitle(aPlacesNode));
|
element.setAttribute("label", PlacesUIUtils.getBestTitle(aPlacesNode));
|
||||||
|
|
||||||
@@ -1573,9 +1574,9 @@ PlacesToolbar.prototype = {
|
|||||||
halfInd = Math.ceil(halfInd);
|
halfInd = Math.ceil(halfInd);
|
||||||
translateX = 0 - this._rootElt.getBoundingClientRect().right - halfInd;
|
translateX = 0 - this._rootElt.getBoundingClientRect().right - halfInd;
|
||||||
if (this._rootElt.firstElementChild) {
|
if (this._rootElt.firstElementChild) {
|
||||||
if (dropPoint.beforeIndex == -1)
|
if (dropPoint.beforeIndex == -1) {
|
||||||
translateX += this._rootElt.lastElementChild.getBoundingClientRect().left;
|
translateX += this._rootElt.lastElementChild.getBoundingClientRect().left;
|
||||||
else {
|
} else {
|
||||||
translateX += this._rootElt.children[dropPoint.beforeIndex]
|
translateX += this._rootElt.children[dropPoint.beforeIndex]
|
||||||
.getBoundingClientRect().right;
|
.getBoundingClientRect().right;
|
||||||
}
|
}
|
||||||
@@ -1585,9 +1586,9 @@ PlacesToolbar.prototype = {
|
|||||||
translateX = 0 - this._rootElt.getBoundingClientRect().left +
|
translateX = 0 - this._rootElt.getBoundingClientRect().left +
|
||||||
halfInd;
|
halfInd;
|
||||||
if (this._rootElt.firstElementChild) {
|
if (this._rootElt.firstElementChild) {
|
||||||
if (dropPoint.beforeIndex == -1)
|
if (dropPoint.beforeIndex == -1) {
|
||||||
translateX += this._rootElt.lastElementChild.getBoundingClientRect().right;
|
translateX += this._rootElt.lastElementChild.getBoundingClientRect().right;
|
||||||
else {
|
} else {
|
||||||
translateX += this._rootElt.children[dropPoint.beforeIndex]
|
translateX += this._rootElt.children[dropPoint.beforeIndex]
|
||||||
.getBoundingClientRect().left;
|
.getBoundingClientRect().left;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -443,8 +443,9 @@
|
|||||||
elt = elt.nextElementSibling;
|
elt = elt.nextElementSibling;
|
||||||
newMarginTop = elt ? elt.screenY - this._scrollBox.screenY :
|
newMarginTop = elt ? elt.screenY - this._scrollBox.screenY :
|
||||||
scrollbox.height;
|
scrollbox.height;
|
||||||
} else if (scrollDir == 1)
|
} else if (scrollDir == 1) {
|
||||||
newMarginTop = scrollbox.height;
|
newMarginTop = scrollbox.height;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the new marginTop based on arrowscrollbox.
|
// Set the new marginTop based on arrowscrollbox.
|
||||||
newMarginTop += scrollbox.y - this._scrollBox.boxObject.y;
|
newMarginTop += scrollbox.y - this._scrollBox.boxObject.y;
|
||||||
|
|||||||
@@ -460,9 +460,9 @@
|
|||||||
for (var i = 0; i < container.childCount; ++i) {
|
for (var i = 0; i < container.childCount; ++i) {
|
||||||
var child = container.getChild(i);
|
var child = container.getChild(i);
|
||||||
var childURI = child.uri;
|
var childURI = child.uri;
|
||||||
if (childURI == placeURI)
|
if (childURI == placeURI) {
|
||||||
return child;
|
return child;
|
||||||
else if (PlacesUtils.nodeIsContainer(child)) {
|
} else if (PlacesUtils.nodeIsContainer(child)) {
|
||||||
var nested = findNode(PlacesUtils.asContainer(child), nodesURIChecked);
|
var nested = findNode(PlacesUtils.asContainer(child), nodesURIChecked);
|
||||||
if (nested)
|
if (nested)
|
||||||
return nested;
|
return nested;
|
||||||
@@ -481,9 +481,9 @@
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
var child = findNode(container, []);
|
var child = findNode(container, []);
|
||||||
if (child)
|
if (child) {
|
||||||
this.selectNode(child);
|
this.selectNode(child);
|
||||||
else {
|
} else {
|
||||||
// If the specified child could not be located, clear the selection
|
// If the specified child could not be located, clear the selection
|
||||||
var selection = this.view.selection;
|
var selection = this.view.selection;
|
||||||
selection.clearSelection();
|
selection.clearSelection();
|
||||||
|
|||||||
@@ -66,8 +66,9 @@ PlacesTreeView.prototype = {
|
|||||||
// This triggers containerStateChanged which then builds the visible
|
// This triggers containerStateChanged which then builds the visible
|
||||||
// section.
|
// section.
|
||||||
this._rootNode.containerOpen = true;
|
this._rootNode.containerOpen = true;
|
||||||
} else
|
} else {
|
||||||
this.invalidateContainer(this._rootNode);
|
this.invalidateContainer(this._rootNode);
|
||||||
|
}
|
||||||
|
|
||||||
// "Activate" the sorting column and update commands.
|
// "Activate" the sorting column and update commands.
|
||||||
this.sortingChanged(this._result.sortingMode);
|
this.sortingChanged(this._result.sortingMode);
|
||||||
@@ -1191,9 +1192,9 @@ PlacesTreeView.prototype = {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR)
|
} else if (nodeType == Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR) {
|
||||||
properties += " separator";
|
properties += " separator";
|
||||||
else if (PlacesUtils.nodeIsURI(node)) {
|
} else if (PlacesUtils.nodeIsURI(node)) {
|
||||||
properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri);
|
properties += " " + PlacesUIUtils.guessUrlSchemeForUI(node.uri);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -436,8 +436,9 @@ function open_properties_dialog(test) {
|
|||||||
command = "placesCmd_new:bookmark";
|
command = "placesCmd_new:bookmark";
|
||||||
else
|
else
|
||||||
Assert.ok(false, "You didn't set a valid itemType for adding an item");
|
Assert.ok(false, "You didn't set a valid itemType for adding an item");
|
||||||
} else
|
} else {
|
||||||
command = "placesCmd_createBookmark";
|
command = "placesCmd_createBookmark";
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Assert.ok(false, "You didn't set a valid action for this test");
|
Assert.ok(false, "You didn't set a valid action for this test");
|
||||||
|
|||||||
@@ -138,9 +138,9 @@ var pktApi = (function() {
|
|||||||
// TODO : Move this to sqlite or a local file so it's not editable (and is safer)
|
// TODO : Move this to sqlite or a local file so it's not editable (and is safer)
|
||||||
// https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
|
// https://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Local_Storage
|
||||||
|
|
||||||
if (!value)
|
if (!value) {
|
||||||
prefBranch.clearUserPref(key);
|
prefBranch.clearUserPref(key);
|
||||||
else {
|
} else {
|
||||||
// We use complexValue as tags can have utf-8 characters in them
|
// We use complexValue as tags can have utf-8 characters in them
|
||||||
prefBranch.setStringPref(key, value);
|
prefBranch.setStringPref(key, value);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1552,9 +1552,9 @@ var gMainPane = {
|
|||||||
let type = wrappedHandlerInfo.type;
|
let type = wrappedHandlerInfo.type;
|
||||||
|
|
||||||
let handlerInfoWrapper;
|
let handlerInfoWrapper;
|
||||||
if (type in this._handledTypes)
|
if (type in this._handledTypes) {
|
||||||
handlerInfoWrapper = this._handledTypes[type];
|
handlerInfoWrapper = this._handledTypes[type];
|
||||||
else {
|
} else {
|
||||||
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
|
handlerInfoWrapper = new HandlerInfoWrapper(type, wrappedHandlerInfo);
|
||||||
this._handledTypes[type] = handlerInfoWrapper;
|
this._handledTypes[type] = handlerInfoWrapper;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -660,15 +660,16 @@ var gPrivacyPane = {
|
|||||||
let mode;
|
let mode;
|
||||||
let getVal = aPref => Preferences.get(aPref).value;
|
let getVal = aPref => Preferences.get(aPref).value;
|
||||||
|
|
||||||
if (getVal("privacy.history.custom"))
|
if (getVal("privacy.history.custom")) {
|
||||||
mode = "custom";
|
mode = "custom";
|
||||||
else if (this._checkHistoryValues(this.prefsForKeepingHistory)) {
|
} else if (this._checkHistoryValues(this.prefsForKeepingHistory)) {
|
||||||
if (getVal("browser.privatebrowsing.autostart"))
|
if (getVal("browser.privatebrowsing.autostart"))
|
||||||
mode = "dontremember";
|
mode = "dontremember";
|
||||||
else
|
else
|
||||||
mode = "remember";
|
mode = "remember";
|
||||||
} else
|
} else {
|
||||||
mode = "custom";
|
mode = "custom";
|
||||||
|
}
|
||||||
|
|
||||||
document.getElementById("historyMode").value = mode;
|
document.getElementById("historyMode").value = mode;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -186,9 +186,9 @@ var gLanguagesDialog = {
|
|||||||
|
|
||||||
this._selectedItemID = selectedID;
|
this._selectedItemID = selectedID;
|
||||||
|
|
||||||
if (preference.value == "")
|
if (preference.value == "") {
|
||||||
preference.value = selectedID;
|
preference.value = selectedID;
|
||||||
else {
|
} else {
|
||||||
arrayOfPrefs.unshift(selectedID);
|
arrayOfPrefs.unshift(selectedID);
|
||||||
preference.value = arrayOfPrefs.join(",");
|
preference.value = arrayOfPrefs.join(",");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -357,8 +357,9 @@ class MozSearchbar extends MozXULElement {
|
|||||||
// Select the installed engine if the installation succeeds.
|
// Select the installed engine if the installation succeeds.
|
||||||
Services.search.addEngine(target.getAttribute("uri"), null,
|
Services.search.addEngine(target.getAttribute("uri"), null,
|
||||||
target.getAttribute("src"), false).then(engine => this.currentEngine = engine);
|
target.getAttribute("src"), false).then(engine => this.currentEngine = engine);
|
||||||
} else
|
} else {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.focus();
|
this.focus();
|
||||||
this.select();
|
this.select();
|
||||||
|
|||||||
@@ -95,8 +95,9 @@ function nextTest() {
|
|||||||
gCurrentTest = gTests.shift();
|
gCurrentTest = gTests.shift();
|
||||||
info("Running " + gCurrentTest.name);
|
info("Running " + gCurrentTest.name);
|
||||||
gCurrentTest.run();
|
gCurrentTest.run();
|
||||||
} else
|
} else {
|
||||||
executeSoon(finish);
|
executeSoon(finish);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function test() {
|
function test() {
|
||||||
|
|||||||
@@ -207,8 +207,9 @@ function onListClick(aEvent) {
|
|||||||
!treeView.isContainer(cell.row)) {
|
!treeView.isContainer(cell.row)) {
|
||||||
restoreSingleTab(cell.row, aEvent.shiftKey);
|
restoreSingleTab(cell.row, aEvent.shiftKey);
|
||||||
aEvent.stopPropagation();
|
aEvent.stopPropagation();
|
||||||
} else if (cell.col.id == "restore")
|
} else if (cell.col.id == "restore") {
|
||||||
toggleRowChecked(cell.row);
|
toggleRowChecked(cell.row);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -81,9 +81,9 @@ var workerManager = {
|
|||||||
// results. Otherwise, reschedule termination until after the next
|
// results. Otherwise, reschedule termination until after the next
|
||||||
// idle timeout.
|
// idle timeout.
|
||||||
_flushWorker() {
|
_flushWorker() {
|
||||||
if (this.detectionQueue.length)
|
if (this.detectionQueue.length) {
|
||||||
this.flushWorker();
|
this.flushWorker();
|
||||||
else {
|
} else {
|
||||||
if (this._worker)
|
if (this._worker)
|
||||||
this._worker.terminate();
|
this._worker.terminate();
|
||||||
|
|
||||||
|
|||||||
@@ -281,9 +281,9 @@ class MozTranslationNotification extends MozElements.Notification {
|
|||||||
optionsShowing() {
|
optionsShowing() {
|
||||||
// Get the source language name.
|
// Get the source language name.
|
||||||
let lang;
|
let lang;
|
||||||
if (this.state == Translation.STATE_OFFER)
|
if (this.state == Translation.STATE_OFFER) {
|
||||||
lang = this._getAnonElt("detectedLanguage").value;
|
lang = this._getAnonElt("detectedLanguage").value;
|
||||||
else {
|
} else {
|
||||||
lang = this._getAnonElt("fromLanguage").value;
|
lang = this._getAnonElt("fromLanguage").value;
|
||||||
|
|
||||||
// If we have never attempted to translate the page before the
|
// If we have never attempted to translate the page before the
|
||||||
|
|||||||
@@ -44,9 +44,9 @@ async function clickURLBarSuggestion(resultTitle, button = 1) {
|
|||||||
if (result.displayed.title == resultTitle) {
|
if (result.displayed.title == resultTitle) {
|
||||||
// This entry is the search suggestion we're looking for.
|
// This entry is the search suggestion we're looking for.
|
||||||
let element = await UrlbarTestUtils.waitForAutocompleteResultAt(window, i);
|
let element = await UrlbarTestUtils.waitForAutocompleteResultAt(window, i);
|
||||||
if (button == 1)
|
if (button == 1) {
|
||||||
EventUtils.synthesizeMouseAtCenter(element, {});
|
EventUtils.synthesizeMouseAtCenter(element, {});
|
||||||
else if (button == 2) {
|
} else if (button == 2) {
|
||||||
EventUtils.synthesizeMouseAtCenter(element, {type: "mousedown", button: 2});
|
EventUtils.synthesizeMouseAtCenter(element, {type: "mousedown", button: 2});
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -142,9 +142,9 @@ function runTest() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var isMac = ("nsILocalFileMac" in SpecialPowers.Ci);
|
var isMac = ("nsILocalFileMac" in SpecialPowers.Ci);
|
||||||
if (isMac)
|
if (isMac) {
|
||||||
SimpleTest.waitForFocus(runTest);
|
SimpleTest.waitForFocus(runTest);
|
||||||
else {
|
} else {
|
||||||
// This test is not yet supported on non-Mac platforms, see bug 574005.
|
// This test is not yet supported on non-Mac platforms, see bug 574005.
|
||||||
todo(false, "Test not supported on this platform");
|
todo(false, "Test not supported on this platform");
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
|
|||||||
@@ -539,9 +539,9 @@ var tests = [
|
|||||||
|
|
||||||
function doNextTest() {
|
function doNextTest() {
|
||||||
/* global testCounter:true */
|
/* global testCounter:true */
|
||||||
if (typeof testCounter == "undefined")
|
if (typeof testCounter == "undefined") {
|
||||||
testCounter = 0;
|
testCounter = 0;
|
||||||
else if (++testCounter == tests.length) {
|
} else if (++testCounter == tests.length) {
|
||||||
SimpleTest.finish();
|
SimpleTest.finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -561,8 +561,9 @@ function runTest(test) {
|
|||||||
if ("isIFrame" in test) {
|
if ("isIFrame" in test) {
|
||||||
elem.contentDocument.designMode = "on";
|
elem.contentDocument.designMode = "on";
|
||||||
elem.contentWindow.focus();
|
elem.contentWindow.focus();
|
||||||
} else
|
} else {
|
||||||
elem.focus();
|
elem.focus();
|
||||||
|
}
|
||||||
|
|
||||||
var trans = SpecialPowers.Cc["@mozilla.org/widget/transferable;1"]
|
var trans = SpecialPowers.Cc["@mozilla.org/widget/transferable;1"]
|
||||||
.createInstance(SpecialPowers.Ci.nsITransferable);
|
.createInstance(SpecialPowers.Ci.nsITransferable);
|
||||||
|
|||||||
@@ -23,10 +23,10 @@ function ArrayIndexOf(searchElement/*, fromIndex*/) {
|
|||||||
|
|
||||||
var k;
|
var k;
|
||||||
/* Step 7. */
|
/* Step 7. */
|
||||||
if (n >= 0)
|
if (n >= 0) {
|
||||||
k = n;
|
k = n;
|
||||||
/* Step 8. */
|
/* Step 8. */
|
||||||
else {
|
} else {
|
||||||
/* Step a. */
|
/* Step a. */
|
||||||
k = len + n;
|
k = len + n;
|
||||||
/* Step b. */
|
/* Step b. */
|
||||||
|
|||||||
@@ -122,8 +122,9 @@ Observer.prototype = {
|
|||||||
this.callback.call(this.thisObject, subject, data);
|
this.callback.call(this.thisObject, subject, data);
|
||||||
else
|
else
|
||||||
this.callback(subject, data);
|
this.callback(subject, data);
|
||||||
} else // typeof this.callback == "object" (nsIObserver)
|
} else { // typeof this.callback == "object" (nsIObserver)
|
||||||
this.callback.observe(subject, topic, data);
|
this.callback.observe(subject, topic, data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -507,8 +507,9 @@ var TPS = {
|
|||||||
Logger.AssertTrue(itemGuid == null,
|
Logger.AssertTrue(itemGuid == null,
|
||||||
"places item exists but it shouldn't: " +
|
"places item exists but it shouldn't: " +
|
||||||
JSON.stringify(bookmark));
|
JSON.stringify(bookmark));
|
||||||
} else
|
} else {
|
||||||
Logger.AssertTrue(itemGuid, "places item not found", true);
|
Logger.AssertTrue(itemGuid, "places item not found", true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
last_item_pos = await placesItem.GetItemIndex();
|
last_item_pos = await placesItem.GetItemIndex();
|
||||||
|
|||||||
@@ -129,9 +129,9 @@ class SelectionSourceChild extends ActorChild {
|
|||||||
// 1. ...<tag>]... to ...]<tag>...
|
// 1. ...<tag>]... to ...]<tag>...
|
||||||
// 2. ...]</tag>... to ...</tag>]...
|
// 2. ...]</tag>... to ...</tag>]...
|
||||||
if ((endOffset > 0 && endOffset < endContainer.data.length) ||
|
if ((endOffset > 0 && endOffset < endContainer.data.length) ||
|
||||||
!endContainer.parentNode || !endContainer.parentNode.parentNode)
|
!endContainer.parentNode || !endContainer.parentNode.parentNode) {
|
||||||
endContainer.insertData(endOffset, MARK_SELECTION_END);
|
endContainer.insertData(endOffset, MARK_SELECTION_END);
|
||||||
else {
|
} else {
|
||||||
tmpNode = dataDoc.createTextNode(MARK_SELECTION_END);
|
tmpNode = dataDoc.createTextNode(MARK_SELECTION_END);
|
||||||
endContainer = endContainer.parentNode;
|
endContainer = endContainer.parentNode;
|
||||||
if (endOffset === 0)
|
if (endOffset === 0)
|
||||||
@@ -153,9 +153,9 @@ class SelectionSourceChild extends ActorChild {
|
|||||||
// 2. ...[</tag>... to ...</tag>[...
|
// 2. ...[</tag>... to ...</tag>[...
|
||||||
if ((startOffset > 0 && startOffset < startContainer.data.length) ||
|
if ((startOffset > 0 && startOffset < startContainer.data.length) ||
|
||||||
!startContainer.parentNode || !startContainer.parentNode.parentNode ||
|
!startContainer.parentNode || !startContainer.parentNode.parentNode ||
|
||||||
startContainer != startContainer.parentNode.lastChild)
|
startContainer != startContainer.parentNode.lastChild) {
|
||||||
startContainer.insertData(startOffset, MARK_SELECTION_START);
|
startContainer.insertData(startOffset, MARK_SELECTION_START);
|
||||||
else {
|
} else {
|
||||||
tmpNode = dataDoc.createTextNode(MARK_SELECTION_START);
|
tmpNode = dataDoc.createTextNode(MARK_SELECTION_START);
|
||||||
startContainer = startContainer.parentNode;
|
startContainer = startContainer.parentNode;
|
||||||
if (startOffset === 0)
|
if (startOffset === 0)
|
||||||
|
|||||||
@@ -408,9 +408,9 @@ var View = {
|
|||||||
this._fragment = document.createDocumentFragment();
|
this._fragment = document.createDocumentFragment();
|
||||||
},
|
},
|
||||||
displayEnergyImpact(elt, energyImpact) {
|
displayEnergyImpact(elt, energyImpact) {
|
||||||
if (!energyImpact)
|
if (!energyImpact) {
|
||||||
elt.textContent = "–";
|
elt.textContent = "–";
|
||||||
else {
|
} else {
|
||||||
let impact = "high";
|
let impact = "high";
|
||||||
if (energyImpact < 1)
|
if (energyImpact < 1)
|
||||||
impact = "low";
|
impact = "low";
|
||||||
|
|||||||
@@ -888,8 +888,9 @@ ContentPrefService2.prototype = {
|
|||||||
if (!this._observers[aName])
|
if (!this._observers[aName])
|
||||||
this._observers[aName] = [];
|
this._observers[aName] = [];
|
||||||
observers = this._observers[aName];
|
observers = this._observers[aName];
|
||||||
} else
|
} else {
|
||||||
observers = this._genericObservers;
|
observers = this._genericObservers;
|
||||||
|
}
|
||||||
|
|
||||||
if (!observers.includes(aObserver))
|
if (!observers.includes(aObserver))
|
||||||
observers.push(aObserver);
|
observers.push(aObserver);
|
||||||
@@ -901,8 +902,9 @@ ContentPrefService2.prototype = {
|
|||||||
if (!this._observers[aName])
|
if (!this._observers[aName])
|
||||||
return;
|
return;
|
||||||
observers = this._observers[aName];
|
observers = this._observers[aName];
|
||||||
} else
|
} else {
|
||||||
observers = this._genericObservers;
|
observers = this._genericObservers;
|
||||||
|
}
|
||||||
|
|
||||||
if (observers.includes(aObserver))
|
if (observers.includes(aObserver))
|
||||||
observers.splice(observers.indexOf(aObserver), 1);
|
observers.splice(observers.indexOf(aObserver), 1);
|
||||||
|
|||||||
@@ -1261,15 +1261,15 @@ var Bookmarks = Object.freeze({
|
|||||||
|
|
||||||
return (async function() {
|
return (async function() {
|
||||||
let results;
|
let results;
|
||||||
if (fetchInfo.hasOwnProperty("url"))
|
if (fetchInfo.hasOwnProperty("url")) {
|
||||||
results = await fetchBookmarksByURL(fetchInfo, options && options.concurrent);
|
results = await fetchBookmarksByURL(fetchInfo, options && options.concurrent);
|
||||||
else if (fetchInfo.hasOwnProperty("guid"))
|
} else if (fetchInfo.hasOwnProperty("guid")) {
|
||||||
results = await fetchBookmark(fetchInfo, options && options.concurrent);
|
results = await fetchBookmark(fetchInfo, options && options.concurrent);
|
||||||
else if (fetchInfo.hasOwnProperty("parentGuid") && fetchInfo.hasOwnProperty("index"))
|
} else if (fetchInfo.hasOwnProperty("parentGuid") && fetchInfo.hasOwnProperty("index")) {
|
||||||
results = await fetchBookmarkByPosition(fetchInfo, options && options.concurrent);
|
results = await fetchBookmarkByPosition(fetchInfo, options && options.concurrent);
|
||||||
else if (fetchInfo.hasOwnProperty("guidPrefix"))
|
} else if (fetchInfo.hasOwnProperty("guidPrefix")) {
|
||||||
results = await fetchBookmarksByGUIDPrefix(fetchInfo, options && options.concurrent);
|
results = await fetchBookmarksByGUIDPrefix(fetchInfo, options && options.concurrent);
|
||||||
else if (fetchInfo.hasOwnProperty("tags")) {
|
} else if (fetchInfo.hasOwnProperty("tags")) {
|
||||||
results = await fetchBookmarksByTags(fetchInfo, options && options.concurrent);
|
results = await fetchBookmarksByTags(fetchInfo, options && options.concurrent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1069,9 +1069,9 @@ var PlacesUtils = {
|
|||||||
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 uriString = parts[i];
|
||||||
let titleString = "";
|
let titleString = "";
|
||||||
if (parts.length > i + 1)
|
if (parts.length > i + 1) {
|
||||||
titleString = parts[i + 1];
|
titleString = parts[i + 1];
|
||||||
else {
|
} else {
|
||||||
// for drag and drop of files, try to use the leafName as title
|
// for drag and drop of files, try to use the leafName as title
|
||||||
try {
|
try {
|
||||||
titleString = Services.io.newURI(uriString).QueryInterface(Ci.nsIURL)
|
titleString = Services.io.newURI(uriString).QueryInterface(Ci.nsIURL)
|
||||||
|
|||||||
@@ -106,10 +106,10 @@ async function task_populateDB(aArray) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (qdata.isItemAnnotation) {
|
if (qdata.isItemAnnotation) {
|
||||||
if (qdata.removeAnnotation)
|
if (qdata.removeAnnotation) {
|
||||||
PlacesUtils.annotations.removeItemAnnotation(qdata.itemId,
|
PlacesUtils.annotations.removeItemAnnotation(qdata.itemId,
|
||||||
qdata.annoName);
|
qdata.annoName);
|
||||||
else {
|
} else {
|
||||||
PlacesUtils.annotations.setItemAnnotation(qdata.itemId,
|
PlacesUtils.annotations.setItemAnnotation(qdata.itemId,
|
||||||
qdata.annoName,
|
qdata.annoName,
|
||||||
qdata.annoVal,
|
qdata.annoVal,
|
||||||
|
|||||||
@@ -121,7 +121,9 @@ function cartProd(aSequences, aCallback) {
|
|||||||
// All element pointers are past the ends of their sequences.
|
// All element pointers are past the ends of their sequences.
|
||||||
if (seqPtr < 0)
|
if (seqPtr < 0)
|
||||||
done = true;
|
done = true;
|
||||||
} else break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return numProds;
|
return numProds;
|
||||||
@@ -171,8 +173,9 @@ function test_query_callback(aSequence) {
|
|||||||
// Date containers are always sorted by date descending.
|
// Date containers are always sorted by date descending.
|
||||||
check_children_sorting(root,
|
check_children_sorting(root,
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
|
Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING);
|
||||||
} else
|
} else {
|
||||||
check_children_sorting(root, sortingMode.value);
|
check_children_sorting(root, sortingMode.value);
|
||||||
|
}
|
||||||
|
|
||||||
// Now Check sorting of the first child container.
|
// Now Check sorting of the first child container.
|
||||||
var container = root.getChild(0)
|
var container = root.getChild(0)
|
||||||
@@ -198,8 +201,9 @@ function test_query_callback(aSequence) {
|
|||||||
// duplicates filtering.
|
// duplicates filtering.
|
||||||
check_children_sorting(container,
|
check_children_sorting(container,
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
|
||||||
} else
|
} else {
|
||||||
check_children_sorting(container, sortingMode.value);
|
check_children_sorting(container, sortingMode.value);
|
||||||
|
}
|
||||||
|
|
||||||
container.containerOpen = false;
|
container.containerOpen = false;
|
||||||
root.containerOpen = false;
|
root.containerOpen = false;
|
||||||
@@ -241,8 +245,9 @@ function test_result_sortingMode_change(aResult, aResultType, aOriginalSortingMo
|
|||||||
// Site containers don't have a good time property to sort by.
|
// Site containers don't have a good time property to sort by.
|
||||||
check_children_sorting(root,
|
check_children_sorting(root,
|
||||||
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
|
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
|
||||||
} else
|
} else {
|
||||||
check_children_sorting(root, aOriginalSortingMode.value);
|
check_children_sorting(root, aOriginalSortingMode.value);
|
||||||
|
}
|
||||||
|
|
||||||
// Now Check sorting of the first child container.
|
// Now Check sorting of the first child container.
|
||||||
var container = root.getChild(0)
|
var container = root.getChild(0)
|
||||||
@@ -272,8 +277,9 @@ function test_result_sortingMode_change(aResult, aResultType, aOriginalSortingMo
|
|||||||
aOriginalSortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)) {
|
aOriginalSortingMode.value == Ci.nsINavHistoryQueryOptions.SORT_BY_DATE_DESCENDING)) {
|
||||||
// Site containers don't have a good time property to sort by.
|
// Site containers don't have a good time property to sort by.
|
||||||
check_children_sorting(root, Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
|
check_children_sorting(root, Ci.nsINavHistoryQueryOptions.SORT_BY_NONE);
|
||||||
} else
|
} else {
|
||||||
check_children_sorting(root, aOriginalSortingMode.value);
|
check_children_sorting(root, aOriginalSortingMode.value);
|
||||||
|
}
|
||||||
|
|
||||||
// Children should always be sorted.
|
// Children should always be sorted.
|
||||||
check_children_sorting(container, aForcedSortingMode.value);
|
check_children_sorting(container, aForcedSortingMode.value);
|
||||||
|
|||||||
@@ -504,7 +504,9 @@ function cartProd(aSequences, aCallback) {
|
|||||||
// All element pointers are past the ends of their sequences.
|
// All element pointers are past the ends of their sequences.
|
||||||
if (seqPtr < 0)
|
if (seqPtr < 0)
|
||||||
done = true;
|
done = true;
|
||||||
} else break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return numProds;
|
return numProds;
|
||||||
@@ -561,9 +563,9 @@ function choose(aSet, aHowMany, aCallback) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// All pointers are adjacent and clustered all the way to the right.
|
// All pointers are adjacent and clustered all the way to the right.
|
||||||
if (pi < 0)
|
if (pi < 0) {
|
||||||
done = true;
|
done = true;
|
||||||
else {
|
} else {
|
||||||
// pi = index of rightmost pointer with a gap between it and its
|
// pi = index of rightmost pointer with a gap between it and its
|
||||||
// succeeding pointer. Move it right and reset all succeeding pointers
|
// succeeding pointer. Move it right and reset all succeeding pointers
|
||||||
// so that they're adjacent to it.
|
// so that they're adjacent to it.
|
||||||
@@ -594,12 +596,14 @@ function flagSwitchMatches(aQuery1, aQuery2) {
|
|||||||
if (aQuery1[p] instanceof Ci.nsIURI) {
|
if (aQuery1[p] instanceof Ci.nsIURI) {
|
||||||
if (!aQuery1[p].equals(aQuery2[p]))
|
if (!aQuery1[p].equals(aQuery2[p]))
|
||||||
return false;
|
return false;
|
||||||
} else if (aQuery1[p] !== aQuery2[p])
|
} else if (aQuery1[p] !== aQuery2[p]) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (aQuery1[this.flag] || aQuery2[this.flag])
|
} else if (aQuery1[this.flag] || aQuery2[this.flag]) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -169,7 +169,9 @@ function cartProd(aSequences, aCallback) {
|
|||||||
// All element pointers are past the ends of their sequences.
|
// All element pointers are past the ends of their sequences.
|
||||||
if (seqPtr < 0)
|
if (seqPtr < 0)
|
||||||
done = true;
|
done = true;
|
||||||
} else break;
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return numProds;
|
return numProds;
|
||||||
|
|||||||
@@ -107,8 +107,9 @@ async function task_initializeBucket(bucket) {
|
|||||||
frecency = 0;
|
frecency = 0;
|
||||||
else
|
else
|
||||||
frecency = -1;
|
frecency = -1;
|
||||||
} else
|
} else {
|
||||||
frecency = points;
|
frecency = points;
|
||||||
|
}
|
||||||
calculatedURI = uri("http://" + searchTerm + ".com/" +
|
calculatedURI = uri("http://" + searchTerm + ".com/" +
|
||||||
bonusName + ":" + bonusValue + "/cutoff:" + cutoff +
|
bonusName + ":" + bonusValue + "/cutoff:" + cutoff +
|
||||||
"/weight:" + weight + "/frecency:" + frecency);
|
"/weight:" + weight + "/frecency:" + frecency);
|
||||||
@@ -119,8 +120,9 @@ async function task_initializeBucket(bucket) {
|
|||||||
url: calculatedURI,
|
url: calculatedURI,
|
||||||
title: matchTitle,
|
title: matchTitle,
|
||||||
});
|
});
|
||||||
} else
|
} else {
|
||||||
matchTitle = calculatedURI.spec.substr(calculatedURI.spec.lastIndexOf("/") + 1);
|
matchTitle = calculatedURI.spec.substr(calculatedURI.spec.lastIndexOf("/") + 1);
|
||||||
|
}
|
||||||
await PlacesTestUtils.addVisits({
|
await PlacesTestUtils.addVisits({
|
||||||
uri: calculatedURI,
|
uri: calculatedURI,
|
||||||
transition: visitType,
|
transition: visitType,
|
||||||
|
|||||||
@@ -32,11 +32,11 @@ add_task(async function test_execute() {
|
|||||||
|
|
||||||
|
|
||||||
for (var visit of gVisits) {
|
for (var visit of gVisits) {
|
||||||
if (visit.transition == TRANSITION_TYPED)
|
if (visit.transition == TRANSITION_TYPED) {
|
||||||
PlacesUtils.history.markPageAsTyped(uri(visit.url));
|
PlacesUtils.history.markPageAsTyped(uri(visit.url));
|
||||||
else if (visit.transition == TRANSITION_BOOKMARK)
|
} else if (visit.transition == TRANSITION_BOOKMARK) {
|
||||||
PlacesUtils.history.markPageAsFollowedBookmark(uri(visit.url));
|
PlacesUtils.history.markPageAsFollowedBookmark(uri(visit.url));
|
||||||
else {
|
} else {
|
||||||
// because it is a top level visit with no referrer,
|
// because it is a top level visit with no referrer,
|
||||||
// it will result in TRANSITION_LINK
|
// it will result in TRANSITION_LINK
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1085,8 +1085,9 @@ EngineURL.prototype = {
|
|||||||
this.addParam(param.name, value);
|
this.addParam(param.name, value);
|
||||||
}
|
}
|
||||||
this._addMozParam(param);
|
this._addMozParam(param);
|
||||||
} else
|
} else {
|
||||||
this.addParam(param.name, param.value, param.purpose || undefined);
|
this.addParam(param.name, param.value, param.purpose || undefined);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -1148,9 +1149,10 @@ function Engine(aLocation, aIsReadOnly) {
|
|||||||
ERROR("Invalid URI passed to the nsISearchEngine constructor",
|
ERROR("Invalid URI passed to the nsISearchEngine constructor",
|
||||||
Cr.NS_ERROR_INVALID_ARG);
|
Cr.NS_ERROR_INVALID_ARG);
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
ERROR("Engine location is neither a File nor a URI object",
|
ERROR("Engine location is neither a File nor a URI object",
|
||||||
Cr.NS_ERROR_INVALID_ARG);
|
Cr.NS_ERROR_INVALID_ARG);
|
||||||
|
}
|
||||||
|
|
||||||
if (!this._shortName) {
|
if (!this._shortName) {
|
||||||
// If we don't have a shortName at this point, it's the first time we load
|
// If we don't have a shortName at this point, it's the first time we load
|
||||||
@@ -3999,13 +4001,13 @@ SearchService.prototype = {
|
|||||||
result.loadPath = engine._loadPath;
|
result.loadPath = engine._loadPath;
|
||||||
|
|
||||||
let origin;
|
let origin;
|
||||||
if (engine._isDefault)
|
if (engine._isDefault) {
|
||||||
origin = "default";
|
origin = "default";
|
||||||
else {
|
} else {
|
||||||
let currentHash = engine.getAttr("loadPathHash");
|
let currentHash = engine.getAttr("loadPathHash");
|
||||||
if (!currentHash)
|
if (!currentHash) {
|
||||||
origin = "unverified";
|
origin = "unverified";
|
||||||
else {
|
} else {
|
||||||
let loadPathHash = getVerificationHash(engine._loadPath);
|
let loadPathHash = getVerificationHash(engine._loadPath);
|
||||||
origin = currentHash == loadPathHash ? "verified" : "invalid";
|
origin = currentHash == loadPathHash ? "verified" : "invalid";
|
||||||
}
|
}
|
||||||
@@ -4480,8 +4482,9 @@ var engineUpdateService = {
|
|||||||
testEngine = new Engine(updateURI, false);
|
testEngine = new Engine(updateURI, false);
|
||||||
testEngine._engineToUpdate = engine;
|
testEngine._engineToUpdate = engine;
|
||||||
testEngine._initFromURIAndLoad(updateURI);
|
testEngine._initFromURIAndLoad(updateURI);
|
||||||
} else
|
} else {
|
||||||
ULOG("invalid updateURI");
|
ULOG("invalid updateURI");
|
||||||
|
}
|
||||||
|
|
||||||
if (engine._iconUpdateURL) {
|
if (engine._iconUpdateURL) {
|
||||||
// If we're updating the engine too, use the new engine object,
|
// If we're updating the engine too, use the new engine object,
|
||||||
|
|||||||
@@ -1039,8 +1039,9 @@ Serializer.prototype = {
|
|||||||
let text = this._nodeText(child);
|
let text = this._nodeText(child);
|
||||||
this._appendText(text);
|
this._appendText(text);
|
||||||
hasText = hasText || !!text.trim();
|
hasText = hasText || !!text.trim();
|
||||||
} else if (child.nodeType == Node.ELEMENT_NODE)
|
} else if (child.nodeType == Node.ELEMENT_NODE) {
|
||||||
this._serializeElement(child);
|
this._serializeElement(child);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// For headings, draw a "line" underneath them so they stand out.
|
// For headings, draw a "line" underneath them so they stand out.
|
||||||
|
|||||||
@@ -319,8 +319,9 @@ const Preferences = window.Preferences = (function() {
|
|||||||
// Don't use the value setter here, we don't want updateElements to be
|
// Don't use the value setter here, we don't want updateElements to be
|
||||||
// prematurely fired.
|
// prematurely fired.
|
||||||
this._value = preference ? preference.value : this.valueFromPreferences;
|
this._value = preference ? preference.value : this.valueFromPreferences;
|
||||||
} else
|
} else {
|
||||||
this._value = this.valueFromPreferences;
|
this._value = this.valueFromPreferences;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reset() {
|
reset() {
|
||||||
@@ -385,16 +386,17 @@ const Preferences = window.Preferences = (function() {
|
|||||||
element.setAttribute(attribute, value);
|
element.setAttribute(attribute, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (aElement.localName == "checkbox")
|
if (aElement.localName == "checkbox") {
|
||||||
setValue(aElement, "checked", val);
|
setValue(aElement, "checked", val);
|
||||||
else if (aElement.localName == "textbox") {
|
} else if (aElement.localName == "textbox") {
|
||||||
// XXXmano Bug 303998: Avoid a caret placement issue if either the
|
// XXXmano Bug 303998: Avoid a caret placement issue if either the
|
||||||
// preference observer or its setter calls updateElements as a result
|
// preference observer or its setter calls updateElements as a result
|
||||||
// of the input event handler.
|
// of the input event handler.
|
||||||
if (aElement.value !== val)
|
if (aElement.value !== val)
|
||||||
setValue(aElement, "value", val);
|
setValue(aElement, "value", val);
|
||||||
} else
|
} else {
|
||||||
setValue(aElement, "value", val);
|
setValue(aElement, "value", val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getElementValue(aElement) {
|
getElementValue(aElement) {
|
||||||
@@ -609,8 +611,9 @@ const Preferences = window.Preferences = (function() {
|
|||||||
lf.persistentDescriptor = val;
|
lf.persistentDescriptor = val;
|
||||||
if (!lf.exists())
|
if (!lf.exists())
|
||||||
lf.initWithPath(val);
|
lf.initWithPath(val);
|
||||||
} else
|
} else {
|
||||||
lf = val.QueryInterface(Ci.nsIFile);
|
lf = val.QueryInterface(Ci.nsIFile);
|
||||||
|
}
|
||||||
Services.prefs
|
Services.prefs
|
||||||
.setComplexValue(this.name, Ci.nsIFile, lf);
|
.setComplexValue(this.name, Ci.nsIFile, lf);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ popup.addEventListener("load", function() {
|
|||||||
|
|
||||||
is(popup.document.activeElement, video, "Document should load with focus moved to the video element.");
|
is(popup.document.activeElement, video, "Document should load with focus moved to the video element.");
|
||||||
|
|
||||||
if (!video.paused)
|
if (!video.paused) {
|
||||||
runTestVideo(video);
|
runTestVideo(video);
|
||||||
else {
|
} else {
|
||||||
video.addEventListener("play", function() {
|
video.addEventListener("play", function() {
|
||||||
runTestVideo(video);
|
runTestVideo(video);
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
@@ -58,9 +58,9 @@ function runTestAudioPre() {
|
|||||||
|
|
||||||
is(popup.document.activeElement, audio, "Document should load with focus moved to the video element.");
|
is(popup.document.activeElement, audio, "Document should load with focus moved to the video element.");
|
||||||
|
|
||||||
if (!audio.paused)
|
if (!audio.paused) {
|
||||||
runTestAudio(audio);
|
runTestAudio(audio);
|
||||||
else {
|
} else {
|
||||||
audio.addEventListener("play", function() {
|
audio.addEventListener("play", function() {
|
||||||
runTestAudio(audio);
|
runTestAudio(audio);
|
||||||
}, {once: true});
|
}, {once: true});
|
||||||
|
|||||||
@@ -110,9 +110,9 @@ class MozMenuList extends MenuBaseControl {
|
|||||||
if (popup)
|
if (popup)
|
||||||
arr = popup.getElementsByAttribute("value", val);
|
arr = popup.getElementsByAttribute("value", val);
|
||||||
|
|
||||||
if (arr && arr.item(0))
|
if (arr && arr.item(0)) {
|
||||||
this.selectedItem = arr[0];
|
this.selectedItem = arr[0];
|
||||||
else {
|
} else {
|
||||||
this.selectedItem = null;
|
this.selectedItem = null;
|
||||||
this.setAttribute("value", val);
|
this.setAttribute("value", val);
|
||||||
}
|
}
|
||||||
@@ -189,8 +189,9 @@ class MozMenuList extends MenuBaseControl {
|
|||||||
if (popup && 0 <= val) {
|
if (popup && 0 <= val) {
|
||||||
if (val < popup.children.length)
|
if (val < popup.children.length)
|
||||||
this.selectedItem = popup.children[val];
|
this.selectedItem = popup.children[val];
|
||||||
} else
|
} else {
|
||||||
this.selectedItem = null;
|
this.selectedItem = null;
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -444,8 +444,9 @@
|
|||||||
|
|
||||||
col.mTargetCol = null;
|
col.mTargetCol = null;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
col.mDragGesturing = false;
|
col.mDragGesturing = false;
|
||||||
|
}
|
||||||
|
|
||||||
document.treecolDragging = null;
|
document.treecolDragging = null;
|
||||||
col.removeAttribute("dragging");
|
col.removeAttribute("dragging");
|
||||||
|
|||||||
@@ -289,9 +289,8 @@ InlineSpellChecker.prototype = {
|
|||||||
this.mAddedWordStack.push(this.mMisspelling);
|
this.mAddedWordStack.push(this.mMisspelling);
|
||||||
if (this.mRemote)
|
if (this.mRemote)
|
||||||
this.mRemote.addToDictionary();
|
this.mRemote.addToDictionary();
|
||||||
else {
|
else
|
||||||
this.mInlineSpellChecker.addWordToDictionary(this.mMisspelling);
|
this.mInlineSpellChecker.addWordToDictionary(this.mMisspelling);
|
||||||
}
|
|
||||||
},
|
},
|
||||||
// callback for removing the last added word to the dictionary LIFO fashion
|
// callback for removing the last added word to the dictionary LIFO fashion
|
||||||
undoAddToDictionary() {
|
undoAddToDictionary() {
|
||||||
|
|||||||
@@ -875,8 +875,9 @@ PopupNotifications.prototype = {
|
|||||||
Cu.reportError(e);
|
Cu.reportError(e);
|
||||||
popupnotification.removeAttribute("origin");
|
popupnotification.removeAttribute("origin");
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
popupnotification.removeAttribute("origin");
|
popupnotification.removeAttribute("origin");
|
||||||
|
}
|
||||||
|
|
||||||
if (n.options.hideClose)
|
if (n.options.hideClose)
|
||||||
popupnotification.setAttribute("closebuttonhidden", "true");
|
popupnotification.setAttribute("closebuttonhidden", "true");
|
||||||
|
|||||||
@@ -22,8 +22,9 @@ function Preferences(args) {
|
|||||||
this._defaultBranch = args.defaultBranch;
|
this._defaultBranch = args.defaultBranch;
|
||||||
if (args.privacyContext)
|
if (args.privacyContext)
|
||||||
this._privacyContext = args.privacyContext;
|
this._privacyContext = args.privacyContext;
|
||||||
} else if (args)
|
} else if (args) {
|
||||||
this._branchStr = args;
|
this._branchStr = args;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -406,8 +407,9 @@ PrefObserver.prototype = {
|
|||||||
this.callback.call(this.thisObject, prefValue);
|
this.callback.call(this.thisObject, prefValue);
|
||||||
else
|
else
|
||||||
this.callback(prefValue);
|
this.callback(prefValue);
|
||||||
} else // typeof this.callback == "object" (nsIObserver)
|
} else { // typeof this.callback == "object" (nsIObserver)
|
||||||
this.callback.observe(subject, topic, data);
|
this.callback.observe(subject, topic, data);
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -903,8 +903,9 @@ nsUnknownContentTypeDialog.prototype = {
|
|||||||
.createInstance(nsITimer);
|
.createInstance(nsITimer);
|
||||||
this._saveToDiskTimer.initWithCallback(this, 0,
|
this._saveToDiskTimer.initWithCallback(this, 0,
|
||||||
nsITimer.TYPE_ONE_SHOT);
|
nsITimer.TYPE_ONE_SHOT);
|
||||||
} else
|
} else {
|
||||||
this.mLauncher.launchWithApplication(null, false);
|
this.mLauncher.launchWithApplication(null, false);
|
||||||
|
}
|
||||||
|
|
||||||
// Update user pref for this mime type (if necessary). We do not
|
// Update user pref for this mime type (if necessary). We do not
|
||||||
// store anything in the mime type preferences for the ambiguous
|
// store anything in the mime type preferences for the ambiguous
|
||||||
|
|||||||
@@ -1369,9 +1369,9 @@ var Blocklist = {
|
|||||||
if (!addon.disable)
|
if (!addon.disable)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (addon.item instanceof Ci.nsIPluginTag)
|
if (addon.item instanceof Ci.nsIPluginTag) {
|
||||||
addon.item.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
|
addon.item.enabledState = Ci.nsIPluginTag.STATE_DISABLED;
|
||||||
else {
|
} else {
|
||||||
// This add-on is softblocked.
|
// This add-on is softblocked.
|
||||||
addon.item.softDisabled = true;
|
addon.item.softDisabled = true;
|
||||||
// We must revert certain prefs.
|
// We must revert certain prefs.
|
||||||
|
|||||||
@@ -2130,9 +2130,10 @@ var DownloadAddonInstall = class extends AddonInstall {
|
|||||||
if (this.state == AddonManager.STATE_DOWNLOAD_FAILED) {
|
if (this.state == AddonManager.STATE_DOWNLOAD_FAILED) {
|
||||||
logger.debug("downloadFailed: removing temp file for " + this.sourceURI.spec);
|
logger.debug("downloadFailed: removing temp file for " + this.sourceURI.spec);
|
||||||
this.removeTemporaryFile();
|
this.removeTemporaryFile();
|
||||||
} else
|
} else {
|
||||||
logger.debug("downloadFailed: listener changed AddonInstall state for " +
|
logger.debug("downloadFailed: listener changed AddonInstall state for " +
|
||||||
this.sourceURI.spec + " to " + this.state);
|
this.sourceURI.spec + " to " + this.state);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -2482,8 +2483,9 @@ UpdateChecker.prototype = {
|
|||||||
if (currentInstall.state == AddonManager.STATE_AVAILABLE) {
|
if (currentInstall.state == AddonManager.STATE_AVAILABLE) {
|
||||||
logger.debug("Found an existing AddonInstall for " + this.addon.id);
|
logger.debug("Found an existing AddonInstall for " + this.addon.id);
|
||||||
sendUpdateAvailableMessages(this, currentInstall);
|
sendUpdateAvailableMessages(this, currentInstall);
|
||||||
} else
|
} else {
|
||||||
sendUpdateAvailableMessages(this, null);
|
sendUpdateAvailableMessages(this, null);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1222,9 +1222,9 @@ MockInstall.prototype = {
|
|||||||
this.type = this._type;
|
this.type = this._type;
|
||||||
|
|
||||||
// Adding addon to MockProvider to be implemented when needed
|
// Adding addon to MockProvider to be implemented when needed
|
||||||
if (this._addonToInstall)
|
if (this._addonToInstall) {
|
||||||
this.addon = this._addonToInstall;
|
this.addon = this._addonToInstall;
|
||||||
else {
|
} else {
|
||||||
this.addon = new MockAddon("", this.name, this.type);
|
this.addon = new MockAddon("", this.name, this.type);
|
||||||
this.addon.version = this.version;
|
this.addon.version = this.version;
|
||||||
this.addon.pendingOperations = AddonManager.PENDING_INSTALL;
|
this.addon.pendingOperations = AddonManager.PENDING_INSTALL;
|
||||||
|
|||||||
@@ -268,8 +268,9 @@ var dialog = {
|
|||||||
// default OS handler doesn't have this property
|
// default OS handler doesn't have this property
|
||||||
this._handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;
|
this._handlerInfo.preferredAction = Ci.nsIHandlerInfo.useHelperApp;
|
||||||
this._handlerInfo.preferredApplicationHandler = this.selectedItem.obj;
|
this._handlerInfo.preferredApplicationHandler = this.selectedItem.obj;
|
||||||
} else
|
} else {
|
||||||
this._handlerInfo.preferredAction = Ci.nsIHandlerInfo.useSystemDefault;
|
this._handlerInfo.preferredAction = Ci.nsIHandlerInfo.useSystemDefault;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
this._handlerInfo.alwaysAskBeforeHandling = !checkbox.checked;
|
this._handlerInfo.alwaysAskBeforeHandling = !checkbox.checked;
|
||||||
|
|
||||||
|
|||||||
@@ -27,9 +27,9 @@ var FontBuilder = {
|
|||||||
let defaultFont = null;
|
let defaultFont = null;
|
||||||
// Load Font Lists
|
// Load Font Lists
|
||||||
let fonts = await this.enumerator.EnumerateFontsAsync(aLanguage, aFontType);
|
let fonts = await this.enumerator.EnumerateFontsAsync(aLanguage, aFontType);
|
||||||
if (fonts.length > 0)
|
if (fonts.length > 0) {
|
||||||
defaultFont = this.enumerator.getDefaultFont(aLanguage, aFontType);
|
defaultFont = this.enumerator.getDefaultFont(aLanguage, aFontType);
|
||||||
else {
|
} else {
|
||||||
fonts = await this.enumerator.EnumerateFontsAsync(aLanguage, "");
|
fonts = await this.enumerator.EnumerateFontsAsync(aLanguage, "");
|
||||||
if (fonts.length > 0)
|
if (fonts.length > 0)
|
||||||
defaultFont = this.enumerator.getDefaultFont(aLanguage, "");
|
defaultFont = this.enumerator.getDefaultFont(aLanguage, "");
|
||||||
|
|||||||
@@ -864,9 +864,9 @@ var gDownloadingPage = {
|
|||||||
* When the user clicks the Pause/Resume button
|
* When the user clicks the Pause/Resume button
|
||||||
*/
|
*/
|
||||||
onPause() {
|
onPause() {
|
||||||
if (this._paused)
|
if (this._paused) {
|
||||||
gAUS.downloadUpdate(gUpdates.update, false);
|
gAUS.downloadUpdate(gUpdates.update, false);
|
||||||
else {
|
} else {
|
||||||
var patch = gUpdates.update.selectedPatch;
|
var patch = gUpdates.update.selectedPatch;
|
||||||
patch.QueryInterface(Ci.nsIWritablePropertyBag);
|
patch.QueryInterface(Ci.nsIWritablePropertyBag);
|
||||||
patch.setProperty("status", this._pausedStatus);
|
patch.setProperty("status", this._pausedStatus);
|
||||||
|
|||||||
@@ -67,6 +67,12 @@ balanced-listeners
|
|||||||
Checks that for every occurrence of 'addEventListener' or 'on' there is an
|
Checks that for every occurrence of 'addEventListener' or 'on' there is an
|
||||||
occurrence of 'removeEventListener' or 'off' with the same event name.
|
occurrence of 'removeEventListener' or 'off' with the same event name.
|
||||||
|
|
||||||
|
consistent-if-bracing
|
||||||
|
---------------------
|
||||||
|
|
||||||
|
Checks that if/elseif/else bodies are braced consistently, so either all bodies
|
||||||
|
are braced or unbraced. Doesn't enforce either of those styles though.
|
||||||
|
|
||||||
import-browser-window-globals
|
import-browser-window-globals
|
||||||
-----------------------------
|
-----------------------------
|
||||||
|
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ module.exports = {
|
|||||||
"max-nested-callbacks": ["error", 10],
|
"max-nested-callbacks": ["error", 10],
|
||||||
|
|
||||||
"mozilla/avoid-removeChild": "error",
|
"mozilla/avoid-removeChild": "error",
|
||||||
|
"mozilla/consistent-if-bracing": "error",
|
||||||
"mozilla/import-browser-window-globals": "error",
|
"mozilla/import-browser-window-globals": "error",
|
||||||
"mozilla/import-globals": "error",
|
"mozilla/import-globals": "error",
|
||||||
"mozilla/no-compare-against-boolean-literals": "error",
|
"mozilla/no-compare-against-boolean-literals": "error",
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ module.exports = {
|
|||||||
"avoid-Date-timing": require("../lib/rules/avoid-Date-timing"),
|
"avoid-Date-timing": require("../lib/rules/avoid-Date-timing"),
|
||||||
"avoid-removeChild": require("../lib/rules/avoid-removeChild"),
|
"avoid-removeChild": require("../lib/rules/avoid-removeChild"),
|
||||||
"balanced-listeners": require("../lib/rules/balanced-listeners"),
|
"balanced-listeners": require("../lib/rules/balanced-listeners"),
|
||||||
|
"consistent-if-bracing": require("../lib/rules/consistent-if-bracing"),
|
||||||
"import-browser-window-globals":
|
"import-browser-window-globals":
|
||||||
require("../lib/rules/import-browser-window-globals"),
|
require("../lib/rules/import-browser-window-globals"),
|
||||||
"import-content-task-globals":
|
"import-content-task-globals":
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
/**
|
||||||
|
* @fileoverview checks if/else if/else bracing is consistent
|
||||||
|
*
|
||||||
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||||
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||||
|
*/
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
meta: {
|
||||||
|
messages: {
|
||||||
|
consistentIfBracing: "Bracing of if..else bodies should be consistent.",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
create(context) {
|
||||||
|
return {
|
||||||
|
IfStatement(node) {
|
||||||
|
if (node.parent.type !== "IfStatement") {
|
||||||
|
let types = new Set();
|
||||||
|
for (let currentNode = node; currentNode; currentNode = currentNode.alternate) {
|
||||||
|
let type = currentNode.consequent.type;
|
||||||
|
types.add(type == "BlockStatement" ? "Block" : "NotBlock");
|
||||||
|
if (currentNode.alternate && currentNode.alternate.type !== "IfStatement") {
|
||||||
|
type = currentNode.alternate.type;
|
||||||
|
types.add(type == "BlockStatement" ? "Block" : "NotBlock");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (types.size > 1) {
|
||||||
|
context.report({
|
||||||
|
node,
|
||||||
|
messageId: "consistentIfBracing",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eslint-plugin-mozilla",
|
"name": "eslint-plugin-mozilla",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"lockfileVersion": 1,
|
"lockfileVersion": 1,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "eslint-plugin-mozilla",
|
"name": "eslint-plugin-mozilla",
|
||||||
"version": "1.1.1",
|
"version": "1.1.2",
|
||||||
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
|
"description": "A collection of rules that help enforce JavaScript coding standard in the Mozilla project.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"eslint",
|
"eslint",
|
||||||
|
|||||||
@@ -0,0 +1,40 @@
|
|||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Requirements
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
var rule = require("../lib/rules/consistent-if-bracing");
|
||||||
|
var RuleTester = require("eslint/lib/testers/rule-tester");
|
||||||
|
|
||||||
|
const ruleTester = new RuleTester({ parserOptions: { ecmaVersion: 8 } });
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// Tests
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
function invalidCode(code) {
|
||||||
|
return {code, errors: [{messageId: "consistentIfBracing"}]};
|
||||||
|
}
|
||||||
|
|
||||||
|
ruleTester.run("consistent-if-bracing", rule, {
|
||||||
|
valid: [
|
||||||
|
"if (true) {1} else {0}",
|
||||||
|
"if (false) 1; else 0",
|
||||||
|
"if (true) {1} else if (true) {2} else {0}",
|
||||||
|
"if (true) {1} else if (true) {2} else if (true) {3} else {0}",
|
||||||
|
],
|
||||||
|
invalid: [
|
||||||
|
invalidCode(`if (true) {1} else 0`),
|
||||||
|
invalidCode("if (true) 1; else {0}"),
|
||||||
|
invalidCode("if (true) {1} else if (true) 2; else {0}"),
|
||||||
|
invalidCode("if (true) 1; else if (true) {2} else {0}"),
|
||||||
|
invalidCode("if (true) {1} else if (true) 2; else {0}"),
|
||||||
|
invalidCode("if (true) {1} else if (true) {2} else 0"),
|
||||||
|
invalidCode("if (true) {1} else if (true) {2} else if (true) 3; else {0}"),
|
||||||
|
invalidCode("if (true) {if (true) 1; else {0}} else {0}"),
|
||||||
|
],
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user