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
Родитель 37ac8f6ab0
Коммит d3608825b8
9 изменённых файлов: 326 добавлений и 342 удалений

Просмотреть файл

@ -68,7 +68,7 @@ AppCacheUtils.prototype = {
this._getURIInfo(this.manifestURI).then(uriInfo => {
this._parseManifest(uriInfo).then(() => {
// Sort errors by line number.
this.errors.sort(function (a, b) {
this.errors.sort(function(a, b) {
return a.line - b.line;
});
resolve(this.errors);
@ -195,12 +195,12 @@ AppCacheUtils.prototype = {
channel.loadFlags |= Ci.nsIRequest.INHIBIT_CACHING;
channel.asyncOpen2({
onStartRequest: function (request, context) {
onStartRequest: function(request, context) {
// This empty method is needed in order for onDataAvailable to be
// called.
},
onDataAvailable: function (request, context, stream, offset, count) {
onDataAvailable: function(request, context, stream, offset, count) {
request.QueryInterface(Ci.nsIHttpChannel);
inputStream.init(stream);
buffer = buffer.concat(inputStream.read(count));
@ -223,12 +223,12 @@ AppCacheUtils.prototype = {
};
result.requestHeaders = {};
request.visitRequestHeaders(function (header, value) {
request.visitRequestHeaders(function(header, value) {
result.requestHeaders[header.toLowerCase()] = value;
});
result.responseHeaders = {};
request.visitResponseHeaders(function (header, value) {
request.visitResponseHeaders(function(header, value) {
result.responseHeaders[header.toLowerCase()] = value;
});
@ -253,9 +253,9 @@ AppCacheUtils.prototype = {
let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
appCacheStorage.asyncVisitStorage({
onCacheStorageInfo: function () {},
onCacheStorageInfo: function() {},
onCacheEntryInfo: function (aURI, aIdEnhance, aDataSize, aFetchCount, aLastModifiedTime, aExpirationTime) {
onCacheEntryInfo: function(aURI, aIdEnhance, aDataSize, aFetchCount, aLastModifiedTime, aExpirationTime) {
let lowerKey = aURI.asciiSpec.toLowerCase();
if (searchTerm && !lowerKey.includes(searchTerm.toLowerCase())) {
@ -302,7 +302,7 @@ AppCacheUtils.prototype = {
let appCacheStorage = Services.cache2.appCacheStorage(Services.loadContextInfo.default, null);
appCacheStorage.asyncEvictStorage({
onCacheEntryDoomed: function (result) {}
onCacheEntryDoomed: function(result) {}
});
},
@ -328,22 +328,21 @@ 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;
let parser = _DOMParser;
this.doc = parser.parseFromString(html, "text/html");
let uri = getURI();
resolve(uri);
} else {
this.errors.push({
}
this._getURIInfo(this.uri).then(uriInfo => {
if (uriInfo.success) {
let html = uriInfo.text;
let parser = _DOMParser;
this.doc = parser.parseFromString(html, "text/html");
let uri = getURI();
resolve(uri);
} else {
this.errors.push({
line: 0,
msg: l10n.GetStringFromName("invalidURI")
});
}
});
}
});
}
});
});
},
@ -615,12 +614,11 @@ ManifestParser.prototype = {
XPCOMUtils.defineLazyGetter(this, "l10n", () => Services.strings
.createBundle("chrome://devtools/locale/appcacheutils.properties"));
XPCOMUtils.defineLazyGetter(this, "appcacheservice", function () {
XPCOMUtils.defineLazyGetter(this, "appcacheservice", function() {
return Cc["@mozilla.org/network/application-cache-service;1"]
.getService(Ci.nsIApplicationCacheService);
});
XPCOMUtils.defineLazyGetter(this, "_DOMParser", function () {
XPCOMUtils.defineLazyGetter(this, "_DOMParser", function() {
return Cc["@mozilla.org/xmlextras/domparser;1"].createInstance(Ci.nsIDOMParser);
});

Просмотреть файл

@ -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,12 +36,13 @@ 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
return null; // top level has no parent
}
if (parentNode.nodeType == this.window.Node.DOCUMENT_NODE) {
@ -53,22 +53,23 @@ 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
if (index == 0) {
return node.contentDocument.documentElement; // the node's HTMLElement
return node.contentDocument.documentElement; // the node's HTMLElement
}
return null;
}
@ -78,55 +79,56 @@ DOMHelpers.prototype = {
if (svgDocument) {
// then the node is a frame
if (index == 0) {
return svgDocument.documentElement; // the node's SVGElement
return svgDocument.documentElement; // the node's SVGElement
}
return null;
}
}
let child = null;
if (previousSibling) // then we are walking
if (previousSibling) // then we are walking
{
child = this.getNextSibling(previousSibling);
else
} else {
child = this.getFirstChild(node);
if (showTextNodesWithWhitespace)
return child;
for (; child; child = this.getNextSibling(child)) {
if (!this.isWhitespaceText(child))
return child;
}
return null; // we have no children worth showing.
if (showTextNodesWithWhitespace) {
return child;
}
for (; child; child = this.getNextSibling(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;
},
@ -144,7 +146,7 @@ DOMHelpers.prototype = {
let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell);
let onReady = function (event) {
let onReady = function(event) {
if (event.target == window.document) {
docShell.chromeEventHandler.removeEventListener("DOMContentLoaded", onReady);
// If in `callback` the URL of the window is changed and a listener to DOMContentLoaded

Просмотреть файл

@ -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;

Просмотреть файл

@ -149,7 +149,7 @@ AbstractTreeItem.prototype = {
* @param nsIDOMNode arrowNode
* @return nsIDOMNode
*/
_displaySelf: function (document, arrowNode) {
_displaySelf: function(document, arrowNode) {
throw new Error(
"The `_displaySelf` method needs to be implemented by inheriting classes.");
},
@ -162,7 +162,7 @@ AbstractTreeItem.prototype = {
*
* @param array:AbstractTreeItem children
*/
_populateSelf: function (children) {
_populateSelf: function(children) {
throw new Error(
"The `_populateSelf` method needs to be implemented by inheriting classes.");
},
@ -252,7 +252,7 @@ AbstractTreeItem.prototype = {
* @param nsIDOMNode beforeNode [optional]
* An optional child element which should succeed this tree item.
*/
attachTo: function (containerNode, fragmentNode = containerNode, beforeNode = null) {
attachTo: function(containerNode, fragmentNode = containerNode, beforeNode = null) {
this._containerNode = containerNode;
this._constructTargetNode();
@ -271,7 +271,7 @@ AbstractTreeItem.prototype = {
* Permanently removes this tree item (and all subsequent children) from the
* parent container.
*/
remove: function () {
remove: function() {
this._targetNode.remove();
this._hideChildren();
this._childTreeItems.length = 0;
@ -280,14 +280,14 @@ AbstractTreeItem.prototype = {
/**
* Focuses this item in the tree.
*/
focus: function () {
focus: function() {
this._targetNode.focus();
},
/**
* Expands this item in the tree.
*/
expand: function () {
expand: function() {
if (this._expanded) {
return;
}
@ -301,7 +301,7 @@ AbstractTreeItem.prototype = {
/**
* Collapses this item in the tree.
*/
collapse: function () {
collapse: function() {
if (!this._expanded) {
return;
}
@ -318,7 +318,7 @@ AbstractTreeItem.prototype = {
* @param number index
* @return AbstractTreeItem
*/
getChild: function (index = 0) {
getChild: function(index = 0) {
return this._childTreeItems[index];
},
@ -327,7 +327,7 @@ AbstractTreeItem.prototype = {
* If this item was never expanded, then no descendents exist yet.
* @param function cb
*/
traverse: function (cb) {
traverse: function(cb) {
for (let child of this._childTreeItems) {
cb(child);
child.bfs();
@ -340,7 +340,7 @@ AbstractTreeItem.prototype = {
* @param function predicate
* @return AbstractTreeItem
*/
find: function (predicate) {
find: function(predicate) {
for (let child of this._childTreeItems) {
if (predicate(child) || child.find(predicate)) {
return child;
@ -356,7 +356,7 @@ AbstractTreeItem.prototype = {
* @param boolean visible
* True if the children should be visible, false otherwise.
*/
_toggleChildren: function (visible) {
_toggleChildren: function(visible) {
if (visible) {
if (!this._populated) {
this._populateSelf(this._childTreeItems);
@ -371,7 +371,7 @@ AbstractTreeItem.prototype = {
/**
* Shows all children of this item in the tree.
*/
_showChildren: function () {
_showChildren: function() {
// If this is the root item and we're not expanding any child nodes,
// it is safe to append everything at once.
if (this == this._rootItem && this.autoExpandDepth == 0) {
@ -388,7 +388,7 @@ AbstractTreeItem.prototype = {
/**
* Hides all children of this item in the tree.
*/
_hideChildren: function () {
_hideChildren: function() {
for (let item of this._childTreeItems) {
item._targetNode.remove();
item._hideChildren();
@ -399,7 +399,7 @@ AbstractTreeItem.prototype = {
* Appends all children in a single batch.
* This only works properly for root nodes when no child nodes will expand.
*/
_appendChildrenBatch: function () {
_appendChildrenBatch: function() {
if (this._fragment === undefined) {
this._fragment = this.document.createDocumentFragment();
}
@ -416,7 +416,7 @@ AbstractTreeItem.prototype = {
/**
* Appends all children successively.
*/
_appendChildrenSuccessive: function () {
_appendChildrenSuccessive: function() {
let childTreeItems = this._childTreeItems;
let expandedChildTreeItems = childTreeItems.filter(e => e._expanded);
let nextNode = this._getSiblingAtDelta(1);
@ -432,7 +432,7 @@ AbstractTreeItem.prototype = {
/**
* Constructs and stores the target node displaying this tree item.
*/
_constructTargetNode: function () {
_constructTargetNode: function() {
if (this._constructed) {
return;
}
@ -470,7 +470,7 @@ AbstractTreeItem.prototype = {
* @return nsIDOMNode
* The element displaying the target item at the specified offset.
*/
_getSiblingAtDelta: function (delta) {
_getSiblingAtDelta: function(delta) {
let childNodes = this._containerNode.childNodes;
let indexOfSelf = Array.indexOf(childNodes, this._targetNode);
if (indexOfSelf + delta >= 0) {
@ -496,7 +496,7 @@ AbstractTreeItem.prototype = {
/**
* Focuses the first item in this tree.
*/
_focusFirstNode: function () {
_focusFirstNode: function() {
let childNodes = this._containerNode.childNodes;
// The root node of the tree may be hidden in practice, so uses for-loop
// here to find the next visible node.
@ -512,7 +512,7 @@ AbstractTreeItem.prototype = {
/**
* Focuses the last item in this tree.
*/
_focusLastNode: function () {
_focusLastNode: function() {
let childNodes = this._containerNode.childNodes;
childNodes[childNodes.length - 1].focus();
},
@ -520,17 +520,21 @@ AbstractTreeItem.prototype = {
/**
* Focuses the next item in this tree.
*/
_focusNextNode: function () {
_focusNextNode: function() {
let nextElement = this._getSiblingAtDelta(1);
if (nextElement) nextElement.focus(); // nsIDOMNode
if (nextElement) {
nextElement.focus();
} // nsIDOMNode
},
/**
* Focuses the previous item in this tree.
*/
_focusPrevNode: function () {
_focusPrevNode: function() {
let prevElement = this._getSiblingAtDelta(-1);
if (prevElement) prevElement.focus(); // nsIDOMNode
if (prevElement) {
prevElement.focus();
} // nsIDOMNode
},
/**
@ -539,15 +543,17 @@ AbstractTreeItem.prototype = {
* The parent item is not always the previous item, because any tree item
* may have multiple children.
*/
_focusParentNode: function () {
_focusParentNode: function() {
let parentItem = this._parentItem;
if (parentItem) parentItem.focus(); // AbstractTreeItem
if (parentItem) {
parentItem.focus();
} // AbstractTreeItem
},
/**
* Handler for the "click" event on the arrow node of this tree item.
*/
_onArrowClick: function (e) {
_onArrowClick: function(e) {
if (!this._expanded) {
this.expand();
} else {
@ -558,7 +564,7 @@ AbstractTreeItem.prototype = {
/**
* Handler for the "click" event on the element displaying this tree item.
*/
_onClick: function (e) {
_onClick: function(e) {
e.stopPropagation();
this.focus();
},
@ -566,7 +572,7 @@ AbstractTreeItem.prototype = {
/**
* Handler for the "dblclick" event on the element displaying this tree item.
*/
_onDoubleClick: function (e) {
_onDoubleClick: function(e) {
// Ignore dblclick on the arrow as it has already recived and handled two
// click events.
if (!e.target.classList.contains("arrow")) {
@ -578,7 +584,7 @@ AbstractTreeItem.prototype = {
/**
* Handler for the "keydown" event on the element displaying this tree item.
*/
_onKeyDown: function (e) {
_onKeyDown: function(e) {
// Prevent scrolling when pressing navigation keys.
ViewHelpers.preventScrolling(e);
@ -635,21 +641,20 @@ AbstractTreeItem.prototype = {
case KeyCodes.DOM_VK_END:
this._focusLastNode();
return;
}
},
/**
* Handler for the "focus" event on the element displaying this tree item.
*/
_onFocus: function (e) {
_onFocus: function(e) {
this._rootItem.emit("focus", this);
},
/**
* Handler for the "blur" event on the element displaying this tree item.
*/
_onBlur: function (e) {
_onBlur: function(e) {
this._rootItem.emit("blur", this);
}
};

Просмотреть файл

@ -67,7 +67,7 @@ BreadcrumbsWidget.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
insertItemAt: function (aIndex, aContents) {
insertItemAt: function(aIndex, aContents) {
let list = this._list;
let breadcrumb = new Breadcrumb(this, aContents);
return list.insertBefore(breadcrumb._target, list.childNodes[aIndex]);
@ -81,7 +81,7 @@ BreadcrumbsWidget.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
getItemAtIndex: function (aIndex) {
getItemAtIndex: function(aIndex) {
return this._list.childNodes[aIndex];
},
@ -91,7 +91,7 @@ BreadcrumbsWidget.prototype = {
* @param nsIDOMNode aChild
* The element associated with the displayed item.
*/
removeChild: function (aChild) {
removeChild: function(aChild) {
this._list.removeChild(aChild);
if (this._selectedItem == aChild) {
@ -102,7 +102,7 @@ BreadcrumbsWidget.prototype = {
/**
* Removes all of the child nodes from this container.
*/
removeAllItems: function () {
removeAllItems: function() {
let list = this._list;
while (list.hasChildNodes()) {
@ -148,9 +148,13 @@ BreadcrumbsWidget.prototype = {
* @return string
* The current attribute value.
*/
getAttribute: function (aName) {
if (aName == "scrollPosition") return this._list.scrollPosition;
if (aName == "scrollWidth") return this._list.scrollWidth;
getAttribute: function(aName) {
if (aName == "scrollPosition") {
return this._list.scrollPosition;
}
if (aName == "scrollWidth") {
return this._list.scrollWidth;
}
return this._parent.getAttribute(aName);
},
@ -160,7 +164,7 @@ BreadcrumbsWidget.prototype = {
* @param nsIDOMNode aElement
* The element to make visible.
*/
ensureElementIsVisible: function (aElement) {
ensureElementIsVisible: function(aElement) {
if (!aElement) {
return;
}
@ -177,7 +181,7 @@ BreadcrumbsWidget.prototype = {
/**
* The underflow and overflow listener for the arrowscrollbox container.
*/
_onUnderflow: function ({ target }) {
_onUnderflow: function({ target }) {
if (target != this._list) {
return;
}
@ -189,7 +193,7 @@ BreadcrumbsWidget.prototype = {
/**
* The underflow and overflow listener for the arrowscrollbox container.
*/
_onOverflow: function ({ target }) {
_onOverflow: function({ target }) {
if (target != this._list) {
return;
}

Просмотреть файл

@ -100,7 +100,7 @@ SideMenuWidget.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
insertItemAt: function (aIndex, aContents, aAttachment = {}) {
insertItemAt: function(aIndex, aContents, aAttachment = {}) {
let group = this._getMenuGroupForName(aAttachment.group);
let item = this._getMenuItemForGroup(group, aContents, aAttachment);
let element = item.insertSelfAt(aIndex);
@ -115,7 +115,7 @@ SideMenuWidget.prototype = {
*
* @return bool
*/
isScrolledToBottom: function () {
isScrolledToBottom: function() {
if (this._list.lastElementChild) {
let utils = this.window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
@ -133,7 +133,7 @@ SideMenuWidget.prototype = {
* Scroll the list to the bottom after a timeout.
* If the user scrolls in the meantime, cancel this operation.
*/
scrollToBottom: function () {
scrollToBottom: function() {
this._list.scrollTop = this._list.scrollHeight;
this.emit("scroll-to-bottom");
},
@ -146,7 +146,7 @@ SideMenuWidget.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
getItemAtIndex: function (aIndex) {
getItemAtIndex: function(aIndex) {
return this._orderedMenuElementsArray[aIndex];
},
@ -156,7 +156,7 @@ SideMenuWidget.prototype = {
* @param nsIDOMNode aChild
* The element associated with the displayed item.
*/
removeChild: function (aChild) {
removeChild: function(aChild) {
this._getNodeForContents(aChild).remove();
this._orderedMenuElementsArray.splice(
@ -172,7 +172,7 @@ SideMenuWidget.prototype = {
/**
* Removes all of the child nodes from this container.
*/
removeAllItems: function () {
removeAllItems: function() {
let parent = this._parent;
let list = this._list;
@ -222,7 +222,7 @@ SideMenuWidget.prototype = {
* @param nsIDOMNode aElement
* The element to make visible.
*/
ensureElementIsVisible: function (aElement) {
ensureElementIsVisible: function(aElement) {
if (!aElement) {
return;
}
@ -236,7 +236,7 @@ SideMenuWidget.prototype = {
/**
* Shows all the groups, even the ones with no visible children.
*/
showEmptyGroups: function () {
showEmptyGroups: function() {
for (let group of this._orderedGroupElementsArray) {
group.hidden = false;
}
@ -245,7 +245,7 @@ SideMenuWidget.prototype = {
/**
* Hides all the groups which have no visible children.
*/
hideEmptyGroups: function () {
hideEmptyGroups: function() {
let visibleChildNodes = ".side-menu-widget-item-contents:not([hidden=true])";
for (let group of this._orderedGroupElementsArray) {
@ -264,7 +264,7 @@ SideMenuWidget.prototype = {
* @param string aValue
* The desired attribute value.
*/
setAttribute: function (aName, aValue) {
setAttribute: function(aName, aValue) {
this._parent.setAttribute(aName, aValue);
if (aName == "emptyText") {
@ -278,7 +278,7 @@ SideMenuWidget.prototype = {
* @param string aName
* The name of the attribute.
*/
removeAttribute: function (aName) {
removeAttribute: function(aName) {
this._parent.removeAttribute(aName);
if (aName == "emptyText") {
@ -294,7 +294,7 @@ SideMenuWidget.prototype = {
* @param boolean aCheckState
* True to check, false to uncheck.
*/
checkItem: function (aNode, aCheckState) {
checkItem: function(aNode, aCheckState) {
const widgetItem = this._itemsByElement.get(aNode);
if (!widgetItem) {
throw new Error("No item for " + aNode);
@ -317,7 +317,7 @@ SideMenuWidget.prototype = {
/**
* Creates and appends a label signaling that this container is empty.
*/
_showEmptyText: function () {
_showEmptyText: function() {
if (this._emptyTextNode || !this._emptyTextValue) {
return;
}
@ -332,7 +332,7 @@ SideMenuWidget.prototype = {
/**
* Removes the label representing a notice in this container.
*/
_removeEmptyText: function () {
_removeEmptyText: function() {
if (!this._emptyTextNode) {
return;
}
@ -350,7 +350,7 @@ SideMenuWidget.prototype = {
* @return SideMenuGroup
* The newly created group.
*/
_getMenuGroupForName: function (aName) {
_getMenuGroupForName: function(aName) {
let cachedGroup = this._groupsByName.get(aName);
if (cachedGroup) {
return cachedGroup;
@ -377,7 +377,7 @@ SideMenuWidget.prototype = {
* @param object aAttachment [optional]
* Some attached primitive/object.
*/
_getMenuItemForGroup: function (aGroup, aContents, aAttachment) {
_getMenuItemForGroup: function(aGroup, aContents, aAttachment) {
return new SideMenuItem(aGroup, aContents, aAttachment, {
showArrow: this._showArrows,
showCheckbox: this._showItemCheckboxes
@ -395,18 +395,17 @@ SideMenuWidget.prototype = {
* @return nsIDOMNode
* The wrapper node if there is one, or the same child otherwise.
*/
_getNodeForContents: function (aChild) {
_getNodeForContents: function(aChild) {
if (aChild.hasAttribute("merged-item-contents")) {
return aChild;
} else {
return aChild.parentNode;
}
return aChild.parentNode;
},
/**
* Shows the contextMenu element.
*/
_showContextMenu: function (e) {
_showContextMenu: function(e) {
if (!this._contextMenu) {
return;
}
@ -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.
@ -511,7 +512,7 @@ SideMenuGroup.prototype = {
* @param number aIndex
* The position in the container intended for this group.
*/
insertSelfAt: function (aIndex) {
insertSelfAt: function(aIndex) {
let ownerList = this.ownerView._list;
let groupsArray = this._orderedGroupElementsArray;
@ -530,7 +531,7 @@ SideMenuGroup.prototype = {
* @return number
* The expected index.
*/
findExpectedIndexForSelf: function (sortPredicate) {
findExpectedIndexForSelf: function(sortPredicate) {
let identifier = this.identifier;
let groupsArray = this._orderedGroupElementsArray;
@ -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.
@ -624,7 +627,7 @@ SideMenuItem.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
insertSelfAt: function (aIndex) {
insertSelfAt: function(aIndex) {
let ownerList = this.ownerView._list;
let menuArray = this._orderedMenuElementsArray;
@ -646,7 +649,7 @@ SideMenuItem.prototype = {
* @param boolean aCheckState
* True to check, false to uncheck.
*/
check: function (aCheckState) {
check: function(aCheckState) {
if (!this._checkbox) {
throw new Error("Cannot check items that do not have checkboxes.");
}

Просмотреть файл

@ -49,7 +49,7 @@ SimpleListWidget.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
insertItemAt: function (aIndex, aContents) {
insertItemAt: function(aIndex, aContents) {
aContents.classList.add("simple-list-widget-item");
let list = this._list;
@ -64,7 +64,7 @@ SimpleListWidget.prototype = {
* @return nsIDOMNode
* The element associated with the displayed item.
*/
getItemAtIndex: function (aIndex) {
getItemAtIndex: function(aIndex) {
return this._list.childNodes[aIndex];
},
@ -74,7 +74,7 @@ SimpleListWidget.prototype = {
* @param nsIDOMNode aChild
* The element associated with the displayed item.
*/
removeChild: function (aChild) {
removeChild: function(aChild) {
this._list.removeChild(aChild);
if (this._selectedItem == aChild) {
@ -85,7 +85,7 @@ SimpleListWidget.prototype = {
/**
* Removes all of the child nodes from this container.
*/
removeAllItems: function () {
removeAllItems: function() {
let list = this._list;
let parent = this._parent;
@ -134,7 +134,7 @@ SimpleListWidget.prototype = {
* @param string aValue
* The desired attribute value.
*/
setAttribute: function (aName, aValue) {
setAttribute: function(aName, aValue) {
this._parent.setAttribute(aName, aValue);
if (aName == "emptyText") {
@ -150,7 +150,7 @@ SimpleListWidget.prototype = {
* @param string aName
* The name of the attribute.
*/
removeAttribute: function (aName) {
removeAttribute: function(aName) {
this._parent.removeAttribute(aName);
if (aName == "emptyText") {
@ -164,7 +164,7 @@ SimpleListWidget.prototype = {
* @param nsIDOMNode aElement
* The element to make visible.
*/
ensureElementIsVisible: function (aElement) {
ensureElementIsVisible: function(aElement) {
if (!aElement) {
return;
}
@ -202,7 +202,7 @@ SimpleListWidget.prototype = {
/**
* Creates and appends a label displayed as this container's header.
*/
_showHeaderText: function () {
_showHeaderText: function() {
if (this._headerTextNode || !this._headerTextValue) {
return;
}
@ -217,7 +217,7 @@ SimpleListWidget.prototype = {
/**
* Creates and appends a label signaling that this container is empty.
*/
_showEmptyText: function () {
_showEmptyText: function() {
if (this._emptyTextNode || !this._emptyTextValue) {
return;
}
@ -232,7 +232,7 @@ SimpleListWidget.prototype = {
/**
* Removes the label signaling that this container is empty.
*/
_removeEmptyText: function () {
_removeEmptyText: function() {
if (!this._emptyTextNode) {
return;
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -14,7 +14,7 @@ var defer = require("devtools/shared/defer");
var {LocalizationHelper, ELLIPSIS} = require("devtools/shared/l10n");
Object.defineProperty(this, "WebConsoleUtils", {
get: function () {
get: function() {
return require("devtools/client/webconsole/utils").Utils;
},
configurable: true,
@ -91,7 +91,7 @@ VariablesViewController.prototype = {
* - getEnvironmentClient: callback for creating an environment client
* - releaseActor: callback for releasing an actor when it's no longer needed
*/
_setClientGetters: function (aOptions) {
_setClientGetters: function(aOptions) {
if (aOptions.getObjectClient) {
this._getObjectClient = aOptions.getObjectClient;
}
@ -115,7 +115,7 @@ VariablesViewController.prototype = {
* - getterOrSetterEvalMacro: callback for creating a getter/setter eval macro
* - simpleValueEvalMacro: callback for creating a simple value eval macro
*/
_setEvaluationMacros: function (aOptions) {
_setEvaluationMacros: function(aOptions) {
if (aOptions.overrideValueEvalMacro) {
this._overrideValueEvalMacro = aOptions.overrideValueEvalMacro;
}
@ -137,7 +137,7 @@ VariablesViewController.prototype = {
* @return Promise
* The promise that will be resolved when the string is retrieved.
*/
_populateFromLongString: function (aTarget, aGrip) {
_populateFromLongString: function(aTarget, aGrip) {
let deferred = defer();
let from = aGrip.initial.length;
@ -167,7 +167,7 @@ VariablesViewController.prototype = {
* @param object aGrip
* The property iterator grip.
*/
_populatePropertySlices: function (aTarget, aGrip) {
_populatePropertySlices: function(aTarget, aGrip) {
if (aGrip.count < MAX_PROPERTY_ITEMS) {
return this._populateFromPropertyIterator(aTarget, aGrip);
}
@ -191,7 +191,7 @@ VariablesViewController.prototype = {
// Query the name of the first and last items for this slice
let deferred = defer();
iterator.names([start, start + count - 1], ({ names }) => {
let label = "[" + names[0] + ELLIPSIS + names[1] + "]";
let label = "[" + names[0] + ELLIPSIS + names[1] + "]";
let item = aTarget.addItem(label, {}, { internalItem: true });
item.showArrow();
this.addExpander(item, sliceGrip);
@ -212,7 +212,7 @@ VariablesViewController.prototype = {
* @param object aGrip
* The property iterator grip.
*/
_populateFromPropertyIterator: function (aTarget, aGrip) {
_populateFromPropertyIterator: function(aTarget, aGrip) {
if (aGrip.count >= MAX_PROPERTY_ITEMS) {
// We already started to split, but there is still too many properties, split again.
return this._populatePropertySlices(aTarget, aGrip);
@ -245,7 +245,7 @@ VariablesViewController.prototype = {
* @param string aQuery [optional]
* The query string used to fetch only a subset of properties
*/
_populateFromObjectWithIterator: function (aTarget, aGrip, aQuery) {
_populateFromObjectWithIterator: function(aTarget, aGrip, aQuery) {
// FF40+ starts exposing `ownPropertyLength` on ObjectActor's grip,
// as well as `enumProperties` request.
let deferred = defer();
@ -294,7 +294,6 @@ VariablesViewController.prototype = {
};
deferred.resolve(this._populatePropertySlices(aTarget, sliceGrip));
});
}
return deferred.promise;
},
@ -307,7 +306,7 @@ VariablesViewController.prototype = {
* @param object aProtype
* The prototype grip.
*/
_populateObjectPrototype: function (aTarget, aPrototype) {
_populateObjectPrototype: function(aTarget, aPrototype) {
// Add the variable's __proto__.
if (aPrototype && aPrototype.type != "null") {
let proto = aTarget.addItem("__proto__", { value: aPrototype });
@ -324,7 +323,7 @@ VariablesViewController.prototype = {
* @param object aGrip
* The grip to use to populate the target.
*/
_populateFromObject: function (aTarget, aGrip) {
_populateFromObject: function(aTarget, aGrip) {
if (aGrip.class === "Proxy") {
this.addExpander(
aTarget.addItem("<target>", { value: aGrip.proxyTarget }, { internalItem: true }),
@ -377,7 +376,7 @@ VariablesViewController.prototype = {
return this._populateProperties(aTarget, aGrip);
},
_populateProperties: function (aTarget, aGrip, aOptions) {
_populateProperties: function(aTarget, aGrip, aOptions) {
let deferred = defer();
let objectClient = this._getObjectClient(aGrip);
@ -440,7 +439,7 @@ VariablesViewController.prototype = {
* @param Scope aScope
* The lexical environment form as specified in the protocol.
*/
_populateWithClosure: function (aTarget, aScope) {
_populateWithClosure: function(aTarget, aScope) {
let objectScopes = [];
let environment = aScope;
let funcScope = aTarget.addItem("<Closure>");
@ -483,7 +482,7 @@ VariablesViewController.prototype = {
* @param object aBindings
* The bindings form as specified in the protocol.
*/
_populateWithEnvironmentBindings: function (aTarget, aBindings) {
_populateWithEnvironmentBindings: function(aTarget, aBindings) {
// Add nodes for every argument in the scope.
aTarget.addItems(aBindings.arguments.reduce((accumulator, arg) => {
let name = Object.getOwnPropertyNames(arg)[0];
@ -506,7 +505,7 @@ VariablesViewController.prototype = {
});
},
_populateFromEntries: function (target, grip) {
_populateFromEntries: function(target, grip) {
let objGrip = grip.obj;
let objectClient = this._getObjectClient(objGrip);
@ -539,7 +538,7 @@ VariablesViewController.prototype = {
* @param any aSource
* The source to use to populate the target.
*/
addExpander: function (aTarget, aSource) {
addExpander: function(aTarget, aSource) {
// Attach evaluation macros as necessary.
if (aTarget.getter || aTarget.setter) {
aTarget.evaluationMacro = this._overrideValueEvalMacro;
@ -595,7 +594,7 @@ VariablesViewController.prototype = {
* @return Promise
* The promise that is resolved once the target has been expanded.
*/
populate: function (aTarget, aSource) {
populate: function(aTarget, aSource) {
// Fetch the variables only once.
if (aTarget._fetched) {
return aTarget._fetched;
@ -681,7 +680,7 @@ VariablesViewController.prototype = {
*
* @return boolean True, if the actor supports enumProperty request
*/
supportsSearch: function () {
supportsSearch: function() {
// FF40+ starts exposing ownPropertyLength on object actor's grip
// as well as enumProperty which allows to query a subset of properties.
return this.objectActor && ("ownPropertyLength" in this.objectActor);
@ -695,7 +694,7 @@ VariablesViewController.prototype = {
* @param string aToken
* The query string
*/
performSearch: function (aScope, aToken) {
performSearch: function(aScope, aToken) {
this._populateFromObjectWithIterator(aScope, this.objectActor, aToken)
.then(() => {
this.view.emit("fetched", "search", aScope);
@ -708,7 +707,7 @@ VariablesViewController.prototype = {
* @param object aActor
* The actor to release.
*/
releaseActor: function (aActor) {
releaseActor: function(aActor) {
if (this._releaseActor) {
this._releaseActor(aActor);
}
@ -721,7 +720,7 @@ VariablesViewController.prototype = {
* @param function aFilter [optional]
* Callback to filter which actors are released.
*/
releaseActors: function (aFilter) {
releaseActors: function(aFilter) {
for (let actor of this._actors) {
if (!aFilter || aFilter(actor)) {
this.releaseActor(actor);
@ -749,7 +748,7 @@ VariablesViewController.prototype = {
* - variable: the created Variable.
* - expanded: the Promise that resolves when the variable expands.
*/
setSingleVariable: function (options, configuration = {}) {
setSingleVariable: function(options, configuration = {}) {
this._setEvaluationMacros(configuration);
this.view.empty();
@ -778,7 +777,6 @@ VariablesViewController.prototype = {
},
};
/**
* Attaches a VariablesViewController to a VariablesView if it doesn't already
* have one.
@ -789,7 +787,7 @@ VariablesViewController.prototype = {
* The options to use in creating the controller.
* @return VariablesViewController
*/
VariablesViewController.attach = function (aView, aOptions) {
VariablesViewController.attach = function(aView, aOptions) {
if (aView.controller) {
return aView.controller;
}
@ -807,7 +805,7 @@ var StackFrameUtils = this.StackFrameUtils = {
* @param object aFrame
* The stack frame to label.
*/
getFrameTitle: function (aFrame) {
getFrameTitle: function(aFrame) {
if (aFrame.type == "call") {
let c = aFrame.callee;
return (c.name || c.userDisplayName || c.displayName || "(anonymous)");
@ -823,7 +821,7 @@ var StackFrameUtils = this.StackFrameUtils = {
* @return string
* The scope's label.
*/
getScopeLabel: function (aEnv) {
getScopeLabel: function(aEnv) {
let name = "";
// Name the outermost scope Global.