[Pale-Moon] Issue MoonchildProductions/UXP#516 - Remove named function syntax from palemoon/components/places.

pull/24/head
athenian200 3 years ago committed by Roy Tam
parent 85de6bf035
commit e6be1fd9c3
  1. 64
      application/palemoon/components/places/PlacesUIUtils.jsm
  2. 46
      application/palemoon/components/places/content/bookmarkProperties.js
  3. 128
      application/palemoon/components/places/content/browserPlacesViews.js
  4. 92
      application/palemoon/components/places/content/controller.js
  5. 72
      application/palemoon/components/places/content/editBookmarkOverlay.js
  6. 4
      application/palemoon/components/places/content/moveBookmarks.js
  7. 104
      application/palemoon/components/places/content/places.js
  8. 8
      application/palemoon/components/places/content/sidebarUtils.js
  9. 108
      application/palemoon/components/places/content/treeView.js

@ -42,11 +42,11 @@ this.PlacesUIUtils = {
* The string spec of the URI
* @returns A URI object for the spec.
*/
createFixedURI: function PUIU_createFixedURI(aSpec) {
createFixedURI: function (aSpec) {
return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
},
getFormattedString: function PUIU_getFormattedString(key, params) {
getFormattedString: function (key, params) {
return bundle.formatStringFromName(key, params, params.length);
},
@ -65,7 +65,7 @@ this.PlacesUIUtils = {
* @see https://developer.mozilla.org/en/Localization_and_Plurals
* @return The localized plural string.
*/
getPluralString: function PUIU_getPluralString(aKey, aNumber, aParams) {
getPluralString: function (aKey, aNumber, aParams) {
let str = PluralForm.get(aNumber, bundle.GetStringFromName(aKey));
// Replace #1 with aParams[0], #2 with aParams[1], and so on.
@ -75,7 +75,7 @@ this.PlacesUIUtils = {
});
},
getString: function PUIU_getString(key) {
getString: function (key) {
return bundle.GetStringFromName(key);
},
@ -103,7 +103,7 @@ this.PlacesUIUtils = {
* @see this._copyableAnnotations for the list of copyable annotations.
*/
_getURIItemCopyTransaction:
function PUIU__getURIItemCopyTransaction(aData, aContainer, aIndex)
function (aData, aContainer, aIndex)
{
let transactions = [];
if (aData.dateAdded) {
@ -257,7 +257,7 @@ this.PlacesUIUtils = {
* @see this._copyableAnnotations for the list of copyable annotations.
*/
_getLivemarkCopyTransaction:
function PUIU__getLivemarkCopyTransaction(aData, aContainer, aIndex)
function (aData, aContainer, aIndex)
{
if (!aData.livemark || !aData.annos) {
throw new Error("node is not a livemark");
@ -291,7 +291,7 @@ this.PlacesUIUtils = {
* @note Maybe this should be removed later, see bug 1072833.
*/
_isLivemark:
function PUIU__isLivemark(aItemId)
function (aItemId)
{
// Since this check may be done on each dragover event, it's worth maintaining
// a cache.
@ -344,7 +344,7 @@ this.PlacesUIUtils = {
* the move/insert.
*/
makeTransaction:
function PUIU_makeTransaction(data, type, container, index, copy)
function (data, type, container, index, copy)
{
switch (data.type) {
case PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER:
@ -399,7 +399,7 @@ this.PlacesUIUtils = {
* @return true if any transaction has been performed, false otherwise.
*/
showBookmarkDialog:
function PUIU_showBookmarkDialog(aInfo, aParentWindow) {
function (aInfo, aParentWindow) {
// Preserve size attributes differently based on the fact the dialog has
// a folder picker or not, since it needs more horizontal space than the
// other controls.
@ -415,7 +415,7 @@ this.PlacesUIUtils = {
return ("performed" in aInfo && aInfo.performed);
},
_getTopBrowserWin: function PUIU__getTopBrowserWin() {
_getTopBrowserWin: function () {
return RecentWindow.getMostRecentBrowserWindow();
},
@ -425,7 +425,7 @@ this.PlacesUIUtils = {
* a DOM node
* @return the closet ancestor places view if exists, null otherwsie.
*/
getViewForNode: function PUIU_getViewForNode(aNode) {
getViewForNode: function (aNode) {
let node = aNode;
// The view for a <menu> of which its associated menupopup is a places
@ -454,7 +454,7 @@ this.PlacesUIUtils = {
* organizer. If this is not called visits will be marked as
* TRANSITION_LINK.
*/
markPageAsTyped: function PUIU_markPageAsTyped(aURL) {
markPageAsTyped: function (aURL) {
PlacesUtils.history.markPageAsTyped(this.createFixedURI(aURL));
},
@ -465,7 +465,7 @@ this.PlacesUIUtils = {
* personal toolbar, and bookmarks from within the places organizer.
* If this is not called visits will be marked as TRANSITION_LINK.
*/
markPageAsFollowedBookmark: function PUIU_markPageAsFollowedBookmark(aURL) {
markPageAsFollowedBookmark: function (aURL) {
PlacesUtils.history.markPageAsFollowedBookmark(this.createFixedURI(aURL));
},
@ -475,7 +475,7 @@ this.PlacesUIUtils = {
* This is actually used to distinguish user-initiated visits in frames
* so automatic visits can be correctly ignored.
*/
markPageAsFollowedLink: function PUIU_markPageAsFollowedLink(aURL) {
markPageAsFollowedLink: function (aURL) {
PlacesUtils.history.markPageAsFollowedLink(this.createFixedURI(aURL));
},
@ -489,7 +489,7 @@ this.PlacesUIUtils = {
* @return true if it's safe to open the node in the browser, false otherwise.
*
*/
checkURLSecurity: function PUIU_checkURLSecurity(aURINode, aWindow) {
checkURLSecurity: function (aURINode, aWindow) {
if (PlacesUtils.nodeIsBookmark(aURINode))
return true;
@ -516,7 +516,7 @@ this.PlacesUIUtils = {
* @returns A description string if a META element was discovered with a
* "description" or "httpequiv" attribute, empty string otherwise.
*/
getDescriptionFromDocument: function PUIU_getDescriptionFromDocument(doc) {
getDescriptionFromDocument: function (doc) {
var metaElements = doc.getElementsByTagName("META");
for (var i = 0; i < metaElements.length; ++i) {
if (metaElements[i].name.toLowerCase() == "description" ||
@ -534,7 +534,7 @@ this.PlacesUIUtils = {
* @returns the description of the given item, or an empty string if it is
* not set.
*/
getItemDescription: function PUIU_getItemDescription(aItemId) {
getItemDescription: function (aItemId) {
if (PlacesUtils.annotations.itemHasAnnotation(aItemId, this.DESCRIPTION_ANNO))
return PlacesUtils.annotations.getItemAnnotation(aItemId, this.DESCRIPTION_ANNO);
return "";
@ -631,7 +631,7 @@ this.PlacesUIUtils = {
* Gives the user a chance to cancel loading lots of tabs at once
*/
_confirmOpenInTabs:
function PUIU__confirmOpenInTabs(numTabsToOpen, aWindow) {
function (numTabsToOpen, aWindow) {
const WARN_ON_OPEN_PREF = "browser.tabs.warnOnOpen";
var reallyOpen = true;
@ -673,7 +673,7 @@ this.PlacesUIUtils = {
/** aItemsToOpen needs to be an array of objects of the form:
* {uri: string, isBookmark: boolean}
*/
_openTabset: function PUIU__openTabset(aItemsToOpen, aEvent, aWindow) {
_openTabset: function (aItemsToOpen, aEvent, aWindow) {
if (!aItemsToOpen.length)
return;
@ -722,7 +722,7 @@ this.PlacesUIUtils = {
},
openLiveMarkNodesInTabs:
function PUIU_openLiveMarkNodesInTabs(aNode, aEvent, aView) {
function (aNode, aEvent, aView) {
let window = aView.ownerWindow;
PlacesUtils.livemarks.getLivemark({id: aNode.itemId})
@ -741,7 +741,7 @@ this.PlacesUIUtils = {
},
openContainerNodeInTabs:
function PUIU_openContainerInTabs(aNode, aEvent, aView) {
function (aNode, aEvent, aView) {
let window = aView.ownerWindow;
let urlsToOpen = PlacesUtils.getURLsForContainerNode(aNode);
@ -750,7 +750,7 @@ this.PlacesUIUtils = {
}
},
openURINodesInTabs: function PUIU_openURINodesInTabs(aNodes, aEvent, aView) {
openURINodesInTabs: function (aNodes, aEvent, aView) {
let window = aView.ownerWindow;
let urlsToOpen = [];
@ -775,7 +775,7 @@ this.PlacesUIUtils = {
* The controller associated with aNode.
*/
openNodeWithEvent:
function PUIU_openNodeWithEvent(aNode, aEvent, aView) {
function (aNode, aEvent, aView) {
let window = aView.ownerWindow;
this._openNodeIn(aNode, window.whereToOpenLink(aEvent, false, true), window);
},
@ -785,12 +785,12 @@ this.PlacesUIUtils = {
* web panel.
* see also openUILinkIn
*/
openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aView, aPrivate) {
openNodeIn: function (aNode, aWhere, aView, aPrivate) {
let window = aView.ownerWindow;
this._openNodeIn(aNode, aWhere, window, aPrivate);
},
_openNodeIn: function PUIU_openNodeIn(aNode, aWhere, aWindow, aPrivate=false) {
_openNodeIn: function (aNode, aWhere, aWindow, aPrivate=false) {
if (aNode && PlacesUtils.nodeIsURI(aNode) &&
this.checkURLSecurity(aNode, aWindow)) {
let isBookmark = PlacesUtils.nodeIsBookmark(aNode);
@ -831,11 +831,11 @@ this.PlacesUIUtils = {
*
* @note this is not supposed be perfect, so use it only for UI purposes.
*/
guessUrlSchemeForUI: function PUIU_guessUrlSchemeForUI(aUrlString) {
guessUrlSchemeForUI: function (aUrlString) {
return aUrlString.substr(0, aUrlString.indexOf(":"));
},
getBestTitle: function PUIU_getBestTitle(aNode, aDoNotCutTitle) {
getBestTitle: function (aNode, aDoNotCutTitle) {
var title;
if (!aNode.title && PlacesUtils.nodeIsURI(aNode)) {
// if node title is empty, try to set the label using host and filename
@ -1016,7 +1016,7 @@ this.PlacesUIUtils = {
// Create a new left pane folder.
var callback = {
// Helper to create an organizer special query.
create_query: function CB_create_query(aQueryName, aParentId, aQueryUrl) {
create_query: function (aQueryName, aParentId, aQueryUrl) {
let itemId = bs.insertBookmark(aParentId,
PlacesUtils._uri(aQueryUrl),
bs.DEFAULT_INDEX,
@ -1033,7 +1033,7 @@ this.PlacesUIUtils = {
},
// Helper to create an organizer special folder.
create_folder: function CB_create_folder(aFolderName, aParentId, aIsRoot) {
create_folder: function (aFolderName, aParentId, aIsRoot) {
// Left Pane Root Folder.
let folderId = bs.createFolder(aParentId,
queries[aFolderName].title,
@ -1057,7 +1057,7 @@ this.PlacesUIUtils = {
return folderId;
},
runBatched: function CB_runBatched(aUserData) {
runBatched: function (aUserData) {
delete PlacesUIUtils.leftPaneQueries;
PlacesUIUtils.leftPaneQueries = { };
@ -1125,7 +1125,7 @@ this.PlacesUIUtils = {
* @param aItemId id of a container
* @returns the name of the query, or empty string if not a left-pane query
*/
getLeftPaneQueryNameFromId: function PUIU_getLeftPaneQueryNameFromId(aItemId) {
getLeftPaneQueryNameFromId: function (aItemId) {
var queryName = "";
// If the let pane hasn't been built, use the annotation service
// directly, to avoid building the left pane too early.
@ -1170,7 +1170,7 @@ this.PlacesUIUtils = {
* @return The URL with the fragment at the end
*/
getImageURLForResolution:
function PUIU_getImageURLForResolution(aWindow, aURL, aWidth, aHeight) {
function (aWindow, aURL, aWidth, aHeight) {
return aURL;
}
};

@ -107,7 +107,7 @@ var BookmarkPropertiesPanel = {
* This method returns the correct label for the dialog's "accept"
* button based on the variant of the dialog.
*/
_getAcceptLabel: function BPP__getAcceptLabel() {
_getAcceptLabel: function () {
if (this._action == ACTION_ADD) {
if (this._URIs.length)
return this._strings.getString("dialogAcceptLabelAddMulti");
@ -127,7 +127,7 @@ var BookmarkPropertiesPanel = {
* This method returns the correct title for the current variant
* of this dialog.
*/
_getDialogTitle: function BPP__getDialogTitle() {
_getDialogTitle: function () {
if (this._action == ACTION_ADD) {
if (this._itemType == BOOKMARK_ITEM)
return this._strings.getString("dialogTitleAddBookmark");
@ -150,7 +150,7 @@ var BookmarkPropertiesPanel = {
/**
* Determines the initial data for the item edited or added by this dialog
*/
_determineItemInfo: function BPP__determineItemInfo() {
_determineItemInfo: function () {
var dialogInfo = window.arguments[0];
this._action = dialogInfo.action == "add" ? ACTION_ADD : ACTION_EDIT;
this._hiddenRows = dialogInfo.hiddenRows ? dialogInfo.hiddenRows : [];
@ -294,7 +294,7 @@ var BookmarkPropertiesPanel = {
*
* @returns a title string
*/
_getURITitleFromHistory: function BPP__getURITitleFromHistory(aURI) {
_getURITitleFromHistory: function (aURI) {
NS_ASSERT(aURI instanceof Ci.nsIURI);
// get the title from History
@ -305,7 +305,7 @@ var BookmarkPropertiesPanel = {
* This method should be called by the onload of the Bookmark Properties
* dialog to initialize the state of the panel.
*/
onDialogLoad: Task.async(function* BPP_onDialogLoad() {
onDialogLoad: Task.async(function* () {
this._determineItemInfo();
document.title = this._getDialogTitle();
@ -390,7 +390,7 @@ var BookmarkPropertiesPanel = {
}),
// nsIDOMEventListener
handleEvent: function BPP_handleEvent(aEvent) {
handleEvent: function (aEvent) {
var target = aEvent.target;
switch (aEvent.type) {
case "input":
@ -413,7 +413,7 @@ var BookmarkPropertiesPanel = {
}
},
_beginBatch: function BPP__beginBatch() {
_beginBatch: function () {
if (this._batching)
return;
@ -421,7 +421,7 @@ var BookmarkPropertiesPanel = {
this._batching = true;
},
_endBatch: function BPP__endBatch() {
_endBatch: function () {
if (!this._batching)
return;
@ -429,13 +429,13 @@ var BookmarkPropertiesPanel = {
this._batching = false;
},
_fillEditProperties: function BPP__fillEditProperties() {
_fillEditProperties: function () {
gEditItemOverlay.initPanel(this._itemId,
{ hiddenRows: this._hiddenRows,
forceReadOnly: this._readOnly });
},
_fillAddProperties: Task.async(function* BPP__fillAddProperties() {
_fillAddProperties: Task.async(function* () {
yield this._createNewItem();
// Edit the new item
gEditItemOverlay.initPanel(this._itemId,
@ -449,7 +449,7 @@ var BookmarkPropertiesPanel = {
}),
// nsISupports
QueryInterface: function BPP_QueryInterface(aIID) {
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsISupports))
return this;
@ -457,11 +457,11 @@ var BookmarkPropertiesPanel = {
throw Cr.NS_NOINTERFACE;
},
_element: function BPP__element(aID) {
_element: function (aID) {
return document.getElementById("editBMPanel_" + aID);
},
onDialogUnload: function BPP_onDialogUnload() {
onDialogUnload: function () {
// gEditItemOverlay does not exist anymore here, so don't rely on it.
this._mutationObserver.disconnect();
delete this._mutationObserver;
@ -478,7 +478,7 @@ var BookmarkPropertiesPanel = {
.removeEventListener("input", this, false);
},
onDialogAccept: function BPP_onDialogAccept() {
onDialogAccept: function () {
// We must blur current focused element to save its changes correctly
document.commandDispatcher.focusedElement.blur();
// The order here is important! We have to uninit the panel first, otherwise
@ -488,7 +488,7 @@ var BookmarkPropertiesPanel = {
window.arguments[0].performed = true;
},
onDialogCancel: function BPP_onDialogCancel() {
onDialogCancel: function () {
// The order here is important! We have to uninit the panel first, otherwise
// changes done as part of Undo may change the panel contents and by
// that force it to commit more transactions.
@ -503,7 +503,7 @@ var BookmarkPropertiesPanel = {
*
* @returns true if the input is valid, false otherwise
*/
_inputIsValid: function BPP__inputIsValid() {
_inputIsValid: function () {
if (this._itemType == BOOKMARK_ITEM &&
!this._containsValidURI("locationField"))
return false;
@ -522,7 +522,7 @@ var BookmarkPropertiesPanel = {
*
* @returns true if the textbox contains a valid URI string, false otherwise
*/
_containsValidURI: function BPP__containsValidURI(aTextboxID) {
_containsValidURI: function (aTextboxID) {
try {
var value = this._element(aTextboxID).value;
if (value) {
@ -540,7 +540,7 @@ var BookmarkPropertiesPanel = {
* The container-identifier and insertion-index are returned separately in
* the form of [containerIdentifier, insertionIndex]
*/
_getInsertionPointDetails: function BPP__getInsertionPointDetails() {
_getInsertionPointDetails: function () {
var containerId = this._defaultInsertionPoint.itemId;
var indexInContainer = this._defaultInsertionPoint.index;
@ -552,7 +552,7 @@ var BookmarkPropertiesPanel = {
* various fields and opening arguments of the dialog.
*/
_getCreateNewBookmarkTransaction:
function BPP__getCreateNewBookmarkTransaction(aContainer, aIndex) {
function (aContainer, aIndex) {
var annotations = [];
var childTransactions = [];
@ -598,7 +598,7 @@ var BookmarkPropertiesPanel = {
* Returns a childItems-transactions array representing the URIList with
* which the dialog has been opened.
*/
_getTransactionsForURIList: function BPP__getTransactionsForURIList() {
_getTransactionsForURIList: function () {
var transactions = [];
for (var i = 0; i < this._URIs.length; ++i) {
var uri = this._URIs[i];
@ -616,7 +616,7 @@ var BookmarkPropertiesPanel = {
* various fields and opening arguments of the dialog.
*/
_getCreateNewFolderTransaction:
function BPP__getCreateNewFolderTransaction(aContainer, aIndex) {
function (aContainer, aIndex) {
var annotations = [];
var childItemsTransactions;
if (this._URIs.length)
@ -635,7 +635,7 @@ var BookmarkPropertiesPanel = {
* the various fields and opening arguments of the dialog.
*/
_getCreateNewLivemarkTransaction:
function BPP__getCreateNewLivemarkTransaction(aContainer, aIndex) {
function (aContainer, aIndex) {
return new PlacesCreateLivemarkTransaction(this._feedURI, this._siteURI,
this._title,
aContainer, aIndex);
@ -644,7 +644,7 @@ var BookmarkPropertiesPanel = {
/**
* Dialog-accept code-path for creating a new item (any type)
*/
_createNewItem: Task.async(function* BPP__getCreateItemTransaction() {
_createNewItem: Task.async(function* () {
var [container, index] = this._getInsertionPointDetails();
var txn;

@ -92,7 +92,7 @@ PlacesViewBase.prototype = {
* @throws if there is no DOM node set for aPlacesNode.
*/
_getDOMNodeForPlacesNode:
function PVB__getDOMNodeForPlacesNode(aPlacesNode) {
function (aPlacesNode) {
let node = this._domNodes.get(aPlacesNode, null);
if (!node) {
throw new Error("No DOM node set for aPlacesNode.\nnode.type: " +
@ -182,17 +182,17 @@ PlacesViewBase.prototype = {
index, orientation, isTag);
},
buildContextMenu: function PVB_buildContextMenu(aPopup) {
buildContextMenu: function (aPopup) {
this._contextMenuShown = aPopup;
window.updateCommands("places");
return this.controller.buildContextMenu(aPopup);
},
destroyContextMenu: function PVB_destroyContextMenu(aPopup) {
destroyContextMenu: function (aPopup) {
this._contextMenuShown = null;
},
_cleanPopup: function PVB_cleanPopup(aPopup, aDelay) {
_cleanPopup: function (aPopup, aDelay) {
// Remove Places nodes from the popup.
let child = aPopup._startMarker;
while (child.nextSibling != aPopup._endMarker) {
@ -215,7 +215,7 @@ PlacesViewBase.prototype = {
}
},
_rebuildPopup: function PVB__rebuildPopup(aPopup) {
_rebuildPopup: function (aPopup) {
let resultNode = aPopup._placesNode;
if (!resultNode.containerOpen)
return;
@ -244,7 +244,7 @@ PlacesViewBase.prototype = {
aPopup._built = true;
},
_removeChild: function PVB__removeChild(aChild) {
_removeChild: function (aChild) {
// If document.popupNode pointed to this child, null it out,
// otherwise controller's command-updating may rely on the removed
// item still being "selected".
@ -255,7 +255,7 @@ PlacesViewBase.prototype = {
},
_setEmptyPopupStatus:
function PVB__setEmptyPopupStatus(aPopup, aEmpty) {
function (aPopup, aEmpty) {
if (!aPopup._emptyMenuitem) {
let label = PlacesUIUtils.getString("bookmarksMenuEmptyFolder");
aPopup._emptyMenuitem = document.createElement("menuitem");
@ -279,7 +279,7 @@ PlacesViewBase.prototype = {
},
_createMenuItemForPlacesNode:
function PVB__createMenuItemForPlacesNode(aPlacesNode) {
function (aPlacesNode) {
this._domNodes.delete(aPlacesNode);
let element;
@ -357,7 +357,7 @@ PlacesViewBase.prototype = {
},
_insertNewItemToPopup:
function PVB__insertNewItemToPopup(aNewChild, aPopup, aBefore) {
function (aNewChild, aPopup, aBefore) {
let element = this._createMenuItemForPlacesNode(aNewChild);
let before = aBefore || aPopup._endMarker;
aPopup.insertBefore(element, before);
@ -365,7 +365,7 @@ PlacesViewBase.prototype = {
},
_setLivemarkSiteURIMenuItem:
function PVB__setLivemarkSiteURIMenuItem(aPopup) {
function (aPopup) {
let livemarkInfo = this.controller.getCachedLivemarkInfo(aPopup._placesNode);
let siteUrl = livemarkInfo && livemarkInfo.siteURI ?
livemarkInfo.siteURI.spec : null;
@ -408,7 +408,7 @@ PlacesViewBase.prototype = {
* The livemark status
*/
_setLivemarkStatusMenuItem:
function PVB_setLivemarkStatusMenuItem(aPopup, aStatus) {
function (aPopup, aStatus) {
let statusMenuitem = aPopup._statusMenuitem;
if (!statusMenuitem) {
// Create the status menuitem and cache it in the popup object.
@ -434,7 +434,7 @@ PlacesViewBase.prototype = {
}
},
toggleCutNode: function PVB_toggleCutNode(aPlacesNode, aValue) {
toggleCutNode: function (aPlacesNode, aValue) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
// We may get the popup for menus, but we need the menu itself.
@ -446,7 +446,7 @@ PlacesViewBase.prototype = {
elt.removeAttribute("cutting");
},
nodeURIChanged: function PVB_nodeURIChanged(aPlacesNode, aURIString) {
nodeURIChanged: function (aPlacesNode, aURIString) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
// Here we need the <menu>.
@ -456,7 +456,7 @@ PlacesViewBase.prototype = {
elt.setAttribute("scheme", PlacesUIUtils.guessUrlSchemeForUI(aURIString));
},
nodeIconChanged: function PVB_nodeIconChanged(aPlacesNode) {
nodeIconChanged: function (aPlacesNode) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
// There's no UI representation for the root node, thus there's nothing to
@ -477,7 +477,7 @@ PlacesViewBase.prototype = {
},
nodeAnnotationChanged:
function PVB_nodeAnnotationChanged(aPlacesNode, aAnno) {
function (aPlacesNode, aAnno) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
// All livemarks have a feedURI, so use it as our indicator of a livemark
@ -504,7 +504,7 @@ PlacesViewBase.prototype = {
},
nodeTitleChanged:
function PVB_nodeTitleChanged(aPlacesNode, aNewTitle) {
function (aPlacesNode, aNewTitle) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
// There's no UI representation for the root node, thus there's
@ -528,7 +528,7 @@ PlacesViewBase.prototype = {
},
nodeRemoved:
function PVB_nodeRemoved(aParentPlacesNode, aPlacesNode, aIndex) {
function (aParentPlacesNode, aPlacesNode, aIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
@ -548,7 +548,7 @@ PlacesViewBase.prototype = {
},
nodeHistoryDetailsChanged:
function PVB_nodeHistoryDetailsChanged(aPlacesNode, aTime, aCount) {
function (aPlacesNode, aTime, aCount) {
if (aPlacesNode.parent &&
this.controller.hasCachedLivemarkInfo(aPlacesNode.parent)) {
// Find the node in the parent.
@ -575,7 +575,7 @@ PlacesViewBase.prototype = {
batching: function() { },
nodeInserted:
function PVB_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
function (aParentPlacesNode, aPlacesNode, aIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
if (!parentElt._built)
return;
@ -588,7 +588,7 @@ PlacesViewBase.prototype = {
},
nodeMoved:
function PBV_nodeMoved(aPlacesNode,
function (aPlacesNode,
aOldParentPlacesNode, aOldIndex,
aNewParentPlacesNode, aNewIndex) {
// Note: the current implementation of moveItem does not actually
@ -617,7 +617,7 @@ PlacesViewBase.prototype = {
},
containerStateChanged:
function PVB_containerStateChanged(aPlacesNode, aOldState, aNewState) {
function (aPlacesNode, aOldState, aNewState) {
if (aNewState == Ci.nsINavHistoryContainerResultNode.STATE_OPENED ||
aNewState == Ci.nsINavHistoryContainerResultNode.STATE_CLOSED) {
this.invalidateContainer(aPlacesNode);
@ -649,7 +649,7 @@ PlacesViewBase.prototype = {
}
},
_populateLivemarkPopup: function PVB__populateLivemarkPopup(aPopup)
_populateLivemarkPopup: function (aPopup)
{
this._setLivemarkSiteURIMenuItem(aPopup);
// Show the loading status only if there are no entries yet.
@ -679,7 +679,7 @@ PlacesViewBase.prototype = {
}, Components.utils.reportError);
},
invalidateContainer: function PVB_invalidateContainer(aPlacesNode) {
invalidateContainer: function (aPlacesNode) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
elt._built = false;
@ -688,7 +688,7 @@ PlacesViewBase.prototype = {
this._rebuildPopup(elt);
},
uninit: function PVB_uninit() {
uninit: function () {
if (this._result) {
this._result.removeObserver(this);
this._resultNode.containerOpen = false;
@ -729,7 +729,7 @@ PlacesViewBase.prototype = {
* @param aPopup
* a Places popup.
*/
_mayAddCommandsItems: function PVB__mayAddCommandsItems(aPopup) {
_mayAddCommandsItems: function (aPopup) {
// The command items are never added to the root popup.
if (aPopup == this._rootElt)
return;
@ -794,7 +794,7 @@ PlacesViewBase.prototype = {
}
},
_ensureMarkers: function PVB__ensureMarkers(aPopup) {
_ensureMarkers: function (aPopup) {
if (aPopup._startMarker)
return;
@ -830,7 +830,7 @@ PlacesViewBase.prototype = {
}
},
_onPopupShowing: function PVB__onPopupShowing(aEvent) {
_onPopupShowing: function (aEvent) {
// Avoid handling popupshowing of inner views.
let popup = aEvent.originalTarget;
@ -854,14 +854,14 @@ PlacesViewBase.prototype = {
},
_addEventListeners:
function PVB__addEventListeners(aObject, aEventNames, aCapturing) {
function (aObject, aEventNames, aCapturing) {
for (let i = 0; i < aEventNames.length; i++) {
aObject.addEventListener(aEventNames[i], this, aCapturing);
}
},
_removeEventListeners:
function PVB__removeEventListeners(aObject, aEventNames, aCapturing) {
function (aObject, aEventNames, aCapturing) {
for (let i = 0; i < aEventNames.length; i++) {
aObject.removeEventListener(aEventNames[i], this, aCapturing);
}
@ -914,7 +914,7 @@ PlacesToolbar.prototype = {
_cbEvents: ["dragstart", "dragover", "dragexit", "dragend", "drop",
"mousemove", "mouseover", "mouseout"],
QueryInterface: function PT_QueryInterface(aIID) {
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsITimerCallback))
return this;
@ -922,7 +922,7 @@ PlacesToolbar.prototype = {
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
},
uninit: function PT_uninit() {
uninit: function () {
this._removeEventListeners(this._viewElt, this._cbEvents, false);
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
true);
@ -936,7 +936,7 @@ PlacesToolbar.prototype = {
_openedMenuButton: null,
_allowPopupShowing: true,
_rebuild: function PT__rebuild() {
_rebuild: function () {
// Clear out references to existing nodes, since they will be removed
// and re-added.
if (this._overFolder.elt)
@ -961,7 +961,7 @@ PlacesToolbar.prototype = {
},
_insertNewItem:
function PT__insertNewItem(aChild, aBefore) {
function (aChild, aBefore) {
this._domNodes.delete(aChild);
let type = aChild.type;
@ -1022,7 +1022,7 @@ PlacesToolbar.prototype = {
},
_updateChevronPopupNodesVisibility:
function PT__updateChevronPopupNodesVisibility() {
function () {
for (let i = 0, node = this._chevronPopup._startMarker.nextSibling;
node != this._chevronPopup._endMarker;
i++, node = node.nextSibling) {
@ -1031,7 +1031,7 @@ PlacesToolbar.prototype = {
},
_onChevronPopupShowing:
function PT__onChevronPopupShowing(aEvent) {
function (aEvent) {
// Handle popupshowing only for the chevron popup, not for nested ones.
if (aEvent.target != this._chevronPopup)
return;
@ -1042,7 +1042,7 @@ PlacesToolbar.prototype = {
this._updateChevronPopupNodesVisibility();
},
handleEvent: function PT_handleEvent(aEvent) {
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "unload":
this.uninit();
@ -1120,7 +1120,7 @@ PlacesToolbar.prototype = {
}
},
updateChevron: function PT_updateChevron() {
updateChevron: function () {
// If the chevron is collapsed there's nothing to update.
if (this._chevron.collapsed)
return;
@ -1133,7 +1133,7 @@ PlacesToolbar.prototype = {
this._updateChevronTimer = this._setTimer(100);
},
_updateChevronTimerCallback: function PT__updateChevronTimerCallback() {
_updateChevronTimerCallback: function () {
let scrollRect = this._rootElt.getBoundingClientRect();
let childOverflowed = false;
for (let i = 0; i < this._rootElt.childNodes.length; i++) {
@ -1155,7 +1155,7 @@ PlacesToolbar.prototype = {
},
nodeInserted:
function PT_nodeInserted(aParentPlacesNode, aPlacesNode, aIndex) {
function (aParentPlacesNode, aPlacesNode, aIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
if (parentElt == this._rootElt) {
let children = this._rootElt.childNodes;
@ -1169,7 +1169,7 @@ PlacesToolbar.prototype = {
},
nodeRemoved:
function PT_nodeRemoved(aParentPlacesNode, aPlacesNode, aIndex) {
function (aParentPlacesNode, aPlacesNode, aIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
@ -1187,7 +1187,7 @@ PlacesToolbar.prototype = {
},
nodeMoved:
function PT_nodeMoved(aPlacesNode,
function (aPlacesNode,
aOldParentPlacesNode, aOldIndex,
aNewParentPlacesNode, aNewIndex) {
let parentElt = this._getDOMNodeForPlacesNode(aNewParentPlacesNode);
@ -1219,7 +1219,7 @@ PlacesToolbar.prototype = {
},
nodeAnnotationChanged:
function PT_nodeAnnotationChanged(aPlacesNode, aAnno) {
function (aPlacesNode, aAnno) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
if (elt == this._rootElt)
return;
@ -1248,7 +1248,7 @@ PlacesToolbar.prototype = {
}
},
nodeTitleChanged: function PT_nodeTitleChanged(aPlacesNode, aNewTitle) {
nodeTitleChanged: function (aPlacesNode, aNewTitle) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
// There's no UI representation for the root node, thus there's
@ -1268,7 +1268,7 @@ PlacesToolbar.prototype = {
}
},
invalidateContainer: function PT_invalidateContainer(aPlacesNode) {
invalidateContainer: function (aPlacesNode) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
if (elt == this._rootElt) {
// Container is the toolbar itself.
@ -1284,7 +1284,7 @@ PlacesToolbar.prototype = {
hoverTime: 350,
closeTimer: null },
_clearOverFolder: function PT__clearOverFolder() {
_clearOverFolder: function () {
// The mouse is no longer dragging over the stored menubutton.
// Close the menubutton, clear out drag styles, and clear all
// timers for opening/closing it.
@ -1312,7 +1312,7 @@ PlacesToolbar.prototype = {
* - beforeIndex: child index to drop before, for the drop indicator.
* - folderElt: the folder to drop into, if applicable.
*/
_getDropPoint: function PT__getDropPoint(aEvent) {
_getDropPoint: function (aEvent) {
let result = this.result;
if (!PlacesUtils.nodeIsFolder(this._resultNode))
return null;
@ -1395,13 +1395,13 @@ PlacesToolbar.prototype = {
return dropPoint;
},
_setTimer: function PT_setTimer(aTime) {
_setTimer: function (aTime) {
let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer);
timer.initWithCallback(this, aTime, timer.TYPE_ONE_SHOT);
return timer;
},
notify: function PT_notify(aTimer) {
notify: function (aTimer) {
if (aTimer == this._updateChevronTimer) {
this._updateChevronTimer = null;
this._updateChevronTimerCallback();
@ -1446,18 +1446,18 @@ PlacesToolbar.prototype = {
}
},
_onMouseOver: function PT__onMouseOver(aEvent) {
_onMouseOver: function (aEvent) {
let button = aEvent.target;
if (button.parentNode == this._rootElt && button._placesNode &&
PlacesUtils.nodeIsURI(button._placesNode))
window.XULBrowserWindow.setOverLink(aEvent.target._placesNode.uri, null);
},
_onMouseOut: function PT__onMouseOut(aEvent) {
_onMouseOut: function (aEvent) {
window.XULBrowserWindow.setOverLink("", null);
},
_cleanupDragDetails: function PT__cleanupDragDetails() {
_cleanupDragDetails: function () {
// Called on dragend and drop.
PlacesControllerDragHelper.currentDropTarget = null;
this._draggedElt = null;
@ -1467,7 +1467,7 @@ PlacesToolbar.prototype = {
this._dropIndicator.collapsed = true;
},
_onDragStart: function PT__onDragStart(aEvent) {
_onDragStart: function (aEvent) {
// Sub menus have their own d&d handlers.
let draggedElt = aEvent.target;
if (draggedElt.parentNode != this._rootElt || !draggedElt._placesNode)
@ -1502,7 +1502,7 @@ PlacesToolbar.prototype = {
aEvent.stopPropagation();
},
_onDragOver: function PT__onDragOver(aEvent) {
_onDragOver: function (aEvent) {
// Cache the dataTransfer
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
let dt = aEvent.dataTransfer;
@ -1578,7 +1578,7 @@ PlacesToolbar.prototype = {
aEvent.stopPropagation();
},
_onDrop: function PT__onDrop(aEvent) {
_onDrop: function (aEvent) {
PlacesControllerDragHelper.currentDropTarget = aEvent.target;
let dropPoint = this._getDropPoint(aEvent);
@ -1591,7 +1591,7 @@ PlacesToolbar.prototype = {
aEvent.stopPropagation();
},
_onDragExit: function PT__onDragExit(aEvent) {
_onDragExit: function (aEvent) {
PlacesControllerDragHelper.currentDropTarget = null;
// Set timer to turn off indicator bar (if we turn it off
@ -1606,11 +1606,11 @@ PlacesToolbar.prototype = {
this._overFolder.closeTimer = this._setTimer(this._overFolder.hoverTime);
},
_onDragEnd: function PT_onDragEnd(aEvent) {
_onDragEnd: function (aEvent) {
this._cleanupDragDetails();
},
_onPopupShowing: function PT__onPopupShowing(aEvent) {
_onPopupShowing: function (aEvent) {
if (!this._allowPopupShowing) {
this._allowPopupShowing = true;
aEvent.preventDefault();
@ -1624,7 +1624,7 @@ PlacesToolbar.prototype = {
PlacesViewBase.prototype._onPopupShowing.apply(this, arguments);
},
_onPopupHidden: function PT__onPopupHidden(aEvent) {
_onPopupHidden: function (aEvent) {
let popup = aEvent.target;
let placesNode = popup._placesNode;
// Avoid handling popuphidden of inner views
@ -1650,7 +1650,7 @@ PlacesToolbar.prototype = {
}
},
_onMouseMove: function PT__onMouseMove(aEvent) {
_onMouseMove: function (aEvent) {
// Used in dragStart to prevent dragging folders when dragging down.
this._cachedMouseMoveEvent = aEvent;
@ -1696,18 +1696,18 @@ function PlacesMenu(aPopupShowingEvent, aPlace) {
PlacesMenu.prototype = {
__proto__: PlacesViewBase.prototype,
QueryInterface: function PM_QueryInterface(aIID) {
QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsIDOMEventListener))
return this;
return PlacesViewBase.prototype.QueryInterface.apply(this, arguments);
},
_removeChild: function PM_removeChild(aChild) {
_removeChild: function (aChild) {
PlacesViewBase.prototype._removeChild.apply(this, arguments);
},
uninit: function PM_uninit() {
uninit: function () {
this._removeEventListeners(this._rootElt, ["popupshowing", "popuphidden"],
true);
this._removeEventListeners(window, ["unload"], false);
@ -1715,7 +1715,7 @@ PlacesMenu.prototype = {
PlacesViewBase.prototype.uninit.apply(this, arguments);
},
handleEvent: function PM_handleEvent(aEvent) {
handleEvent: function (aEvent) {
switch (aEvent.type) {
case "unload":
this.uninit();
@ -1729,7 +1729,7 @@ PlacesMenu.prototype = {
}
},
_onPopupHidden: function PM__onPopupHidden(aEvent) {
_onPopupHidden: function (aEvent) {
// Avoid handling popuphidden of inner views.
let popup = aEvent.originalTarget;
let placesNode = popup._placesNode;

@ -97,15 +97,15 @@ PlacesController.prototype = {
]),
// nsIClipboardOwner
LosingOwnership: function PC_LosingOwnership (aXferable) {
LosingOwnership: function (aXferable) {
this.cutNodes = [];
},
terminate: function PC_terminate() {
terminate: function () {
this._releaseClipboardOwnership();
},
supportsCommand: function PC_supportsCommand(aCommand) {
supportsCommand: function (aCommand) {
// Non-Places specific commands that we also support
switch (aCommand) {
case "cmd_undo":
@ -124,7 +124,7 @@ PlacesController.prototype = {
return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX);
},
isCommandEnabled: function PC_isCommandEnabled(aCommand) {
isCommandEnabled: function (aCommand) {
switch (aCommand) {
case "cmd_undo":
return PlacesUtils.transactionManager.numberOfUndoItems > 0;
@ -199,7 +199,7 @@ PlacesController.prototype = {
}
},
doCommand: function PC_doCommand(aCommand) {
doCommand: function (aCommand) {
switch (aCommand) {
case "cmd_undo":
PlacesUtils.transactionManager.undoTransaction();
@ -291,7 +291,7 @@ PlacesController.prototype = {
}
},
onEvent: function PC_onEvent(eventName) { },
onEvent: function (eventName) { },
/**
@ -328,7 +328,7 @@ PlacesController.prototype = {
/**
* Determines whether or not nodes can be inserted relative to the selection.
*/
_canInsert: function PC__canInsert(isPaste) {
_canInsert: function (isPaste) {
var ip = this._view.insertionPoint;
return ip != null && (isPaste || ip.isTag != true);
},
@ -341,7 +341,7 @@ PlacesController.prototype = {
- clipboard data is of type TEXT_UNICODE and
is a valid URI.
*/
_isClipboardDataPasteable: function PC__isClipboardDataPasteable() {
_isClipboardDataPasteable: function () {
// if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely
// pasteable, with no need to unwrap all the nodes.
@ -401,7 +401,7 @@ PlacesController.prototype = {
* Notes:
* 1) This can be slow, so don't call it anywhere performance critical!
*/
_buildSelectionMetadata: function PC__buildSelectionMetadata() {
_buildSelectionMetadata: function () {
var metadata = [];
var nodes = this._view.selectedNodes;
@ -484,7 +484,7 @@ PlacesController.prototype = {
* @returns true if the conditions (see buildContextMenu) are satisfied
* and the item can be displayed, false otherwise.
*/
_shouldShowMenuItem: function PC__shouldShowMenuItem(aMenuItem, aMetaData) {
_shouldShowMenuItem: function (aMenuItem, aMetaData) {
var selectiontype = aMenuItem.getAttribute("selectiontype");
if (!selectiontype) {
selectiontype = "single|multiple";
@ -577,7 +577,7 @@ PlacesController.prototype = {
* The menupopup to build children into.
* @return true if at least one item is visible, false otherwise.
*/
buildContextMenu: function PC_buildContextMenu(aPopup) {
buildContextMenu: function (aPopup) {
var metadata = this._buildSelectionMetadata();
var ip = this._view.insertionPoint;
var noIp = !ip || ip.isTag;
@ -648,7 +648,7 @@ PlacesController.prototype = {
/**
* Select all links in the current view.
*/
selectAll: function PC_selectAll() {
selectAll: function () {