[Basilisk] Issue MoonchildProductions/UXP#516 - Remove named function syntax from basilisk/components/places.

This commit is contained in:
athenian200 2020-03-06 10:42:08 -06:00 committed by Roy Tam
commit 1cceb703f1
9 changed files with 211 additions and 211 deletions

View file

@ -48,7 +48,7 @@ PlacesTreeView.prototype = {
/**
* This is called once both the result and the tree are set.
*/
_finishInit: function PTV__finishInit() {
_finishInit: function() {
let selection = this.selection;
if (selection)
selection.selectEventsSuppressed = true;
@ -89,7 +89,7 @@ PlacesTreeView.prototype = {
*
* @return true if aContainer is a plain container, false otherwise.
*/
_isPlainContainer: function PTV__isPlainContainer(aContainer) {
_isPlainContainer: function(aContainer) {
// Livemarks are always plain containers.
if (this._controller.hasCachedLivemarkInfo(aContainer))
return true;
@ -204,7 +204,7 @@ PlacesTreeView.prototype = {
* Row number.
* @return [parentNode, parentRow]
*/
_getParentByChildRow: function PTV__getParentByChildRow(aChildRow) {
_getParentByChildRow: function(aChildRow) {
let node = this._getNodeForRow(aChildRow);
let parent = (node === null) ? this._rootNode : node.parent;
@ -219,7 +219,7 @@ PlacesTreeView.prototype = {
/**
* Gets the node at a given row.
*/
_getNodeForRow: function PTV__getNodeForRow(aRow) {
_getNodeForRow: function(aRow) {
if (aRow < 0) {
return null;
}
@ -481,7 +481,7 @@ PlacesTreeView.prototype = {
this._tree.ensureRowIsVisible(scrollToRow);
},
_convertPRTimeToString: function PTV__convertPRTimeToString(aTime) {
_convertPRTimeToString: function(aTime) {
const MS_PER_MINUTE = 60000;
const MS_PER_DAY = 86400000;
let timeMs = aTime / 1000; // PRTime is in microseconds
@ -537,7 +537,7 @@ PlacesTreeView.prototype = {
COLUMN_TYPE_LASTMODIFIED: 7,
COLUMN_TYPE_TAGS: 8,
_getColumnType: function PTV__getColumnType(aColumn) {
_getColumnType: function(aColumn) {
let columnType = aColumn.element.getAttribute("anonid") || aColumn.id;
switch (columnType) {
@ -561,7 +561,7 @@ PlacesTreeView.prototype = {
return this.COLUMN_TYPE_UNKNOWN;
},
_sortTypeToColumnType: function PTV__sortTypeToColumnType(aSortType) {
_sortTypeToColumnType: function(aSortType) {
switch (aSortType) {
case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
return [this.COLUMN_TYPE_TITLE, false];
@ -603,7 +603,7 @@ PlacesTreeView.prototype = {
},
// nsINavHistoryResultObserver
nodeInserted: function PTV_nodeInserted(aParentNode, aNode, aNewIndex) {
nodeInserted: function(aParentNode, aNode, aNewIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result)
return;
@ -677,7 +677,7 @@ PlacesTreeView.prototype = {
* However, we won't do this when sorted by date because dates will never
* change for visits, and date sorting is the only time things are collapsed.
*/
nodeRemoved: function PTV_nodeRemoved(aParentNode, aNode, aOldIndex) {
nodeRemoved: function(aParentNode, aNode, aOldIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result)
return;
@ -776,7 +776,7 @@ PlacesTreeView.prototype = {
}
},
_invalidateCellValue: function PTV__invalidateCellValue(aNode,
_invalidateCellValue: function(aNode,
aColumnType) {
NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result)
@ -803,7 +803,7 @@ PlacesTreeView.prototype = {
}
},
_populateLivemarkContainer: function PTV__populateLivemarkContainer(aNode) {
_populateLivemarkContainer: function(aNode) {
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
.then(aLivemark => {
let placesNode = aNode;
@ -819,20 +819,20 @@ PlacesTreeView.prototype = {
}, Components.utils.reportError);
},
nodeTitleChanged: function PTV_nodeTitleChanged(aNode, aNewTitle) {
nodeTitleChanged: function(aNode, aNewTitle) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
},
nodeURIChanged: function PTV_nodeURIChanged(aNode, aNewURI) {
nodeURIChanged: function(aNode, aNewURI) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI);
},
nodeIconChanged: function PTV_nodeIconChanged(aNode) {
nodeIconChanged: function(aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
},
nodeHistoryDetailsChanged:
function PTV_nodeHistoryDetailsChanged(aNode, aUpdatedVisitDate,
function(aNode, aUpdatedVisitDate,
aUpdatedVisitCount) {
if (aNode.parent && this._controller.hasCachedLivemarkInfo(aNode.parent)) {
// Find the node in the parent.
@ -852,13 +852,13 @@ PlacesTreeView.prototype = {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT);
},
nodeTagsChanged: function PTV_nodeTagsChanged(aNode) {
nodeTagsChanged: function(aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
},
nodeKeywordChanged(aNode, aNewKeyword) {},
nodeAnnotationChanged: function PTV_nodeAnnotationChanged(aNode, aAnno) {
nodeAnnotationChanged: function(aNode, aAnno) {
if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DESCRIPTION);
}
@ -874,17 +874,17 @@ PlacesTreeView.prototype = {
}
},
nodeDateAddedChanged: function PTV_nodeDateAddedChanged(aNode, aNewValue) {
nodeDateAddedChanged: function(aNode, aNewValue) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
},
nodeLastModifiedChanged:
function PTV_nodeLastModifiedChanged(aNode, aNewValue) {
function(aNode, aNewValue) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
},
containerStateChanged:
function PTV_containerStateChanged(aNode, aOldState, aNewState) {
function(aNode, aOldState, aNewState) {
this.invalidateContainer(aNode);
if (PlacesUtils.nodeIsFolder(aNode) ||
@ -915,7 +915,7 @@ PlacesTreeView.prototype = {
}
},
invalidateContainer: function PTV_invalidateContainer(aContainer) {
invalidateContainer: function(aContainer) {
NS_ASSERT(this._result, "Need to have a result to update");
if (!this._tree)
return;
@ -1021,7 +1021,7 @@ PlacesTreeView.prototype = {
},
_columns: [],
_findColumnByType: function PTV__findColumnByType(aColumnType) {
_findColumnByType: function(aColumnType) {
if (this._columns[aColumnType])
return this._columns[aColumnType];
@ -1040,7 +1040,7 @@ PlacesTreeView.prototype = {
return null;
},
sortingChanged: function PTV__sortingChanged(aSortingMode) {
sortingChanged: function(aSortingMode) {
if (!this._tree || !this._result)
return;
@ -1068,7 +1068,7 @@ PlacesTreeView.prototype = {
},
_inBatchMode: false,
batching: function PTV__batching(aToggleMode) {
batching: function(aToggleMode) {
if (this._inBatchMode != aToggleMode) {
this._inBatchMode = this.selection.selectEventsSuppressed = aToggleMode;
if (this._inBatchMode) {
@ -1109,14 +1109,14 @@ PlacesTreeView.prototype = {
return val;
},
nodeForTreeIndex: function PTV_nodeForTreeIndex(aIndex) {
nodeForTreeIndex: function(aIndex) {
if (aIndex > this._rows.length)
throw Cr.NS_ERROR_INVALID_ARG;
return this._getNodeForRow(aIndex);
},
treeIndexForNode: function PTV_treeNodeForIndex(aNode) {
treeIndexForNode: function(aNode) {
// The API allows passing invisible nodes.
try {
return this._getRowForNode(aNode, true);
@ -1140,7 +1140,7 @@ PlacesTreeView.prototype = {
getRowProperties: function() { return ""; },
getCellProperties:
function PTV_getCellProperties(aRow, aColumn) {
function(aRow, aColumn) {
// for anonid-trees, we need to add the column-type manually
var props = "";
let columnType = aColumn.element.getAttribute("anonid");
@ -1221,7 +1221,7 @@ PlacesTreeView.prototype = {
getColumnProperties: function(aColumn) { return ""; },
isContainer: function PTV_isContainer(aRow) {
isContainer: function(aRow) {
// Only leaf nodes aren't listed in the rows array.
let node = this._rows[aRow];
if (node === undefined)
@ -1246,7 +1246,7 @@ PlacesTreeView.prototype = {
return false;
},
isContainerOpen: function PTV_isContainerOpen(aRow) {
isContainerOpen: function(aRow) {
if (this._flatList)
return false;
@ -1254,7 +1254,7 @@ PlacesTreeView.prototype = {
return this._rows[aRow].containerOpen;
},
isContainerEmpty: function PTV_isContainerEmpty(aRow) {
isContainerEmpty: function(aRow) {
if (this._flatList)
return true;
@ -1268,18 +1268,18 @@ PlacesTreeView.prototype = {
return !node.hasChildren;
},
isSeparator: function PTV_isSeparator(aRow) {
isSeparator: function(aRow) {
// All separators are listed in the rows array.
let node = this._rows[aRow];
return node && PlacesUtils.nodeIsSeparator(node);
},
isSorted: function PTV_isSorted() {
isSorted: function() {
return this._result.sortingMode !=
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
},
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) {
canDrop: function(aRow, aOrientation, aDataTransfer) {
if (!this._result)
throw Cr.NS_ERROR_UNEXPECTED;
@ -1291,7 +1291,7 @@ PlacesTreeView.prototype = {
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
},
_getInsertionPoint: function PTV__getInsertionPoint(index, orientation) {
_getInsertionPoint: function(index, orientation) {
let container = this._result.root;
let dropNearItemId = -1;
// When there's no selection, assume the container is the container
@ -1370,7 +1370,7 @@ PlacesTreeView.prototype = {
dropNearItemId);
},
drop: function PTV_drop(aRow, aOrientation, aDataTransfer) {
drop: function(aRow, aOrientation, aDataTransfer) {
// We are responsible for translating the |index| and |orientation|
// parameters into a container id and index within the container,
// since this information is specific to the tree view.
@ -1383,12 +1383,12 @@ PlacesTreeView.prototype = {
PlacesControllerDragHelper.currentDropTarget = null;
},
getParentIndex: function PTV_getParentIndex(aRow) {
getParentIndex: function(aRow) {
let [, parentRow] = this._getParentByChildRow(aRow);
return parentRow;
},
hasNextSibling: function PTV_hasNextSibling(aRow, aAfterIndex) {
hasNextSibling: function(aRow, aAfterIndex) {
if (aRow == this._rows.length - 1) {
// The last row has no sibling.
return false;
@ -1420,7 +1420,7 @@ PlacesTreeView.prototype = {
return this._getNodeForRow(aRow).indentLevel;
},
getImageSrc: function PTV_getImageSrc(aRow, aColumn) {
getImageSrc: function(aRow, aColumn) {
// Only the title column has an image.
if (this._getColumnType(aColumn) != this.COLUMN_TYPE_TITLE)
return "";
@ -1432,7 +1432,7 @@ PlacesTreeView.prototype = {
getProgressMode: function(aRow, aColumn) { },
getCellValue: function(aRow, aColumn) { },
getCellText: function PTV_getCellText(aRow, aColumn) {
getCellText: function(aRow, aColumn) {
let node = this._getNodeForRow(aRow);
switch (this._getColumnType(aColumn)) {
case this.COLUMN_TYPE_TITLE:
@ -1484,7 +1484,7 @@ PlacesTreeView.prototype = {
return "";
},
setTree: function PTV_setTree(aTree) {
setTree: function(aTree) {
// If we are replacing the tree during a batch, there is a concrete risk
// that the treeView goes out of sync, thus it's safer to end the batch now.
// This is a no-op if we are not batching.
@ -1507,7 +1507,7 @@ PlacesTreeView.prototype = {
}
},
toggleOpenState: function PTV_toggleOpenState(aRow) {
toggleOpenState: function(aRow) {
if (!this._result)
throw Cr.NS_ERROR_UNEXPECTED;
@ -1535,7 +1535,7 @@ PlacesTreeView.prototype = {
node.containerOpen = !node.containerOpen;
},
cycleHeader: function PTV_cycleHeader(aColumn) {
cycleHeader: function(aColumn) {
if (!this._result)
throw Cr.NS_ERROR_UNEXPECTED;
@ -1650,7 +1650,7 @@ PlacesTreeView.prototype = {
this._result.sortingMode = newSort;
},
isEditable: function PTV_isEditable(aRow, aColumn) {
isEditable: function(aRow, aColumn) {
// At this point we only support editing the title field.
if (aColumn.index != 0)
return false;
@ -1693,7 +1693,7 @@ PlacesTreeView.prototype = {
return true;
},
setCellText: function PTV_setCellText(aRow, aColumn, aText) {
setCellText: function(aRow, aColumn, aText) {
// We may only get here if the cell is editable.
let node = this._rows[aRow];
if (node.title != aText) {
@ -1707,7 +1707,7 @@ PlacesTreeView.prototype = {
}
},
toggleCutNode: function PTV_toggleCutNode(aNode, aValue) {
toggleCutNode: function(aNode, aValue) {
let currentVal = this._cuttingNodes.has(aNode);
if (currentVal != aValue) {
if (aValue)