Bug 1452575 - Automatically fix ESLint issues in shared jsm files in devtools. r=jryans

MozReview-Commit-ID: 422ylOOSZUx

--HG--
extra : rebase_source : 2634cf4588d47274316a2209e3ec34592f7ba4c5
This commit is contained in:
Mark Banner 2018-04-09 10:44:03 +01:00
parent 37ac8f6ab0
commit d3608825b8
9 changed files with 326 additions and 342 deletions

View file

@ -328,7 +328,7 @@ AppCacheUtils.prototype = {
if (this.doc) {
let uri = getURI();
return resolve(uri);
} else {
}
this._getURIInfo(this.uri).then(uriInfo => {
if (uriInfo.success) {
let html = uriInfo.text;
@ -343,7 +343,6 @@ AppCacheUtils.prototype = {
});
}
});
}
});
},
@ -618,7 +617,6 @@ XPCOMUtils.defineLazyGetter(this, "l10n", () => Services.strings
XPCOMUtils.defineLazyGetter(this, "appcacheservice", function() {
return Cc["@mozilla.org/network/application-cache-service;1"]
.getService(Ci.nsIApplicationCacheService);
});
XPCOMUtils.defineLazyGetter(this, "_DOMParser", function() {

View file

@ -26,8 +26,7 @@ this.DOMHelpers = function DOMHelpers(aWindow) {
};
DOMHelpers.prototype = {
getParentObject: function Helpers_getParentObject(node)
{
getParentObject: function Helpers_getParentObject(node) {
let parentNode = node ? node.parentNode : null;
if (!parentNode) {
@ -37,10 +36,11 @@ DOMHelpers.prototype = {
// document type
if (node.defaultView) {
let embeddingFrame = node.defaultView.frameElement;
if (embeddingFrame)
if (embeddingFrame) {
return embeddingFrame.parentNode;
}
}
}
// a Document object without a parentNode or window
return null; // top level has no parent
}
@ -53,17 +53,18 @@ DOMHelpers.prototype = {
return null;
}
if (!parentNode.localName)
if (!parentNode.localName) {
return null;
}
return parentNode;
},
getChildObject: function Helpers_getChildObject(node, index, previousSibling,
showTextNodesWithWhitespace)
{
if (!node)
showTextNodesWithWhitespace) {
if (!node) {
return null;
}
if (node.contentDocument) {
// then the node is a frame
@ -86,47 +87,48 @@ DOMHelpers.prototype = {
let child = null;
if (previousSibling) // then we are walking
{
child = this.getNextSibling(previousSibling);
else
} else {
child = this.getFirstChild(node);
}
if (showTextNodesWithWhitespace)
if (showTextNodesWithWhitespace) {
return child;
}
for (; child; child = this.getNextSibling(child)) {
if (!this.isWhitespaceText(child))
if (!this.isWhitespaceText(child)) {
return child;
}
}
return null; // we have no children worth showing.
},
getFirstChild: function Helpers_getFirstChild(node)
{
getFirstChild: function Helpers_getFirstChild(node) {
let SHOW_ALL = nodeFilterConstants.SHOW_ALL;
this.treeWalker = node.ownerDocument.createTreeWalker(node,
SHOW_ALL, null);
return this.treeWalker.firstChild();
},
getNextSibling: function Helpers_getNextSibling(node)
{
getNextSibling: function Helpers_getNextSibling(node) {
let next = this.treeWalker.nextSibling();
if (!next)
if (!next) {
delete this.treeWalker;
}
return next;
},
isWhitespaceText: function Helpers_isWhitespaceText(node)
{
isWhitespaceText: function Helpers_isWhitespaceText(node) {
return node.nodeType == this.window.Node.TEXT_NODE &&
!/[^\s]/.exec(node.nodeValue);
},
destroy: function Helpers_destroy()
{
destroy: function Helpers_destroy() {
delete this.window;
delete this.treeWalker;
},

View file

@ -28,8 +28,7 @@ var bindings = new WeakMap();
* @param DOMElement aRoot
* @see appendItem
*/
this.SplitView = function SplitView(aRoot)
{
this.SplitView = function SplitView(aRoot) {
this._root = aRoot;
this._controller = aRoot.querySelector(".splitview-controller");
this._nav = aRoot.querySelector(".splitview-nav");
@ -89,8 +88,7 @@ SplitView.prototype = {
*
* @return boolean
*/
get isLandscape()
{
get isLandscape() {
return this._mql.matches;
},
@ -99,8 +97,7 @@ SplitView.prototype = {
*
* @return DOMElement
*/
get rootElement()
{
get rootElement() {
return this._root;
},
@ -109,8 +106,7 @@ SplitView.prototype = {
*
* @return DOMElement
*/
get activeSummary()
{
get activeSummary() {
return this._activeSummary;
},
@ -119,8 +115,7 @@ SplitView.prototype = {
*
* @param DOMElement aSummary
*/
set activeSummary(aSummary)
{
set activeSummary(aSummary) {
if (aSummary == this._activeSummary) {
return;
}
@ -155,8 +150,7 @@ SplitView.prototype = {
* Retrieve the active item's details element or null if there is none.
* @return DOMElement
*/
get activeDetails()
{
get activeDetails() {
let summary = this.activeSummary;
return summary ? bindings.get(summary)._details : null;
},
@ -169,8 +163,7 @@ SplitView.prototype = {
* Summary element with given ordinal or null if not found.
* @see appendItem
*/
getSummaryElementByOrdinal: function SEC_getSummaryElementByOrdinal(aOrdinal)
{
getSummaryElementByOrdinal: function SEC_getSummaryElementByOrdinal(aOrdinal) {
return this._nav.querySelector("* > li[data-ordinal='" + aOrdinal + "']");
},
@ -198,8 +191,7 @@ SplitView.prototype = {
* Items with a lower ordinal are displayed before those with a
* higher ordinal.
*/
appendItem: function ASV_appendItem(aSummary, aDetails, aOptions)
{
appendItem: function ASV_appendItem(aSummary, aDetails, aOptions) {
let binding = aOptions || {};
binding._summary = aSummary;
@ -235,8 +227,7 @@ SplitView.prototype = {
* Object with the new DOM elements created for summary and details.
* @see appendItem
*/
appendTemplatedItem: function ASV_appendTemplatedItem(aName, aOptions)
{
appendTemplatedItem: function ASV_appendTemplatedItem(aName, aOptions) {
aOptions = aOptions || {};
let summary = this._root.querySelector("#splitview-tpl-summary-" + aName);
let details = this._root.querySelector("#splitview-tpl-details-" + aName);
@ -260,8 +251,7 @@ SplitView.prototype = {
* @param DOMElement aSummary
* Summary element of the item to remove.
*/
removeItem: function ASV_removeItem(aSummary)
{
removeItem: function ASV_removeItem(aSummary) {
if (aSummary == this._activeSummary) {
this.activeSummary = null;
}
@ -278,8 +268,7 @@ SplitView.prototype = {
/**
* Remove all items from the split view.
*/
removeAll: function ASV_removeAll()
{
removeAll: function ASV_removeAll() {
while (this._nav.hasChildNodes()) {
this.removeItem(this._nav.firstChild);
}
@ -295,8 +284,7 @@ SplitView.prototype = {
* @param string aClassName
* One or more space-separated CSS classes.
*/
setItemClassName: function ASV_setItemClassName(aSummary, aClassName)
{
setItemClassName: function ASV_setItemClassName(aSummary, aClassName) {
let binding = bindings.get(aSummary);
let viewSpecific;

View file

@ -522,7 +522,9 @@ AbstractTreeItem.prototype = {
*/
_focusNextNode: function() {
let nextElement = this._getSiblingAtDelta(1);
if (nextElement) nextElement.focus(); // nsIDOMNode
if (nextElement) {
nextElement.focus();
} // nsIDOMNode
},
/**
@ -530,7 +532,9 @@ AbstractTreeItem.prototype = {
*/
_focusPrevNode: function() {
let prevElement = this._getSiblingAtDelta(-1);
if (prevElement) prevElement.focus(); // nsIDOMNode
if (prevElement) {
prevElement.focus();
} // nsIDOMNode
},
/**
@ -541,7 +545,9 @@ AbstractTreeItem.prototype = {
*/
_focusParentNode: function() {
let parentItem = this._parentItem;
if (parentItem) parentItem.focus(); // AbstractTreeItem
if (parentItem) {
parentItem.focus();
} // AbstractTreeItem
},
/**
@ -635,7 +641,6 @@ AbstractTreeItem.prototype = {
case KeyCodes.DOM_VK_END:
this._focusLastNode();
return;
}
},

View file

@ -149,8 +149,12 @@ BreadcrumbsWidget.prototype = {
* The current attribute value.
*/
getAttribute: function(aName) {
if (aName == "scrollPosition") return this._list.scrollPosition;
if (aName == "scrollWidth") return this._list.scrollWidth;
if (aName == "scrollPosition") {
return this._list.scrollPosition;
}
if (aName == "scrollWidth") {
return this._list.scrollWidth;
}
return this._parent.getAttribute(aName);
},

View file

@ -398,9 +398,8 @@ SideMenuWidget.prototype = {
_getNodeForContents: function(aChild) {
if (aChild.hasAttribute("merged-item-contents")) {
return aChild;
} else {
return aChild.parentNode;
}
return aChild.parentNode;
},
/**
@ -503,7 +502,9 @@ SideMenuGroup.prototype = {
get _orderedMenuElementsArray() {
return this.ownerView._orderedMenuElementsArray;
},
get _itemsByElement() { return this.ownerView._itemsByElement; },
get _itemsByElement() {
return this.ownerView._itemsByElement;
},
/**
* Inserts this group in the parent container at the specified index.
@ -614,7 +615,9 @@ SideMenuItem.prototype = {
get _orderedMenuElementsArray() {
return this.ownerView._orderedMenuElementsArray;
},
get _itemsByElement() { return this.ownerView._itemsByElement; },
get _itemsByElement() {
return this.ownerView._itemsByElement;
},
/**
* Inserts this item in the parent group at the specified index.

View file

@ -508,7 +508,6 @@ VariablesView.prototype = {
case KeyCodes.DOM_VK_ESCAPE:
this._searchboxNode.value = "";
this._onSearchboxInput();
return;
}
},
@ -900,7 +899,6 @@ VariablesView.prototype = {
case KeyCodes.DOM_VK_INSERT:
item._onAddProperty(e);
return;
}
},
@ -1205,7 +1203,6 @@ VariablesView.getterOrSetterDeleteCallback = function (aItem) {
return true; // Don't hide the element.
};
/**
* A Scope is an object holding Variable instances.
* Iterable via "for (let [name, variable] of instance) { }".
@ -2445,16 +2442,13 @@ Variable.prototype = extend(Scope.prototype, {
if (aGrip && (aGrip.optimizedOut || aGrip.uninitialized || aGrip.missingArguments)) {
if (aGrip.optimizedOut) {
this._valueString = L10N.getStr("variablesViewOptimizedOut");
}
else if (aGrip.uninitialized) {
} else if (aGrip.uninitialized) {
this._valueString = L10N.getStr("variablesViewUninitialized");
}
else if (aGrip.missingArguments) {
} else if (aGrip.missingArguments) {
this._valueString = L10N.getStr("variablesViewMissingArgs");
}
this.eval = null;
}
else {
} else {
this._valueString = VariablesView.getString(aGrip, {
concise: true,
noEllipsis: true,
@ -2870,16 +2864,13 @@ Variable.prototype = extend(Scope.prototype, {
if (name == "this") {
target.setAttribute("self", "");
}
else if (this._internalItem && name == "<exception>") {
} else if (this._internalItem && name == "<exception>") {
target.setAttribute("exception", "");
target.setAttribute("pseudo-item", "");
}
else if (this._internalItem && name == "<return>") {
} else if (this._internalItem && name == "<return>") {
target.setAttribute("return", "");
target.setAttribute("pseudo-item", "");
}
else if (name == "__proto__") {
} else if (name == "__proto__") {
target.setAttribute("proto", "");
target.setAttribute("pseudo-item", "");
}
@ -3815,7 +3806,6 @@ VariablesView.stringifiers.byObjectKind = {
}, // DOMNode
}; // VariablesView.stringifiers.byObjectKind
/**
* Get the "N more…" formatted string, given an N. This is used for displaying
* how many elements are not displayed in an object preview (eg. an array).
@ -3903,8 +3893,8 @@ function escapeString(aString) {
return "";
}
// U+2028 and U+2029 are allowed in JSON but not in ECMAScript string literals.
return JSON.stringify(aString).replace(/\u2028/g, '\\u2028')
.replace(/\u2029/g, '\\u2029');
return JSON.stringify(aString).replace(/\u2028/g, "\\u2028")
.replace(/\u2029/g, "\\u2029");
}
/**
@ -3922,7 +3912,6 @@ function escapeHTML(aString) {
.replace(/>/g, "&gt;");
}
/**
* An Editable encapsulates the UI of an edit box that overlays a label,
* allowing the user to edit the value.
@ -4094,7 +4083,6 @@ Editable.prototype = {
},
};
/**
* An Editable specific to editing the name of a Variable or Property.
*/
@ -4116,7 +4104,6 @@ EditableName.prototype = extend(Editable.prototype, {
},
});
/**
* An Editable specific to editing the value of a Variable or Property.
*/
@ -4138,7 +4125,6 @@ EditableValue.prototype = extend(Editable.prototype, {
},
});
/**
* An Editable specific to editing the key and value of a new property.
*/

View file

@ -294,7 +294,6 @@ VariablesViewController.prototype = {
};
deferred.resolve(this._populatePropertySlices(aTarget, sliceGrip));
});
}
return deferred.promise;
},
@ -778,7 +777,6 @@ VariablesViewController.prototype = {
},
};
/**
* Attaches a VariablesViewController to a VariablesView if it doesn't already
* have one.