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

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

View file

@ -26,8 +26,7 @@ this.DOMHelpers = function DOMHelpers(aWindow) {
}; };
DOMHelpers.prototype = { DOMHelpers.prototype = {
getParentObject: function Helpers_getParentObject(node) getParentObject: function Helpers_getParentObject(node) {
{
let parentNode = node ? node.parentNode : null; let parentNode = node ? node.parentNode : null;
if (!parentNode) { if (!parentNode) {
@ -37,12 +36,13 @@ DOMHelpers.prototype = {
// document type // document type
if (node.defaultView) { if (node.defaultView) {
let embeddingFrame = node.defaultView.frameElement; let embeddingFrame = node.defaultView.frameElement;
if (embeddingFrame) if (embeddingFrame) {
return embeddingFrame.parentNode; return embeddingFrame.parentNode;
}
} }
} }
// a Document object without a parentNode or window // 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) { if (parentNode.nodeType == this.window.Node.DOCUMENT_NODE) {
@ -53,22 +53,23 @@ DOMHelpers.prototype = {
return null; return null;
} }
if (!parentNode.localName) if (!parentNode.localName) {
return null; return null;
}
return parentNode; return parentNode;
}, },
getChildObject: function Helpers_getChildObject(node, index, previousSibling, getChildObject: function Helpers_getChildObject(node, index, previousSibling,
showTextNodesWithWhitespace) showTextNodesWithWhitespace) {
{ if (!node) {
if (!node)
return null; return null;
}
if (node.contentDocument) { if (node.contentDocument) {
// then the node is a frame // then the node is a frame
if (index == 0) { if (index == 0) {
return node.contentDocument.documentElement; // the node's HTMLElement return node.contentDocument.documentElement; // the node's HTMLElement
} }
return null; return null;
} }
@ -78,55 +79,56 @@ DOMHelpers.prototype = {
if (svgDocument) { if (svgDocument) {
// then the node is a frame // then the node is a frame
if (index == 0) { if (index == 0) {
return svgDocument.documentElement; // the node's SVGElement return svgDocument.documentElement; // the node's SVGElement
} }
return null; return null;
} }
} }
let child = null; let child = null;
if (previousSibling) // then we are walking if (previousSibling) // then we are walking
{
child = this.getNextSibling(previousSibling); child = this.getNextSibling(previousSibling);
else } else {
child = this.getFirstChild(node); 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; let SHOW_ALL = nodeFilterConstants.SHOW_ALL;
this.treeWalker = node.ownerDocument.createTreeWalker(node, this.treeWalker = node.ownerDocument.createTreeWalker(node,
SHOW_ALL, null); SHOW_ALL, null);
return this.treeWalker.firstChild(); return this.treeWalker.firstChild();
}, },
getNextSibling: function Helpers_getNextSibling(node) getNextSibling: function Helpers_getNextSibling(node) {
{
let next = this.treeWalker.nextSibling(); let next = this.treeWalker.nextSibling();
if (!next) if (!next) {
delete this.treeWalker; delete this.treeWalker;
}
return next; return next;
}, },
isWhitespaceText: function Helpers_isWhitespaceText(node) isWhitespaceText: function Helpers_isWhitespaceText(node) {
{
return node.nodeType == this.window.Node.TEXT_NODE && return node.nodeType == this.window.Node.TEXT_NODE &&
!/[^\s]/.exec(node.nodeValue); !/[^\s]/.exec(node.nodeValue);
}, },
destroy: function Helpers_destroy() destroy: function Helpers_destroy() {
{
delete this.window; delete this.window;
delete this.treeWalker; delete this.treeWalker;
}, },
@ -144,7 +146,7 @@ DOMHelpers.prototype = {
let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor) let docShell = window.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation) .getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell); .QueryInterface(Ci.nsIDocShell);
let onReady = function (event) { let onReady = function(event) {
if (event.target == window.document) { if (event.target == window.document) {
docShell.chromeEventHandler.removeEventListener("DOMContentLoaded", onReady); docShell.chromeEventHandler.removeEventListener("DOMContentLoaded", onReady);
// If in `callback` the URL of the window is changed and a listener to DOMContentLoaded // If in `callback` the URL of the window is changed and a listener to DOMContentLoaded

View file

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

View file

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

View file

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

View file

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

View file

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

File diff suppressed because it is too large Load diff

View file

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