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

This commit is contained in:
athenian200 2020-02-06 06:51:38 -06:00 • committed by Roy Tam
commit e6be1fd9c3
9 changed files with 313 additions and 313 deletions

View file

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

View file

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

View file

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

View file

@ -97,15 +97,15 @@ PlacesController.prototype = {
]), ]),
// nsIClipboardOwner // nsIClipboardOwner
LosingOwnership: function PC_LosingOwnership (aXferable) { LosingOwnership: function (aXferable) {
this.cutNodes = []; this.cutNodes = [];
}, },
terminate: function PC_terminate() { terminate: function () {
this._releaseClipboardOwnership(); this._releaseClipboardOwnership();
}, },
supportsCommand: function PC_supportsCommand(aCommand) { supportsCommand: function (aCommand) {
// Non-Places specific commands that we also support // Non-Places specific commands that we also support
switch (aCommand) { switch (aCommand) {
case "cmd_undo": case "cmd_undo":
@ -124,7 +124,7 @@ PlacesController.prototype = {
return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX); return (aCommand.substr(0, CMD_PREFIX.length) == CMD_PREFIX);
}, },
isCommandEnabled: function PC_isCommandEnabled(aCommand) { isCommandEnabled: function (aCommand) {
switch (aCommand) { switch (aCommand) {
case "cmd_undo": case "cmd_undo":
return PlacesUtils.transactionManager.numberOfUndoItems > 0; return PlacesUtils.transactionManager.numberOfUndoItems > 0;
@ -199,7 +199,7 @@ PlacesController.prototype = {
} }
}, },
doCommand: function PC_doCommand(aCommand) { doCommand: function (aCommand) {
switch (aCommand) { switch (aCommand) {
case "cmd_undo": case "cmd_undo":
PlacesUtils.transactionManager.undoTransaction(); 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. * 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; var ip = this._view.insertionPoint;
return ip != null && (isPaste || ip.isTag != true); return ip != null && (isPaste || ip.isTag != true);
}, },
@ -341,7 +341,7 @@ PlacesController.prototype = {
- clipboard data is of type TEXT_UNICODE and - clipboard data is of type TEXT_UNICODE and
is a valid URI. is a valid URI.
*/ */
_isClipboardDataPasteable: function PC__isClipboardDataPasteable() { _isClipboardDataPasteable: function () {
// if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely // if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely
// pasteable, with no need to unwrap all the nodes. // pasteable, with no need to unwrap all the nodes.
@ -401,7 +401,7 @@ PlacesController.prototype = {
* Notes: * Notes:
* 1) This can be slow, so don't call it anywhere performance critical! * 1) This can be slow, so don't call it anywhere performance critical!
*/ */
_buildSelectionMetadata: function PC__buildSelectionMetadata() { _buildSelectionMetadata: function () {
var metadata = []; var metadata = [];
var nodes = this._view.selectedNodes; var nodes = this._view.selectedNodes;
@ -484,7 +484,7 @@ PlacesController.prototype = {
* @returns true if the conditions (see buildContextMenu) are satisfied * @returns true if the conditions (see buildContextMenu) are satisfied
* and the item can be displayed, false otherwise. * and the item can be displayed, false otherwise.
*/ */
_shouldShowMenuItem: function PC__shouldShowMenuItem(aMenuItem, aMetaData) { _shouldShowMenuItem: function (aMenuItem, aMetaData) {
var selectiontype = aMenuItem.getAttribute("selectiontype"); var selectiontype = aMenuItem.getAttribute("selectiontype");
if (!selectiontype) { if (!selectiontype) {
selectiontype = "single|multiple"; selectiontype = "single|multiple";
@ -577,7 +577,7 @@ PlacesController.prototype = {
* The menupopup to build children into. * The menupopup to build children into.
* @return true if at least one item is visible, false otherwise. * @return true if at least one item is visible, false otherwise.
*/ */
buildContextMenu: function PC_buildContextMenu(aPopup) { buildContextMenu: function (aPopup) {
var metadata = this._buildSelectionMetadata(); var metadata = this._buildSelectionMetadata();
var ip = this._view.insertionPoint; var ip = this._view.insertionPoint;
var noIp = !ip || ip.isTag; var noIp = !ip || ip.isTag;
@ -648,7 +648,7 @@ PlacesController.prototype = {
/** /**
* Select all links in the current view. * Select all links in the current view.
*/ */
selectAll: function PC_selectAll() { selectAll: function () {
this._view.selectAll(); this._view.selectAll();
}, },
@ -656,7 +656,7 @@ PlacesController.prototype = {
* Opens the bookmark properties for the selected URI Node. * Opens the bookmark properties for the selected URI Node.
*/ */
showBookmarkPropertiesForSelection: showBookmarkPropertiesForSelection:
function PC_showBookmarkPropertiesForSelection() { function () {
var node = this._view.selectedNode; var node = this._view.selectedNode;
if (!node) if (!node)
return; return;
@ -684,7 +684,7 @@ PlacesController.prototype = {
* This method can be run on a URI parameter to ensure that it didn't * This method can be run on a URI parameter to ensure that it didn't
* receive a string instead of an nsIURI object. * receive a string instead of an nsIURI object.
*/ */
_assertURINotString: function PC__assertURINotString(value) { _assertURINotString: function (value) {
NS_ASSERT((typeof(value) == "object") && !(value instanceof String), NS_ASSERT((typeof(value) == "object") && !(value instanceof String),
"This method should be passed a URI as a nsIURI object, not as a string."); "This method should be passed a URI as a nsIURI object, not as a string.");
}, },
@ -692,7 +692,7 @@ PlacesController.prototype = {
/** /**
* Reloads the selected livemark if any. * Reloads the selected livemark if any.
*/ */
reloadSelectedLivemark: function PC_reloadSelectedLivemark() { reloadSelectedLivemark: function () {
var selectedNode = this._view.selectedNode; var selectedNode = this._view.selectedNode;
if (selectedNode) { if (selectedNode) {
let itemId = selectedNode.itemId; let itemId = selectedNode.itemId;
@ -706,7 +706,7 @@ PlacesController.prototype = {
/** /**
* Opens the links in the selected folder, or the selected links in new tabs. * Opens the links in the selected folder, or the selected links in new tabs.
*/ */
openSelectionInTabs: function PC_openLinksInTabs(aEvent) { openSelectionInTabs: function (aEvent) {
var node = this._view.selectedNode; var node = this._view.selectedNode;
var nodes = this._view.selectedNodes; var nodes = this._view.selectedNodes;
// In the case of no selection, open the root node: // In the case of no selection, open the root node:
@ -725,7 +725,7 @@ PlacesController.prototype = {
* @param aType * @param aType
* the type of the new item (bookmark/livemark/folder) * the type of the new item (bookmark/livemark/folder)
*/ */
newItem: function PC_newItem(aType) { newItem: function (aType) {
let ip = this._view.insertionPoint; let ip = this._view.insertionPoint;
if (!ip) if (!ip)
throw Cr.NS_ERROR_NOT_AVAILABLE; throw Cr.NS_ERROR_NOT_AVAILABLE;
@ -747,7 +747,7 @@ PlacesController.prototype = {
/** /**
* Create a new Bookmark separator somewhere. * Create a new Bookmark separator somewhere.
*/ */
newSeparator: function PC_newSeparator() { newSeparator: function () {
var ip = this._view.insertionPoint; var ip = this._view.insertionPoint;
if (!ip) if (!ip)
throw Cr.NS_ERROR_NOT_AVAILABLE; throw Cr.NS_ERROR_NOT_AVAILABLE;
@ -762,7 +762,7 @@ PlacesController.prototype = {
/** /**
* Opens a dialog for moving the selected nodes. * Opens a dialog for moving the selected nodes.
*/ */
moveSelectedBookmarks: function PC_moveBookmarks() { moveSelectedBookmarks: function () {
window.openDialog("chrome://browser/content/places/moveBookmarks.xul", window.openDialog("chrome://browser/content/places/moveBookmarks.xul",
"", "chrome, modal", "", "chrome, modal",
this._view.selectedNodes); this._view.selectedNodes);
@ -771,7 +771,7 @@ PlacesController.prototype = {
/** /**
* Sort the selected folder by name. * Sort the selected folder by name.
*/ */
sortFolderByName: function PC_sortFolderByName() { sortFolderByName: function () {
var itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode); var itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode);
var txn = new PlacesSortFolderByNameTransaction(itemId); var txn = new PlacesSortFolderByNameTransaction(itemId);
PlacesUtils.transactionManager.doTransaction(txn); PlacesUtils.transactionManager.doTransaction(txn);
@ -780,7 +780,7 @@ PlacesController.prototype = {
/** /**
* Open the parent folder for the selected bookmarks search result. * Open the parent folder for the selected bookmarks search result.
*/ */
openParentFolder: function PC_openParentFolder() { openParentFolder: function () {
var view; var view;
if (!document.popupNode) { if (!document.popupNode) {
view = document.commandDispatcher.focusedElement; view = document.commandDispatcher.focusedElement;
@ -796,7 +796,7 @@ PlacesController.prototype = {
this.selectFolderByItemId(view, aFolderItemId, aItemId); this.selectFolderByItemId(view, aFolderItemId, aItemId);
}, },
getParentFolderByItemId: function PC_getParentFolderByItemId(aItemId) { getParentFolderByItemId: function (aItemId) {
var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]. var bmsvc = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"].
getService(Components.interfaces.nsINavBookmarksService); getService(Components.interfaces.nsINavBookmarksService);
var parentFolderId = bmsvc.getFolderIdForItem(aItemId); var parentFolderId = bmsvc.getFolderIdForItem(aItemId);
@ -804,7 +804,7 @@ PlacesController.prototype = {
return parentFolderId; return parentFolderId;
}, },
selectItems2: function PC_selectItems2(view, aIDs) { selectItems2: function (view, aIDs) {
var ids = aIDs; // Don't manipulate the caller's array. var ids = aIDs; // Don't manipulate the caller's array.
// Array of nodes found by findNodes which are to be selected // Array of nodes found by findNodes which are to be selected
@ -904,7 +904,7 @@ PlacesController.prototype = {
selection.selectEventsSuppressed = false; selection.selectEventsSuppressed = false;
}, },
selectFolderByItemId: function PC_selectFolderByItemId(view, aFolderItemId, aItemId) { selectFolderByItemId: function (view, aFolderItemId, aItemId) {
// Library // Library
if (view.getAttribute("id") == "placeContent") { if (view.getAttribute("id") == "placeContent") {
view = document.getElementById("placesList"); view = document.getElementById("placesList");
@ -1062,7 +1062,7 @@ PlacesController.prototype = {
* List of folders the calling function has already traversed * List of folders the calling function has already traversed
* @returns true if the node should be skipped, false otherwise. * @returns true if the node should be skipped, false otherwise.
*/ */
_shouldSkipNode: function PC_shouldSkipNode(node, pastFolders) { _shouldSkipNode: function (node, pastFolders) {
/** /**
* Determines if a node is contained by another node within a resultset. * Determines if a node is contained by another node within a resultset.
* @param node * @param node
@ -1098,7 +1098,7 @@ PlacesController.prototype = {
* @param [optional] removedFolders * @param [optional] removedFolders
* An array of folder nodes that have already been removed. * An array of folder nodes that have already been removed.
*/ */
_removeRange: function PC__removeRange(range, transactions, removedFolders) { _removeRange: function (range, transactions, removedFolders) {
NS_ASSERT(transactions instanceof Array, "Must pass a transactions array"); NS_ASSERT(transactions instanceof Array, "Must pass a transactions array");
if (!removedFolders) if (!removedFolders)
removedFolders = []; removedFolders = [];
@ -1167,7 +1167,7 @@ PlacesController.prototype = {
* @param txnName * @param txnName
* See |remove|. * See |remove|.
*/ */
_removeRowsFromBookmarks: function PC__removeRowsFromBookmarks(txnName) { _removeRowsFromBookmarks: function (txnName) {
var ranges = this._view.removableSelectionRanges; var ranges = this._view.removableSelectionRanges;
var transactions = []; var transactions = [];
var removedFolders = []; var removedFolders = [];
@ -1186,7 +1186,7 @@ PlacesController.prototype = {
* *
* @note history deletes are not undoable. * @note history deletes are not undoable.
*/ */
_removeRowsFromHistory: function PC__removeRowsFromHistory() { _removeRowsFromHistory: function () {
let nodes = this._view.selectedNodes; let nodes = this._view.selectedNodes;
let URIs = []; let URIs = [];
for (let i = 0; i < nodes.length; ++i) { for (let i = 0; i < nodes.length; ++i) {
@ -1229,7 +1229,7 @@ PlacesController.prototype = {
* *
* @note history deletes are not undoable. * @note history deletes are not undoable.
*/ */
_removeHistoryContainer: function PC__removeHistoryContainer(aContainerNode) { _removeHistoryContainer: function (aContainerNode) {
if (PlacesUtils.nodeIsHost(aContainerNode)) { if (PlacesUtils.nodeIsHost(aContainerNode)) {
// Site container. // Site container.
PlacesUtils.bhistory.removePagesFromHost(aContainerNode.title, true); PlacesUtils.bhistory.removePagesFromHost(aContainerNode.title, true);
@ -1255,7 +1255,7 @@ PlacesController.prototype = {
* A name for the transaction if this is being performed * A name for the transaction if this is being performed
* as part of another operation. * as part of another operation.
*/ */
remove: function PC_remove(aTxnName) { remove: function (aTxnName) {
if (!this._hasRemovableSelection()) if (!this._hasRemovableSelection())
return; return;
@ -1284,7 +1284,7 @@ PlacesController.prototype = {
* @param aEvent * @param aEvent
* The dragstart event. * The dragstart event.
*/ */
setDataTransfer: function PC_setDataTransfer(aEvent) { setDataTransfer: function (aEvent) {
let dt = aEvent.dataTransfer; let dt = aEvent.dataTransfer;
let doCopy = ["copyLink", "copy", "link"].indexOf(dt.effectAllowed) != -1; let doCopy = ["copyLink", "copy", "link"].indexOf(dt.effectAllowed) != -1;
@ -1355,14 +1355,14 @@ PlacesController.prototype = {
return action; return action;
}, },
_releaseClipboardOwnership: function PC__releaseClipboardOwnership() { _releaseClipboardOwnership: function () {
if (this.cutNodes.length > 0) { if (this.cutNodes.length > 0) {
// This clears the logical clipboard, doesn't remove data. // This clears the logical clipboard, doesn't remove data.
this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard); this.clipboard.emptyClipboard(Ci.nsIClipboard.kGlobalClipboard);
} }
}, },
_clearClipboard: function PC__clearClipboard() { _clearClipboard: function () {
let xferable = Cc["@mozilla.org/widget/transferable;1"]. let xferable = Cc["@mozilla.org/widget/transferable;1"].
createInstance(Ci.nsITransferable); createInstance(Ci.nsITransferable);
xferable.init(null); xferable.init(null);
@ -1373,7 +1373,7 @@ PlacesController.prototype = {
this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard); this.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard);
}, },
_populateClipboard: function PC__populateClipboard(aNodes, aAction) { _populateClipboard: function (aNodes, aAction) {
// This order is _important_! It controls how this and other applications // This order is _important_! It controls how this and other applications
// select data to be inserted based on type. // select data to be inserted based on type.
let contents = [ let contents = [
@ -1455,7 +1455,7 @@ PlacesController.prototype = {
/** /**
* Copy Bookmarks and Folders to the clipboard * Copy Bookmarks and Folders to the clipboard
*/ */
copy: function PC_copy() { copy: function () {
let result = this._view.result; let result = this._view.result;
let didSuppressNotifications = result.suppressNotifications; let didSuppressNotifications = result.suppressNotifications;
if (!didSuppressNotifications) if (!didSuppressNotifications)
@ -1472,7 +1472,7 @@ PlacesController.prototype = {
/** /**
* Cut Bookmarks and Folders to the clipboard * Cut Bookmarks and Folders to the clipboard
*/ */
cut: function PC_cut() { cut: function () {
let result = this._view.result; let result = this._view.result;
let didSuppressNotifications = result.suppressNotifications; let didSuppressNotifications = result.suppressNotifications;
if (!didSuppressNotifications) if (!didSuppressNotifications)
@ -1490,7 +1490,7 @@ PlacesController.prototype = {
/** /**
* Paste Bookmarks and Folders from the clipboard * Paste Bookmarks and Folders from the clipboard
*/ */
paste: function PC_paste() { paste: function () {
// No reason to proceed if there isn't a valid insertion point. // No reason to proceed if there isn't a valid insertion point.
let ip = this._view.insertionPoint; let ip = this._view.insertionPoint;
if (!ip) if (!ip)
@ -1572,7 +1572,7 @@ PlacesController.prototype = {
* @param aLivemarkInfo * @param aLivemarkInfo
* a mozILivemarkInfo object. * a mozILivemarkInfo object.
*/ */
cacheLivemarkInfo: function PC_cacheLivemarkInfo(aNode, aLivemarkInfo) { cacheLivemarkInfo: function (aNode, aLivemarkInfo) {
this._cachedLivemarkInfoObjects.set(aNode, aLivemarkInfo); this._cachedLivemarkInfoObjects.set(aNode, aLivemarkInfo);
}, },
@ -1583,7 +1583,7 @@ PlacesController.prototype = {
* @return true if there's a cached mozILivemarkInfo object for * @return true if there's a cached mozILivemarkInfo object for
* aNode, false otherwise. * aNode, false otherwise.
*/ */
hasCachedLivemarkInfo: function PC_hasCachedLivemarkInfo(aNode) hasCachedLivemarkInfo: function (aNode)
this._cachedLivemarkInfoObjects.has(aNode), this._cachedLivemarkInfoObjects.has(aNode),
/** /**
@ -1593,7 +1593,7 @@ PlacesController.prototype = {
* a places result node. * a places result node.
* @return the mozILivemarkInfo object for aNode, if set, null otherwise. * @return the mozILivemarkInfo object for aNode, if set, null otherwise.
*/ */
getCachedLivemarkInfo: function PC_getCachedLivemarkInfo(aNode) getCachedLivemarkInfo: function (aNode)
this._cachedLivemarkInfoObjects.get(aNode, null) this._cachedLivemarkInfoObjects.get(aNode, null)
}; };
@ -1618,7 +1618,7 @@ var PlacesControllerDragHelper = {
* @returns true if the user is dragging over a node within the hierarchy of * @returns true if the user is dragging over a node within the hierarchy of
* the container, false otherwise. * the container, false otherwise.
*/ */
draggingOverChildNode: function PCDH_draggingOverChildNode(node) { draggingOverChildNode: function (node) {
let currentNode = this.currentDropTarget; let currentNode = this.currentDropTarget;
while (currentNode) { while (currentNode) {
if (currentNode == node) if (currentNode == node)
@ -1631,7 +1631,7 @@ var PlacesControllerDragHelper = {
/** /**
* @returns The current active drag session. Returns null if there is none. * @returns The current active drag session. Returns null if there is none.
*/ */
getSession: function PCDH__getSession() { getSession: function () {
return this.dragService.getCurrentSession(); return this.dragService.getCurrentSession();
}, },
@ -1640,7 +1640,7 @@ var PlacesControllerDragHelper = {
* @param aFlavors * @param aFlavors
* The flavors list of type nsIDOMDOMStringList. * The flavors list of type nsIDOMDOMStringList.
*/ */
getFirstValidFlavor: function PCDH_getFirstValidFlavor(aFlavors) { getFirstValidFlavor: function (aFlavors) {
for (let i = 0; i < aFlavors.length; i++) { for (let i = 0; i < aFlavors.length; i++) {
if (this.GENERIC_VIEW_DROP_TYPES.indexOf(aFlavors[i]) != -1) if (this.GENERIC_VIEW_DROP_TYPES.indexOf(aFlavors[i]) != -1)
return aFlavors[i]; return aFlavors[i];
@ -1662,7 +1662,7 @@ var PlacesControllerDragHelper = {
* @param ip * @param ip
* The insertion point where the items should be dropped. * The insertion point where the items should be dropped.
*/ */
canDrop: function PCDH_canDrop(ip, dt) { canDrop: function (ip, dt) {
let dropCount = dt.mozItemCount; let dropCount = dt.mozItemCount;
// Check every dragged item. // Check every dragged item.
@ -1724,7 +1724,7 @@ var PlacesControllerDragHelper = {
* @returns True if the node can be moved, false otherwise. * @returns True if the node can be moved, false otherwise.
*/ */
canMoveNode: canMoveNode:
function PCDH_canMoveNode(aNode) { function (aNode) {
// Only bookmark items are movable. // Only bookmark items are movable.
if (aNode.itemId == -1) if (aNode.itemId == -1)
return false; return false;
@ -1743,7 +1743,7 @@ var PlacesControllerDragHelper = {
* @param insertionPoint * @param insertionPoint
* The insertion point where the items should be dropped * The insertion point where the items should be dropped
*/ */
onDrop: function PCDH_onDrop(insertionPoint, dt) { onDrop: function (insertionPoint, dt) {
let doCopy = ["copy", "link"].indexOf(dt.dropEffect) != -1; let doCopy = ["copy", "link"].indexOf(dt.dropEffect) != -1;
let transactions = []; let transactions = [];

View file

@ -42,7 +42,7 @@ var gEditItemOverlay = {
/** /**
* Determines the initial data for the item edited or added by this dialog * Determines the initial data for the item edited or added by this dialog
*/ */
_determineInfo: function EIO__determineInfo(aInfo) { _determineInfo: function (aInfo) {
// hidden rows // hidden rows
if (aInfo && aInfo.hiddenRows) if (aInfo && aInfo.hiddenRows)
this._hiddenRows = aInfo.hiddenRows; this._hiddenRows = aInfo.hiddenRows;
@ -55,7 +55,7 @@ var gEditItemOverlay = {
this._onPanelReady = aInfo && aInfo.onPanelReady; this._onPanelReady = aInfo && aInfo.onPanelReady;
}, },
_showHideRows: function EIO__showHideRows() { _showHideRows: function () {
var isBookmark = this._itemId != -1 && var isBookmark = this._itemId != -1 &&
this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK; this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK;
var isQuery = false; var isQuery = false;
@ -102,7 +102,7 @@ var gEditItemOverlay = {
* * forceReadOnly - set this flag to initialize the panel to its * * forceReadOnly - set this flag to initialize the panel to its
* read-only (view) mode even if the given item is editable. * read-only (view) mode even if the given item is editable.
*/ */
initPanel: function EIO_initPanel(aFor, aInfo) { initPanel: function (aFor, aInfo) {
// For sanity ensure that the implementer has uninited the panel before // For sanity ensure that the implementer has uninited the panel before
// trying to init it again, or we could end up leaking due to observers. // trying to init it again, or we could end up leaking due to observers.
if (this._initialized) if (this._initialized)
@ -266,7 +266,7 @@ var gEditItemOverlay = {
* @return the new menu item. * @return the new menu item.
*/ */
_appendFolderItemToMenupopup: _appendFolderItemToMenupopup:
function EIO__appendFolderItemToMenuList(aMenupopup, aFolderId) { function (aMenupopup, aFolderId) {
// First make sure the folders-separator is visible // First make sure the folders-separator is visible
this._element("foldersSeparator").hidden = false; this._element("foldersSeparator").hidden = false;
@ -279,7 +279,7 @@ var gEditItemOverlay = {
return folderMenuItem; return folderMenuItem;
}, },
_initFolderMenuList: function EIO__initFolderMenuList(aSelectedFolder) { _initFolderMenuList: function (aSelectedFolder) {
// clean up first // clean up first
var menupopup = this._folderMenuList.menupopup; var menupopup = this._folderMenuList.menupopup;
while (menupopup.childNodes.length > 6) while (menupopup.childNodes.length > 6)
@ -345,7 +345,7 @@ var gEditItemOverlay = {
this._folderMenuList.disabled = this._readOnly; this._folderMenuList.disabled = this._readOnly;
}, },
QueryInterface: function EIO_QueryInterface(aIID) { QueryInterface: function (aIID) {
if (aIID.equals(Ci.nsIDOMEventListener) || if (aIID.equals(Ci.nsIDOMEventListener) ||
aIID.equals(Ci.nsINavBookmarkObserver) || aIID.equals(Ci.nsINavBookmarkObserver) ||
aIID.equals(Ci.nsISupports)) aIID.equals(Ci.nsISupports))
@ -354,11 +354,11 @@ var gEditItemOverlay = {
throw Cr.NS_ERROR_NO_INTERFACE; throw Cr.NS_ERROR_NO_INTERFACE;
}, },
_element: function EIO__element(aID) { _element: function (aID) {
return document.getElementById("editBMPanel_" + aID); return document.getElementById("editBMPanel_" + aID);
}, },
_editorTransactionManagerClear: function EIO__editorTransactionManagerClear(aItem) { _editorTransactionManagerClear: function (aItem) {
// Clear the editor's undo stack // Clear the editor's undo stack
let transactionManager; let transactionManager;
try { try {
@ -378,7 +378,7 @@ var gEditItemOverlay = {
} }
}, },
_getItemStaticTitle: function EIO__getItemStaticTitle() { _getItemStaticTitle: function () {
if (this._titleOverride) if (this._titleOverride)
return this._titleOverride; return this._titleOverride;
@ -392,14 +392,14 @@ var gEditItemOverlay = {
return title; return title;
}, },
_initNamePicker: function EIO_initNamePicker() { _initNamePicker: function () {
var namePicker = this._element("namePicker"); var namePicker = this._element("namePicker");
namePicker.value = this._getItemStaticTitle(); namePicker.value = this._getItemStaticTitle();
namePicker.readOnly = this._readOnly; namePicker.readOnly = this._readOnly;
this._editorTransactionManagerClear(namePicker); this._editorTransactionManagerClear(namePicker);
}, },
uninitPanel: function EIO_uninitPanel(aHideCollapsibleElements) { uninitPanel: function (aHideCollapsibleElements) {
if (aHideCollapsibleElements) { if (aHideCollapsibleElements) {
// hide the folder tree if it was previously visible // hide the folder tree if it was previously visible
var folderTreeRow = this._element("folderTreeRow"); var folderTreeRow = this._element("folderTreeRow");
@ -438,18 +438,18 @@ var gEditItemOverlay = {
this._readOnly = false; this._readOnly = false;
}, },
onTagsFieldBlur: function EIO_onTagsFieldBlur() { onTagsFieldBlur: function () {
if (this._updateTags()) // if anything has changed if (this._updateTags()) // if anything has changed
this._mayUpdateFirstEditField("tagsField"); this._mayUpdateFirstEditField("tagsField");
}, },
_updateTags: function EIO__updateTags() { _updateTags: function () {
if (this._multiEdit) if (this._multiEdit)
return this._updateMultipleTagsForItems(); return this._updateMultipleTagsForItems();
return this._updateSingleTagForItem(); return this._updateSingleTagForItem();
}, },
_updateSingleTagForItem: function EIO__updateSingleTagForItem() { _updateSingleTagForItem: function () {
var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri); var currentTags = PlacesUtils.tagging.getTagsForURI(this._uri);
var tags = this._getTagsArrayFromTagField(); var tags = this._getTagsArrayFromTagField();
if (tags.length > 0 || currentTags.length > 0) { if (tags.length > 0 || currentTags.length > 0) {
@ -494,7 +494,7 @@ var gEditItemOverlay = {
* the id of the field that may be set (without the "editBMPanel_" * the id of the field that may be set (without the "editBMPanel_"
* prefix) * prefix)
*/ */
_mayUpdateFirstEditField: function EIO__mayUpdateFirstEditField(aNewField) { _mayUpdateFirstEditField: function (aNewField) {
// * The first-edit-field behavior is not applied in the multi-edit case // * The first-edit-field behavior is not applied in the multi-edit case
// * if this._firstEditedField is already set, this is not the first field, // * if this._firstEditedField is already set, this is not the first field,
// so there's nothing to do // so there's nothing to do
@ -509,7 +509,7 @@ var gEditItemOverlay = {
prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField); prefs.setCharPref("browser.bookmarks.editDialog.firstEditField", aNewField);
}, },
_updateMultipleTagsForItems: function EIO__updateMultipleTagsForItems() { _updateMultipleTagsForItems: function () {
var tags = this._getTagsArrayFromTagField(); var tags = this._getTagsArrayFromTagField();
if (tags.length > 0 || this._allTags.length > 0) { if (tags.length > 0 || this._allTags.length > 0) {
var tagsToRemove = []; var tagsToRemove = [];
@ -562,7 +562,7 @@ var gEditItemOverlay = {
return false; return false;
}, },
onNamePickerBlur: function EIO_onNamePickerBlur() { onNamePickerBlur: function () {
if (this._itemId == -1) if (this._itemId == -1)
return; return;
@ -582,7 +582,7 @@ var gEditItemOverlay = {
} }
}, },
onDescriptionFieldBlur: function EIO_onDescriptionFieldBlur() { onDescriptionFieldBlur: function () {
var description = this._element("descriptionField").value; var description = this._element("descriptionField").value;
if (description != PlacesUIUtils.getItemDescription(this._itemId)) { if (description != PlacesUIUtils.getItemDescription(this._itemId)) {
var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO, var annoObj = { name : PlacesUIUtils.DESCRIPTION_ANNO,
@ -595,7 +595,7 @@ var gEditItemOverlay = {
} }
}, },
onLocationFieldBlur: function EIO_onLocationFieldBlur() { onLocationFieldBlur: function () {
var uri; var uri;
try { try {
uri = PlacesUIUtils.createFixedURI(this._element("locationField").value); uri = PlacesUIUtils.createFixedURI(this._element("locationField").value);
@ -609,7 +609,7 @@ var gEditItemOverlay = {
} }
}, },
onKeywordFieldBlur: function EIO_onKeywordFieldBlur() { onKeywordFieldBlur: function () {
let oldKeyword = this._keyword; let oldKeyword = this._keyword;
let keyword = this._keyword = this._element("keywordField").value; let keyword = this._keyword = this._element("keywordField").value;
if (keyword != oldKeyword) { if (keyword != oldKeyword) {
@ -622,7 +622,7 @@ var gEditItemOverlay = {
}, },
onLoadInSidebarCheckboxCommand: onLoadInSidebarCheckboxCommand:
function EIO_onLoadInSidebarCheckboxCommand() { function () {
let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO }; let annoObj = { name : PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO };
if (this._element("loadInSidebarCheckbox").checked) if (this._element("loadInSidebarCheckbox").checked)
annoObj.value = true; annoObj.value = true;
@ -630,7 +630,7 @@ var gEditItemOverlay = {
PlacesUtils.transactionManager.doTransaction(txn); PlacesUtils.transactionManager.doTransaction(txn);
}, },
toggleFolderTreeVisibility: function EIO_toggleFolderTreeVisibility() { toggleFolderTreeVisibility: function () {
var expander = this._element("foldersExpander"); var expander = this._element("foldersExpander");
var folderTreeRow = this._element("folderTreeRow"); var folderTreeRow = this._element("folderTreeRow");
if (!folderTreeRow.collapsed) { if (!folderTreeRow.collapsed) {
@ -664,7 +664,7 @@ var gEditItemOverlay = {
}, },
_getFolderIdFromMenuList: _getFolderIdFromMenuList:
function EIO__getFolderIdFromMenuList() { function () {
var selectedItem = this._folderMenuList.selectedItem; var selectedItem = this._folderMenuList.selectedItem;
NS_ASSERT("folderId" in selectedItem, NS_ASSERT("folderId" in selectedItem,
"Invalid menuitem in the folders-menulist"); "Invalid menuitem in the folders-menulist");
@ -680,7 +680,7 @@ var gEditItemOverlay = {
* The identifier of the bookmarks folder. * The identifier of the bookmarks folder.
*/ */
_getFolderMenuItem: _getFolderMenuItem:
function EIO__getFolderMenuItem(aFolderId) { function (aFolderId) {
var menupopup = this._folderMenuList.menupopup; var menupopup = this._folderMenuList.menupopup;
for (let i = 0; i < menupopup.childNodes.length; i++) { for (let i = 0; i < menupopup.childNodes.length; i++) {
@ -696,7 +696,7 @@ var gEditItemOverlay = {
return this._appendFolderItemToMenupopup(menupopup, aFolderId); return this._appendFolderItemToMenupopup(menupopup, aFolderId);
}, },
onFolderMenuListCommand: function EIO_onFolderMenuListCommand(aEvent) { onFolderMenuListCommand: function (aEvent) {
// Set a selectedIndex attribute to show special icons // Set a selectedIndex attribute to show special icons
this._folderMenuList.setAttribute("selectedIndex", this._folderMenuList.setAttribute("selectedIndex",
this._folderMenuList.selectedIndex); this._folderMenuList.selectedIndex);
@ -739,7 +739,7 @@ var gEditItemOverlay = {
} }
}, },
onFolderTreeSelect: function EIO_onFolderTreeSelect() { onFolderTreeSelect: function () {
var selectedNode = this._folderTree.selectedNode; var selectedNode = this._folderTree.selectedNode;
// Disable the "New Folder" button if we cannot create a new folder // Disable the "New Folder" button if we cannot create a new folder
@ -759,7 +759,7 @@ var gEditItemOverlay = {
}, },
_markFolderAsRecentlyUsed: _markFolderAsRecentlyUsed:
function EIO__markFolderAsRecentlyUsed(aFolderId) { function (aFolderId) {
var txns = []; var txns = [];
// Expire old unused recent folders // Expire old unused recent folders
@ -789,7 +789,7 @@ var gEditItemOverlay = {
* with the transaction manager. * with the transaction manager.
*/ */
_getLastUsedAnnotationObject: _getLastUsedAnnotationObject:
function EIO__getLastUsedAnnotationObject(aLastUsed) { function (aLastUsed) {
var anno = { name: LAST_USED_ANNO, var anno = { name: LAST_USED_ANNO,
type: Ci.nsIAnnotationService.TYPE_INT32, type: Ci.nsIAnnotationService.TYPE_INT32,
flags: 0, flags: 0,
@ -799,7 +799,7 @@ var gEditItemOverlay = {
return anno; return anno;
}, },
_rebuildTagsSelectorList: function EIO__rebuildTagsSelectorList() { _rebuildTagsSelectorList: function () {
var tagsSelector = this._element("tagsSelector"); var tagsSelector = this._element("tagsSelector");
var tagsSelectorRow = this._element("tagsSelectorRow"); var tagsSelectorRow = this._element("tagsSelectorRow");
if (tagsSelectorRow.collapsed) if (tagsSelectorRow.collapsed)
@ -842,7 +842,7 @@ var gEditItemOverlay = {
} }
}, },
toggleTagsSelector: function EIO_toggleTagsSelector() { toggleTagsSelector: function () {
var tagsSelector = this._element("tagsSelector"); var tagsSelector = this._element("tagsSelector");
var tagsSelectorRow = this._element("tagsSelectorRow"); var tagsSelectorRow = this._element("tagsSelectorRow");
var expander = this._element("tagsSelectorExpander"); var expander = this._element("tagsSelectorExpander");
@ -869,14 +869,14 @@ var gEditItemOverlay = {
* *
* @return Array of tag strings found in the field value. * @return Array of tag strings found in the field value.
*/ */
_getTagsArrayFromTagField: function EIO__getTagsArrayFromTagField() { _getTagsArrayFromTagField: function () {
let tags = this._element("tagsField").value; let tags = this._element("tagsField").value;
return tags.trim() return tags.trim()
.split(/\s*,\s*/) // Split on commas and remove spaces. .split(/\s*,\s*/) // Split on commas and remove spaces.
.filter(function (tag) tag.length > 0); // Kill empty tags. .filter(function (tag) tag.length > 0); // Kill empty tags.
}, },
newFolder: function EIO_newFolder() { newFolder: function () {
var ip = this._folderTree.insertionPoint; var ip = this._folderTree.insertionPoint;
// default to the bookmarks menu folder // default to the bookmarks menu folder
@ -897,7 +897,7 @@ var gEditItemOverlay = {
}, },
// nsIDOMEventListener // nsIDOMEventListener
handleEvent: function EIO_nsIDOMEventListener(aEvent) { handleEvent: function (aEvent) {
switch (aEvent.type) { switch (aEvent.type) {
case "CheckboxStateChange": case "CheckboxStateChange":
// Update the tags field when items are checked/unchecked in the listbox // Update the tags field when items are checked/unchecked in the listbox
@ -927,7 +927,7 @@ var gEditItemOverlay = {
}, },
// nsINavBookmarkObserver // nsINavBookmarkObserver
onItemChanged: function EIO_onItemChanged(aItemId, aProperty, onItemChanged: function (aItemId, aProperty,
aIsAnnotationProperty, aValue, aIsAnnotationProperty, aValue,
aLastModified, aItemType) { aLastModified, aItemType) {
if (aProperty == "tags") { if (aProperty == "tags") {
@ -1038,7 +1038,7 @@ var gEditItemOverlay = {
} }
}, },
onItemMoved: function EIO_onItemMoved(aItemId, aOldParent, aOldIndex, onItemMoved: function (aItemId, aOldParent, aOldIndex,
aNewParent, aNewIndex, aItemType) { aNewParent, aNewIndex, aItemType) {
if (aItemId != this._itemId || if (aItemId != this._itemId ||
aNewParent == this._getFolderIdFromMenuList()) aNewParent == this._getFolderIdFromMenuList())
@ -1051,7 +1051,7 @@ var gEditItemOverlay = {
this._folderMenuList.selectedItem = folderItem; this._folderMenuList.selectedItem = folderItem;
}, },
onItemAdded: function EIO_onItemAdded(aItemId, aParentId, aIndex, aItemType, onItemAdded: function (aItemId, aParentId, aIndex, aItemType,
aURI) { aURI) {
this._lastNewItem = aItemId; this._lastNewItem = aItemId;
}, },

View file

@ -22,7 +22,7 @@ var gMoveBookmarksDialog = {
PlacesUIUtils.allBookmarksFolderId; PlacesUIUtils.allBookmarksFolderId;
}, },
onOK: function MBD_onOK(aEvent) { onOK: function (aEvent) {
var selectedNode = this.foldersTree.selectedNode; var selectedNode = this.foldersTree.selectedNode;
NS_ASSERT(selectedNode, NS_ASSERT(selectedNode,
"selectedNode must be set in a single-selection tree with initial selection set"); "selectedNode must be set in a single-selection tree with initial selection set");
@ -46,7 +46,7 @@ var gMoveBookmarksDialog = {
} }
}, },
newFolder: function MBD_newFolder() { newFolder: function () {
// The command is disabled when the tree is not focused // The command is disabled when the tree is not focused
this.foldersTree.focus(); this.foldersTree.focus();
goDoCommand("placesCmd_new:folder"); goDoCommand("placesCmd_new:folder");

View file

@ -30,7 +30,7 @@ var PlacesOrganizer = {
this._places.place = "place:excludeItems=1&expandQueries=0&folder=" + leftPaneRoot; this._places.place = "place:excludeItems=1&expandQueries=0&folder=" + leftPaneRoot;
}, },
selectLeftPaneQuery: function PO_selectLeftPaneQuery(aQueryName) { selectLeftPaneQuery: function (aQueryName) {
var itemId = PlacesUIUtils.leftPaneQueries[aQueryName]; var itemId = PlacesUIUtils.leftPaneQueries[aQueryName];
this._places.selectItems([itemId]); this._places.selectItems([itemId]);
// Forcefully expand all-bookmarks // Forcefully expand all-bookmarks
@ -38,7 +38,7 @@ var PlacesOrganizer = {
PlacesUtils.asContainer(this._places.selectedNode).containerOpen = true; PlacesUtils.asContainer(this._places.selectedNode).containerOpen = true;
}, },
init: function PO_init() { init: function () {
ContentArea.init(); ContentArea.init();
this._places = document.getElementById("placesList"); this._places = document.getElementById("placesList");
@ -91,7 +91,7 @@ var PlacesOrganizer = {
ContentArea.focus(); ContentArea.focus();
}, },
QueryInterface: function PO_QueryInterface(aIID) { QueryInterface: function (aIID) {
if (aIID.equals(Components.interfaces.nsIDOMEventListener) || if (aIID.equals(Components.interfaces.nsIDOMEventListener) ||
aIID.equals(Components.interfaces.nsISupports)) aIID.equals(Components.interfaces.nsISupports))
return this; return this;
@ -99,7 +99,7 @@ var PlacesOrganizer = {
throw new Components.Exception("", Components.results.NS_NOINTERFACE); throw new Components.Exception("", Components.results.NS_NOINTERFACE);
}, },
handleEvent: function PO_handleEvent(aEvent) { handleEvent: function (aEvent) {
if (aEvent.type != "AppCommand") if (aEvent.type != "AppCommand")
return; return;
@ -119,7 +119,7 @@ var PlacesOrganizer = {
} }
}, },
destroy: function PO_destroy() { destroy: function () {
}, },
_location: null, _location: null,
@ -161,13 +161,13 @@ var PlacesOrganizer = {
_backHistory: [], _backHistory: [],
_forwardHistory: [], _forwardHistory: [],
back: function PO_back() { back: function () {
this._forwardHistory.unshift(this.location); this._forwardHistory.unshift(this.location);
var historyEntry = this._backHistory.shift(); var historyEntry = this._backHistory.shift();
this._location = null; this._location = null;
this.location = historyEntry; this.location = historyEntry;
}, },
forward: function PO_forward() { forward: function () {
this._backHistory.unshift(this.location); this._backHistory.unshift(this.location);
var historyEntry = this._forwardHistory.shift(); var historyEntry = this._forwardHistory.shift();
this._location = null; this._location = null;
@ -185,7 +185,7 @@ var PlacesOrganizer = {
* deleting its text, this will be false. * deleting its text, this will be false.
*/ */
_cachedLeftPaneSelectedURI: null, _cachedLeftPaneSelectedURI: null,
onPlaceSelected: function PO_onPlaceSelected(resetSearchBox) { onPlaceSelected: function (resetSearchBox) {
// Don't change the right-hand pane contents when there's no selection. // Don't change the right-hand pane contents when there's no selection.
if (!this._places.hasSelection) if (!this._places.hasSelection)
return; return;
@ -243,7 +243,7 @@ var PlacesOrganizer = {
* @param aNode * @param aNode
* the node to set up scope from * the node to set up scope from
*/ */
_setSearchScopeForNode: function PO__setScopeForNode(aNode) { _setSearchScopeForNode: function (aNode) {
let itemId = aNode.itemId; let itemId = aNode.itemId;
// Set default buttons status. // Set default buttons status.
@ -279,7 +279,7 @@ var PlacesOrganizer = {
* @param aEvent * @param aEvent
* The mouse event. * The mouse event.
*/ */
onPlacesListClick: function PO_onPlacesListClick(aEvent) { onPlacesListClick: function (aEvent) {
// Only handle clicks on tree children. // Only handle clicks on tree children.
if (aEvent.target.localName != "treechildren") if (aEvent.target.localName != "treechildren")
return; return;
@ -299,7 +299,7 @@ var PlacesOrganizer = {
/** /**
* Handle focus changes on the places list and the current content view. * Handle focus changes on the places list and the current content view.
*/ */
updateDetailsPane: function PO_updateDetailsPane() { updateDetailsPane: function () {
if (!ContentArea.currentViewOptions.showDetailsPane) if (!ContentArea.currentViewOptions.showDetailsPane)
return; return;
let view = PlacesUIUtils.getViewForNode(document.activeElement); let view = PlacesUIUtils.getViewForNode(document.activeElement);
@ -310,7 +310,7 @@ var PlacesOrganizer = {
} }
}, },
openFlatContainer: function PO_openFlatContainerFlatContainer(aContainer) { openFlatContainer: function (aContainer) {
if (aContainer.itemId != -1) if (aContainer.itemId != -1)
this._places.selectItems([aContainer.itemId]); this._places.selectItems([aContainer.itemId]);
else if (PlacesUtils.nodeIsQuery(aContainer)) else if (PlacesUtils.nodeIsQuery(aContainer))
@ -321,7 +321,7 @@ var PlacesOrganizer = {
* Returns the options associated with the query currently loaded in the * Returns the options associated with the query currently loaded in the
* main places pane. * main places pane.
*/ */
getCurrentOptions: function PO_getCurrentOptions() { getCurrentOptions: function () {
return PlacesUtils.asQuery(ContentArea.currentView.result.root).queryOptions; return PlacesUtils.asQuery(ContentArea.currentView.result.root).queryOptions;
}, },
@ -329,14 +329,14 @@ var PlacesOrganizer = {
* Returns the queries associated with the query currently loaded in the * Returns the queries associated with the query currently loaded in the
* main places pane. * main places pane.
*/ */
getCurrentQueries: function PO_getCurrentQueries() { getCurrentQueries: function () {
return PlacesUtils.asQuery(ContentArea.currentView.result.root).getQueries(); return PlacesUtils.asQuery(ContentArea.currentView.result.root).getQueries();
}, },
/** /**
* Open a file-picker and import the selected file into the bookmarks store * Open a file-picker and import the selected file into the bookmarks store
*/ */
importFromFile: function PO_importFromFile() { importFromFile: function () {
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) { let fpCallback = function fpCallback_done(aResult) {
if (aResult != Ci.nsIFilePicker.returnCancel && fp.fileURL) { if (aResult != Ci.nsIFilePicker.returnCancel && fp.fileURL) {
@ -355,7 +355,7 @@ var PlacesOrganizer = {
/** /**
* Allows simple exporting of bookmarks. * Allows simple exporting of bookmarks.
*/ */
exportBookmarks: function PO_exportBookmarks() { exportBookmarks: function () {
let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker); let fp = Cc["@mozilla.org/filepicker;1"].createInstance(Ci.nsIFilePicker);
let fpCallback = function fpCallback_done(aResult) { let fpCallback = function fpCallback_done(aResult) {
if (aResult != Ci.nsIFilePicker.returnCancel) { if (aResult != Ci.nsIFilePicker.returnCancel) {
@ -375,7 +375,7 @@ var PlacesOrganizer = {
/** /**
* Populates the restore menu with the dates of the backups available. * Populates the restore menu with the dates of the backups available.
*/ */
populateRestoreMenu: function PO_populateRestoreMenu() { populateRestoreMenu: function () {
let restorePopup = document.getElementById("fileRestorePopup"); let restorePopup = document.getElementById("fileRestorePopup");
let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"]. let dateSvc = Cc["@mozilla.org/intl/scriptabledateformat;1"].
@ -432,7 +432,7 @@ var PlacesOrganizer = {
/** /**
* Called when a menuitem is selected from the restore menu. * Called when a menuitem is selected from the restore menu.
*/ */
onRestoreMenuItemClick: function PO_onRestoreMenuItemClick(aMenuItem) { onRestoreMenuItemClick: function (aMenuItem) {
Task.spawn(function() { Task.spawn(function() {
let backupName = aMenuItem.getAttribute("value"); let backupName = aMenuItem.getAttribute("value");
let backupFilePaths = yield PlacesBackups.getBackupFiles(); let backupFilePaths = yield PlacesBackups.getBackupFiles();
@ -449,7 +449,7 @@ var PlacesOrganizer = {
* Called when 'Choose File...' is selected from the restore menu. * Called when 'Choose File...' is selected from the restore menu.
* Prompts for a file and restores bookmarks to those in the file. * Prompts for a file and restores bookmarks to those in the file.
*/ */
onRestoreBookmarksFromFile: function PO_onRestoreBookmarksFromFile() { onRestoreBookmarksFromFile: function () {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties); getService(Ci.nsIProperties);
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile); let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
@ -472,7 +472,7 @@ var PlacesOrganizer = {
/** /**
* Restores bookmarks from a JSON file. * Restores bookmarks from a JSON file.
*/ */
restoreBookmarksFromFile: function PO_restoreBookmarksFromFile(aFile) { restoreBookmarksFromFile: function (aFile) {
// check file extension // check file extension
let filePath = aFile.path; let filePath = aFile.path;
if (!filePath.toLowerCase().endsWith("json") && if (!filePath.toLowerCase().endsWith("json") &&
@ -498,7 +498,7 @@ var PlacesOrganizer = {
}); });
}, },
_showErrorAlert: function PO__showErrorAlert(aMsg) { _showErrorAlert: function (aMsg) {
var brandShortName = document.getElementById("brandStrings"). var brandShortName = document.getElementById("brandStrings").
getString("brandShortName"); getString("brandShortName");
@ -512,7 +512,7 @@ var PlacesOrganizer = {
* The file is a JSON serialization of bookmarks, tags and any annotations * The file is a JSON serialization of bookmarks, tags and any annotations
* of those items. * of those items.
*/ */
backupBookmarks: function PO_backupBookmarks() { backupBookmarks: function () {
let dirSvc = Cc["@mozilla.org/file/directory_service;1"]. let dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Ci.nsIProperties); getService(Ci.nsIProperties);
let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile); let backupsDir = dirSvc.get("Desk", Ci.nsILocalFile);
@ -534,7 +534,7 @@ var PlacesOrganizer = {
_paneDisabled: false, _paneDisabled: false,
_setDetailsFieldsDisabledState: _setDetailsFieldsDisabledState:
function PO__setDetailsFieldsDisabledState(aDisabled) { function (aDisabled) {
if (aDisabled) { if (aDisabled) {
document.getElementById("paneElementsBroadcaster") document.getElementById("paneElementsBroadcaster")
.setAttribute("disabled", "true"); .setAttribute("disabled", "true");
@ -546,7 +546,7 @@ var PlacesOrganizer = {
}, },
_detectAndSetDetailsPaneMinimalState: _detectAndSetDetailsPaneMinimalState:
function PO__detectAndSetDetailsPaneMinimalState(aNode) { function (aNode) {
/** /**
* The details of simple folder-items (as opposed to livemarks) or the * The details of simple folder-items (as opposed to livemarks) or the
* of livemark-children are not likely to fill the infoBox anyway, * of livemark-children are not likely to fill the infoBox anyway,
@ -583,7 +583,7 @@ var PlacesOrganizer = {
}, },
// NOT YET USED // NOT YET USED
updateThumbnailProportions: function PO_updateThumbnailProportions() { updateThumbnailProportions: function () {
var previewBox = document.getElementById("previewBox"); var previewBox = document.getElementById("previewBox");
var canvas = document.getElementById("itemThumbnail"); var canvas = document.getElementById("itemThumbnail");
var height = previewBox.boxObject.height; var height = previewBox.boxObject.height;
@ -592,7 +592,7 @@ var PlacesOrganizer = {
canvas.height = height; canvas.height = height;
}, },
_fillDetailsPane: function PO__fillDetailsPane(aNodeList) { _fillDetailsPane: function (aNodeList) {
var infoBox = document.getElementById("infoBox"); var infoBox = document.getElementById("infoBox");
var detailsDeck = document.getElementById("detailsDeck"); var detailsDeck = document.getElementById("detailsDeck");
@ -716,7 +716,7 @@ var PlacesOrganizer = {
}, },
// NOT YET USED // NOT YET USED
_updateThumbnail: function PO__updateThumbnail() { _updateThumbnail: function () {
var bo = document.getElementById("previewBox").boxObject; var bo = document.getElementById("previewBox").boxObject;
var width = bo.width; var width = bo.width;
var height = bo.height; var height = bo.height;
@ -737,7 +737,7 @@ var PlacesOrganizer = {
ctx.restore(); ctx.restore();
}, },
toggleAdditionalInfoFields: function PO_toggleAdditionalInfoFields() { toggleAdditionalInfoFields: function () {
var infoBox = document.getElementById("infoBox"); var infoBox = document.getElementById("infoBox");
var infoBoxExpander = document.getElementById("infoBoxExpander"); var infoBoxExpander = document.getElementById("infoBoxExpander");
var infoBoxExpanderLabel = document.getElementById("infoBoxExpanderLabel"); var infoBoxExpanderLabel = document.getElementById("infoBoxExpanderLabel");
@ -762,7 +762,7 @@ var PlacesOrganizer = {
/** /**
* Save the current search (or advanced query) to the bookmarks root. * Save the current search (or advanced query) to the bookmarks root.
*/ */
saveSearch: function PO_saveSearch() { saveSearch: function () {
// Get the place: uri for the query. // Get the place: uri for the query.
// If the advanced query builder is showing, use that. // If the advanced query builder is showing, use that.
var options = this.getCurrentOptions(); var options = this.getCurrentOptions();
@ -840,7 +840,7 @@ var PlacesSearchBox = {
* @param filterString * @param filterString
* The text to search for. * The text to search for.
*/ */
search: function PSB_search(filterString) { search: function (filterString) {
var PO = PlacesOrganizer; var PO = PlacesOrganizer;
// If the user empties the search box manually, reset it and load all // If the user empties the search box manually, reset it and load all
// contents of the current scope. // contents of the current scope.
@ -909,7 +909,7 @@ var PlacesSearchBox = {
/** /**
* Finds across all history, downloads or all bookmarks. * Finds across all history, downloads or all bookmarks.
*/ */
findAll: function PSB_findAll() { findAll: function () {
switch (this.filterCollection) { switch (this.filterCollection) {
case "history": case "history":
PlacesQueryBuilder.setScope("history"); PlacesQueryBuilder.setScope("history");
@ -929,7 +929,7 @@ var PlacesSearchBox = {
* @param aTitle * @param aTitle
* The title of the current collection. * The title of the current collection.
*/ */
updateCollectionTitle: function PSB_updateCollectionTitle(aTitle) { updateCollectionTitle: function (aTitle) {
let title = ""; let title = "";
// This is needed when a user performs a folder-specific search // This is needed when a user performs a folder-specific search
// using the scope bar, removes the search-string, and unfocuses // using the scope bar, removes the search-string, and unfocuses
@ -978,14 +978,14 @@ var PlacesSearchBox = {
/** /**
* Focus the search box * Focus the search box
*/ */
focus: function PSB_focus() { focus: function () {
this.searchFilter.focus(); this.searchFilter.focus();
}, },
/** /**
* Set up the gray text in the search bar as the Places View loads. * Set up the gray text in the search bar as the Places View loads.
*/ */
init: function PSB_init() { init: function () {
this.updateCollectionTitle(); this.updateCollectionTitle();
}, },
@ -999,13 +999,13 @@ var PlacesSearchBox = {
return this.searchFilter.value = value; return this.searchFilter.value = value;
}, },
showSearchUI: function PSB_showSearchUI() { showSearchUI: function () {
// Hide the advanced search controls when the user hasn't searched // Hide the advanced search controls when the user hasn't searched
var searchModifiers = document.getElementById("searchModifiers"); var searchModifiers = document.getElementById("searchModifiers");
searchModifiers.hidden = false; searchModifiers.hidden = false;
}, },
hideSearchUI: function PSB_hideSearchUI() { hideSearchUI: function () {
var searchModifiers = document.getElementById("searchModifiers"); var searchModifiers = document.getElementById("searchModifiers");
searchModifiers.hidden = true; searchModifiers.hidden = true;
} }
@ -1024,7 +1024,7 @@ var PlacesQueryBuilder = {
* @param aButton * @param aButton
* the scope button that was selected * the scope button that was selected
*/ */
onScopeSelected: function PQB_onScopeSelected(aButton) { onScopeSelected: function (aButton) {
switch (aButton.id) { switch (aButton.id) {
case "scopeBarHistory": case "scopeBarHistory":
this.setScope("history"); this.setScope("history");
@ -1054,7 +1054,7 @@ var PlacesQueryBuilder = {
* The search scope: "bookmarks", "collection", "downloads" or * The search scope: "bookmarks", "collection", "downloads" or
* "history". * "history".
*/ */
setScope: function PQB_setScope(aScope) { setScope: function (aScope) {
// Determine filterCollection, folders, and scopeButtonId based on aScope. // Determine filterCollection, folders, and scopeButtonId based on aScope.
var filterCollection; var filterCollection;
var folders = []; var folders = [];
@ -1130,7 +1130,7 @@ var ViewMenu = {
* @returns The element for the caller to insert new items before, * @returns The element for the caller to insert new items before,
* null if the caller should just append to the popup. * null if the caller should just append to the popup.
*/ */
_clean: function VM__clean(popup, startID, endID) { _clean: function (popup, startID, endID) {
if (endID) if (endID)
NS_ASSERT(startID, "meaningless to have valid endID and null startID"); NS_ASSERT(startID, "meaningless to have valid endID and null startID");
if (startID) { if (startID) {
@ -1179,7 +1179,7 @@ var ViewMenu = {
* If propertyPrefix is null, the column label is used as label and * If propertyPrefix is null, the column label is used as label and
* no accesskey is assigned. * no accesskey is assigned.
*/ */
fillWithColumns: function VM_fillWithColumns(event, startID, endID, type, propertyPrefix) { fillWithColumns: function (event, startID, endID, type, propertyPrefix) {
var popup = event.target; var popup = event.target;
var pivot = this._clean(popup, startID, endID); var pivot = this._clean(popup, startID, endID);
@ -1242,7 +1242,7 @@ var ViewMenu = {
/** /**
* Set up the content of the view menu. * Set up the content of the view menu.
*/ */
populateSortMenu: function VM_populateSortMenu(event) { populateSortMenu: function (event) {
this.fillWithColumns(event, "viewUnsorted", "directionSeparator", "radio", "view.sortBy."); this.fillWithColumns(event, "viewUnsorted", "directionSeparator", "radio", "view.sortBy.");
var sortColumn = this._getSortColumn(); var sortColumn = this._getSortColumn();
@ -1273,7 +1273,7 @@ var ViewMenu = {
* @param element * @param element
* The menuitem element for the column * The menuitem element for the column
*/ */
showHideColumn: function VM_showHideColumn(element) { showHideColumn: function (element) {
var column = element.column; var column = element.column;
var splitter = column.nextSibling; var splitter = column.nextSibling;
@ -1296,7 +1296,7 @@ var ViewMenu = {
* Gets the last column that was sorted. * Gets the last column that was sorted.
* @returns the currently sorted column, null if there is no sorted column. * @returns the currently sorted column, null if there is no sorted column.
*/ */
_getSortColumn: function VM__getSortColumn() { _getSortColumn: function () {
var content = document.getElementById("placeContent"); var content = document.getElementById("placeContent");
var cols = content.columns; var cols = content.columns;
for (var i = 0; i < cols.count; ++i) { for (var i = 0; i < cols.count; ++i) {
@ -1319,7 +1319,7 @@ var ViewMenu = {
* *
* If both aColumnID and aDirection are null, the view will be unsorted. * If both aColumnID and aDirection are null, the view will be unsorted.
*/ */
setSortColumn: function VM_setSortColumn(aColumn, aDirection) { setSortColumn: function (aColumn, aDirection) {
var result = document.getElementById("placeContent").result; var result = document.getElementById("placeContent").result;
if (!aColumn && !aDirection) { if (!aColumn && !aDirection) {
result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE; result.sortingMode = Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
@ -1380,7 +1380,7 @@ var ViewMenu = {
var ContentArea = { var ContentArea = {
_specialViews: new Map(), _specialViews: new Map(),
init: function CA_init() { init: function () {
this._deck = document.getElementById("placesViewsDeck"); this._deck = document.getElementById("placesViewsDeck");
this._toolbar = document.getElementById("placesToolbar"); this._toolbar = document.getElementById("placesToolbar");
ContentTree.init(); ContentTree.init();
@ -1397,7 +1397,7 @@ var ContentArea = {
* @return the view to be used for loading aQueryString. * @return the view to be used for loading aQueryString.
*/ */
getContentViewForQueryString: getContentViewForQueryString:
function CA_getContentViewForQueryString(aQueryString) { function (aQueryString) {
try { try {
if (this._specialViews.has(aQueryString)) { if (this._specialViews.has(aQueryString)) {
let { view, options } = this._specialViews.get(aQueryString); let { view, options } = this._specialViews.get(aQueryString);
@ -1427,7 +1427,7 @@ var ContentArea = {
* @see ContentTree.viewOptions for supported options and default values. * @see ContentTree.viewOptions for supported options and default values.
*/ */
setContentViewForQueryString: setContentViewForQueryString:
function CA_setContentViewForQueryString(aQueryString, aView, aOptions) { function (aQueryString, aView, aOptions) {
if (!aQueryString || if (!aQueryString ||
typeof aView != "object" && typeof aView != "function") typeof aView != "object" && typeof aView != "function")
throw new Components.Exception("Invalid arguments", throw new Components.Exception("Invalid arguments",
@ -1468,7 +1468,7 @@ var ContentArea = {
/** /**
* Applies view options. * Applies view options.
*/ */
_setupView: function CA__setupView() { _setupView: function () {
let options = this.currentViewOptions; let options = this.currentViewOptions;
// showDetailsPane. // showDetailsPane.
@ -1512,7 +1512,7 @@ var ContentArea = {
}; };
var ContentTree = { var ContentTree = {
init: function CT_init() { init: function () {
this._view = document.getElementById("placeContent"); this._view = document.getElementById("placeContent");
}, },
@ -1523,12 +1523,12 @@ var ContentTree = {
toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter" toolbarSet: "back-button, forward-button, organizeButton, viewMenu, maintenanceButton, libraryToolbarSpacer, searchFilter"
}), }),
openSelectedNode: function CT_openSelectedNode(aEvent) { openSelectedNode: function (aEvent) {
let view = this.view; let view = this.view;
PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view); PlacesUIUtils.openNodeWithEvent(view.selectedNode, aEvent, view);
}, },
onClick: function CT_onClick(aEvent) { onClick: function (aEvent) {
let node = this.view.selectedNode; let node = this.view.selectedNode;
if (node) { if (node) {
let doubleClick = aEvent.button == 0 && aEvent.detail == 2; let doubleClick = aEvent.button == 0 && aEvent.detail == 2;
@ -1546,7 +1546,7 @@ var ContentTree = {
} }
}, },
onKeyPress: function CT_onKeyPress(aEvent) { onKeyPress: function (aEvent) {
if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN) if (aEvent.keyCode == KeyEvent.DOM_VK_RETURN)
this.openSelectedNode(aEvent); this.openSelectedNode(aEvent);
} }

View file

@ -4,7 +4,7 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/. # file, You can obtain one at http://mozilla.org/MPL/2.0/.
var SidebarUtils = { var SidebarUtils = {
handleTreeClick: function SU_handleTreeClick(aTree, aEvent, aGutterSelect) { handleTreeClick: function (aTree, aEvent, aGutterSelect) {
// right-clicks are not handled here // right-clicks are not handled here
if (aEvent.button == 2) if (aEvent.button == 2)
return; return;
@ -61,7 +61,7 @@ var SidebarUtils = {
} }
}, },
handleTreeKeyPress: function SU_handleTreeKeyPress(aEvent) { handleTreeKeyPress: function (aEvent) {
// XXX Bug 627901: Post Fx4, this method should take a tree parameter. // XXX Bug 627901: Post Fx4, this method should take a tree parameter.
let tree = aEvent.target; let tree = aEvent.target;
let node = tree.selectedNode; let node = tree.selectedNode;
@ -75,7 +75,7 @@ var SidebarUtils = {
* The following function displays the URL of a node that is being * The following function displays the URL of a node that is being
* hovered over. * hovered over.
*/ */
handleTreeMouseMove: function SU_handleTreeMouseMove(aEvent) { handleTreeMouseMove: function (aEvent) {
if (aEvent.target.localName != "treechildren") if (aEvent.target.localName != "treechildren")
return; return;
@ -97,7 +97,7 @@ var SidebarUtils = {
this.setMouseoverURL(""); this.setMouseoverURL("");
}, },
setMouseoverURL: function SU_setMouseoverURL(aURL) { setMouseoverURL: function (aURL) {
// When the browser window is closed with an open sidebar, the sidebar // When the browser window is closed with an open sidebar, the sidebar
// unload event happens after the browser's one. In this case // unload event happens after the browser's one. In this case
// top.XULBrowserWindow has been nullified already. // top.XULBrowserWindow has been nullified already.

View file

@ -47,7 +47,7 @@ PlacesTreeView.prototype = {
/** /**
* This is called once both the result and the tree are set. * This is called once both the result and the tree are set.
*/ */
_finishInit: function PTV__finishInit() { _finishInit: function () {
let selection = this.selection; let selection = this.selection;
if (selection) if (selection)
selection.selectEventsSuppressed = true; selection.selectEventsSuppressed = true;
@ -88,7 +88,7 @@ PlacesTreeView.prototype = {
* *
* @return true if aContainer is a plain container, false otherwise. * @return true if aContainer is a plain container, false otherwise.
*/ */
_isPlainContainer: function PTV__isPlainContainer(aContainer) { _isPlainContainer: function (aContainer) {
// Livemarks are always plain containers. // Livemarks are always plain containers.
if (this._controller.hasCachedLivemarkInfo(aContainer)) if (this._controller.hasCachedLivemarkInfo(aContainer))
return true; return true;
@ -137,7 +137,7 @@ PlacesTreeView.prototype = {
* otherwise. * otherwise.
*/ */
_getRowForNode: _getRowForNode:
function PTV__getRowForNode(aNode, aForceBuild, aParentRow, aNodeIndex) { function (aNode, aForceBuild, aParentRow, aNodeIndex) {
if (aNode == this._rootNode) if (aNode == this._rootNode)
throw new Error("The root node is never visible"); throw new Error("The root node is never visible");
@ -206,7 +206,7 @@ PlacesTreeView.prototype = {
* Row number. * Row number.
* @return [parentNode, parentRow] * @return [parentNode, parentRow]
*/ */
_getParentByChildRow: function PTV__getParentByChildRow(aChildRow) { _getParentByChildRow: function (aChildRow) {
let node = this._getNodeForRow(aChildRow); let node = this._getNodeForRow(aChildRow);
let parent = (node === null) ? this._rootNode : node.parent; let parent = (node === null) ? this._rootNode : node.parent;
@ -221,7 +221,7 @@ PlacesTreeView.prototype = {
/** /**
* Gets the node at a given row. * Gets the node at a given row.
*/ */
_getNodeForRow: function PTV__getNodeForRow(aRow) { _getNodeForRow: function (aRow) {
if (aRow < 0) { if (aRow < 0) {
return null; return null;
} }
@ -267,7 +267,7 @@ PlacesTreeView.prototype = {
* @return the number of rows which were inserted. * @return the number of rows which were inserted.
*/ */
_buildVisibleSection: _buildVisibleSection:
function PTV__buildVisibleSection(aContainer, aFirstChildRow, aToOpen) function (aContainer, aFirstChildRow, aToOpen)
{ {
// There's nothing to do if the container is closed. // There's nothing to do if the container is closed.
if (!aContainer.containerOpen) if (!aContainer.containerOpen)
@ -333,7 +333,7 @@ PlacesTreeView.prototype = {
* will count the node itself plus any child node following it. * will count the node itself plus any child node following it.
*/ */
_countVisibleRowsForNodeAtRow: _countVisibleRowsForNodeAtRow:
function PTV__countVisibleRowsForNodeAtRow(aNodeRow) { function (aNodeRow) {
let node = this._rows[aNodeRow]; let node = this._rows[aNodeRow];
// If it's not listed yet, we know that it's a leaf node (instanceof also // If it's not listed yet, we know that it's a leaf node (instanceof also
@ -353,7 +353,7 @@ PlacesTreeView.prototype = {
}, },
_getSelectedNodesInRange: _getSelectedNodesInRange:
function PTV__getSelectedNodesInRange(aFirstRow, aLastRow) { function (aFirstRow, aLastRow) {
let selection = this.selection; let selection = this.selection;
let rc = selection.getRangeCount(); let rc = selection.getRangeCount();
if (rc == 0) if (rc == 0)
@ -404,7 +404,7 @@ PlacesTreeView.prototype = {
* found, -1 otherwise. * found, -1 otherwise.
*/ */
_getNewRowForRemovedNode: _getNewRowForRemovedNode:
function PTV__getNewRowForRemovedNode(aUpdatedContainer, aOldNode) { function (aUpdatedContainer, aOldNode) {
if (aOldNode == undefined) { if (aOldNode == undefined) {
return -1; return -1;
} }
@ -449,7 +449,7 @@ PlacesTreeView.prototype = {
* The container which was updated. * The container which was updated.
*/ */
_restoreSelection: _restoreSelection:
function PTV__restoreSelection(aNodesInfo, aUpdatedContainer) { function (aNodesInfo, aUpdatedContainer) {
if (aNodesInfo.length == 0) if (aNodesInfo.length == 0)
return; return;
@ -485,7 +485,7 @@ PlacesTreeView.prototype = {
this._tree.ensureRowIsVisible(scrollToRow); this._tree.ensureRowIsVisible(scrollToRow);
}, },
_convertPRTimeToString: function PTV__convertPRTimeToString(aTime) { _convertPRTimeToString: function (aTime) {
const MS_PER_MINUTE = 60000; const MS_PER_MINUTE = 60000;
const MS_PER_DAY = 86400000; const MS_PER_DAY = 86400000;
let timeMs = aTime / 1000; // PRTime is in microseconds let timeMs = aTime / 1000; // PRTime is in microseconds
@ -524,7 +524,7 @@ PlacesTreeView.prototype = {
COLUMN_TYPE_PARENTFOLDER: 10, COLUMN_TYPE_PARENTFOLDER: 10,
COLUMN_TYPE_PARENTFOLDERPATH: 11, COLUMN_TYPE_PARENTFOLDERPATH: 11,
_getColumnType: function PTV__getColumnType(aColumn) { _getColumnType: function (aColumn) {
let columnType = aColumn.element.getAttribute("anonid") || aColumn.id; let columnType = aColumn.element.getAttribute("anonid") || aColumn.id;
switch (columnType) { switch (columnType) {
@ -554,7 +554,7 @@ PlacesTreeView.prototype = {
return this.COLUMN_TYPE_UNKNOWN; return this.COLUMN_TYPE_UNKNOWN;
}, },
_sortTypeToColumnType: function PTV__sortTypeToColumnType(aSortType) { _sortTypeToColumnType: function (aSortType) {
switch (aSortType) { switch (aSortType) {
case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING: case Ci.nsINavHistoryQueryOptions.SORT_BY_TITLE_ASCENDING:
return [this.COLUMN_TYPE_TITLE, false]; return [this.COLUMN_TYPE_TITLE, false];
@ -600,7 +600,7 @@ PlacesTreeView.prototype = {
}, },
// nsINavHistoryResultObserver // nsINavHistoryResultObserver
nodeInserted: function PTV_nodeInserted(aParentNode, aNode, aNewIndex) { nodeInserted: function (aParentNode, aNode, aNewIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!"); NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result) if (!this._tree || !this._result)
return; return;
@ -674,7 +674,7 @@ PlacesTreeView.prototype = {
* However, we won't do this when sorted by date because dates will never * 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. * 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!"); NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result) if (!this._tree || !this._result)
return; return;
@ -727,7 +727,7 @@ PlacesTreeView.prototype = {
}, },
nodeMoved: nodeMoved:
function PTV_nodeMoved(aNode, aOldParent, aOldIndex, aNewParent, aNewIndex) { function (aNode, aOldParent, aOldIndex, aNewParent, aNewIndex) {
NS_ASSERT(this._result, "Got a notification but have no result!"); NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result) if (!this._tree || !this._result)
return; return;
@ -773,7 +773,7 @@ PlacesTreeView.prototype = {
} }
}, },
_invalidateCellValue: function PTV__invalidateCellValue(aNode, _invalidateCellValue: function (aNode,
aColumnType) { aColumnType) {
NS_ASSERT(this._result, "Got a notification but have no result!"); NS_ASSERT(this._result, "Got a notification but have no result!");
if (!this._tree || !this._result) if (!this._tree || !this._result)
@ -800,7 +800,7 @@ PlacesTreeView.prototype = {
} }
}, },
_populateLivemarkContainer: function PTV__populateLivemarkContainer(aNode) { _populateLivemarkContainer: function (aNode) {
PlacesUtils.livemarks.getLivemark({ id: aNode.itemId }) PlacesUtils.livemarks.getLivemark({ id: aNode.itemId })
.then(aLivemark => { .then(aLivemark => {
let placesNode = aNode; let placesNode = aNode;
@ -816,20 +816,20 @@ PlacesTreeView.prototype = {
}, Components.utils.reportError); }, Components.utils.reportError);
}, },
nodeTitleChanged: function PTV_nodeTitleChanged(aNode, aNewTitle) { nodeTitleChanged: function (aNode, aNewTitle) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE); this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
}, },
nodeURIChanged: function PTV_nodeURIChanged(aNode, aNewURI) { nodeURIChanged: function (aNode, aNewURI) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI); this._invalidateCellValue(aNode, this.COLUMN_TYPE_URI);
}, },
nodeIconChanged: function PTV_nodeIconChanged(aNode) { nodeIconChanged: function (aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE); this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
}, },
nodeHistoryDetailsChanged: nodeHistoryDetailsChanged:
function PTV_nodeHistoryDetailsChanged(aNode, aUpdatedVisitDate, function (aNode, aUpdatedVisitDate,
aUpdatedVisitCount) { aUpdatedVisitCount) {
if (aNode.parent && this._controller.hasCachedLivemarkInfo(aNode.parent)) { if (aNode.parent && this._controller.hasCachedLivemarkInfo(aNode.parent)) {
// Find the node in the parent. // Find the node in the parent.
@ -849,15 +849,15 @@ PlacesTreeView.prototype = {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT); this._invalidateCellValue(aNode, this.COLUMN_TYPE_VISITCOUNT);
}, },
nodeTagsChanged: function PTV_nodeTagsChanged(aNode) { nodeTagsChanged: function (aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS); this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
}, },
nodeKeywordChanged: function PTV_nodeKeywordChanged(aNode, aNewKeyword) { nodeKeywordChanged: function (aNode, aNewKeyword) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_KEYWORD); this._invalidateCellValue(aNode, this.COLUMN_TYPE_KEYWORD);
}, },
nodeAnnotationChanged: function PTV_nodeAnnotationChanged(aNode, aAnno) { nodeAnnotationChanged: function (aNode, aAnno) {
if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO) { if (aAnno == PlacesUIUtils.DESCRIPTION_ANNO) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DESCRIPTION); this._invalidateCellValue(aNode, this.COLUMN_TYPE_DESCRIPTION);
} }
@ -873,17 +873,17 @@ PlacesTreeView.prototype = {
} }
}, },
nodeDateAddedChanged: function PTV_nodeDateAddedChanged(aNode, aNewValue) { nodeDateAddedChanged: function (aNode, aNewValue) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED); this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
}, },
nodeLastModifiedChanged: nodeLastModifiedChanged:
function PTV_nodeLastModifiedChanged(aNode, aNewValue) { function (aNode, aNewValue) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED); this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
}, },
containerStateChanged: containerStateChanged:
function PTV_containerStateChanged(aNode, aOldState, aNewState) { function (aNode, aOldState, aNewState) {
this.invalidateContainer(aNode); this.invalidateContainer(aNode);
if (PlacesUtils.nodeIsFolder(aNode) || if (PlacesUtils.nodeIsFolder(aNode) ||
@ -914,7 +914,7 @@ PlacesTreeView.prototype = {
} }
}, },
invalidateContainer: function PTV_invalidateContainer(aContainer) { invalidateContainer: function (aContainer) {
NS_ASSERT(this._result, "Need to have a result to update"); NS_ASSERT(this._result, "Need to have a result to update");
if (!this._tree) if (!this._tree)
return; return;
@ -1020,7 +1020,7 @@ PlacesTreeView.prototype = {
}, },
_columns: [], _columns: [],
_findColumnByType: function PTV__findColumnByType(aColumnType) { _findColumnByType: function (aColumnType) {
if (this._columns[aColumnType]) if (this._columns[aColumnType])
return this._columns[aColumnType]; return this._columns[aColumnType];
@ -1039,7 +1039,7 @@ PlacesTreeView.prototype = {
return null; return null;
}, },
sortingChanged: function PTV__sortingChanged(aSortingMode) { sortingChanged: function (aSortingMode) {
if (!this._tree || !this._result) if (!this._tree || !this._result)
return; return;
@ -1068,7 +1068,7 @@ PlacesTreeView.prototype = {
}, },
_inBatchMode: false, _inBatchMode: false,
batching: function PTV__batching(aToggleMode) { batching: function (aToggleMode) {
if (this._inBatchMode != aToggleMode) { if (this._inBatchMode != aToggleMode) {
this._inBatchMode = this.selection.selectEventsSuppressed = aToggleMode; this._inBatchMode = this.selection.selectEventsSuppressed = aToggleMode;
if (this._inBatchMode) { if (this._inBatchMode) {
@ -1107,14 +1107,14 @@ PlacesTreeView.prototype = {
return val; return val;
}, },
nodeForTreeIndex: function PTV_nodeForTreeIndex(aIndex) { nodeForTreeIndex: function (aIndex) {
if (aIndex > this._rows.length) if (aIndex > this._rows.length)
throw Cr.NS_ERROR_INVALID_ARG; throw Cr.NS_ERROR_INVALID_ARG;
return this._getNodeForRow(aIndex); return this._getNodeForRow(aIndex);
}, },
treeIndexForNode: function PTV_treeNodeForIndex(aNode) { treeIndexForNode: function (aNode) {
// The API allows passing invisible nodes. // The API allows passing invisible nodes.
try { try {
return this._getRowForNode(aNode, true); return this._getRowForNode(aNode, true);
@ -1124,7 +1124,7 @@ PlacesTreeView.prototype = {
return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE; return Ci.nsINavHistoryResultTreeViewer.INDEX_INVISIBLE;
}, },
_getResourceForNode: function PTV_getResourceForNode(aNode) _getResourceForNode: function (aNode)
{ {
let uri = aNode.uri; let uri = aNode.uri;
NS_ASSERT(uri, "if there is no uri, we can't persist the open state"); NS_ASSERT(uri, "if there is no uri, we can't persist the open state");
@ -1139,7 +1139,7 @@ PlacesTreeView.prototype = {
getRowProperties: function() { return ""; }, getRowProperties: function() { return ""; },
getCellProperties: getCellProperties:
function PTV_getCellProperties(aRow, aColumn) { function (aRow, aColumn) {
// for anonid-trees, we need to add the column-type manually // for anonid-trees, we need to add the column-type manually
var props = ""; var props = "";
let columnType = aColumn.element.getAttribute("anonid"); let columnType = aColumn.element.getAttribute("anonid");
@ -1220,7 +1220,7 @@ PlacesTreeView.prototype = {
getColumnProperties: function(aColumn) { return ""; }, getColumnProperties: function(aColumn) { return ""; },
isContainer: function PTV_isContainer(aRow) { isContainer: function (aRow) {
// Only leaf nodes aren't listed in the rows array. // Only leaf nodes aren't listed in the rows array.
let node = this._rows[aRow]; let node = this._rows[aRow];
if (node === undefined) if (node === undefined)
@ -1245,7 +1245,7 @@ PlacesTreeView.prototype = {
return false; return false;
}, },
isContainerOpen: function PTV_isContainerOpen(aRow) { isContainerOpen: function (aRow) {
if (this._flatList) if (this._flatList)
return false; return false;
@ -1253,7 +1253,7 @@ PlacesTreeView.prototype = {
return this._rows[aRow].containerOpen; return this._rows[aRow].containerOpen;
}, },
isContainerEmpty: function PTV_isContainerEmpty(aRow) { isContainerEmpty: function (aRow) {
if (this._flatList) if (this._flatList)
return true; return true;
@ -1267,18 +1267,18 @@ PlacesTreeView.prototype = {
return !node.hasChildren; return !node.hasChildren;
}, },
isSeparator: function PTV_isSeparator(aRow) { isSeparator: function (aRow) {
// All separators are listed in the rows array. // All separators are listed in the rows array.
let node = this._rows[aRow]; let node = this._rows[aRow];
return node && PlacesUtils.nodeIsSeparator(node); return node && PlacesUtils.nodeIsSeparator(node);
}, },
isSorted: function PTV_isSorted() { isSorted: function () {
return this._result.sortingMode != return this._result.sortingMode !=
Ci.nsINavHistoryQueryOptions.SORT_BY_NONE; Ci.nsINavHistoryQueryOptions.SORT_BY_NONE;
}, },
canDrop: function PTV_canDrop(aRow, aOrientation, aDataTransfer) { canDrop: function (aRow, aOrientation, aDataTransfer) {
if (!this._result) if (!this._result)
throw Cr.NS_ERROR_UNEXPECTED; throw Cr.NS_ERROR_UNEXPECTED;
@ -1290,7 +1290,7 @@ PlacesTreeView.prototype = {
return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer); return ip && PlacesControllerDragHelper.canDrop(ip, aDataTransfer);
}, },
_getInsertionPoint: function PTV__getInsertionPoint(index, orientation) { _getInsertionPoint: function (index, orientation) {
let container = this._result.root; let container = this._result.root;
let dropNearItemId = -1; let dropNearItemId = -1;
// When there's no selection, assume the container is the container // When there's no selection, assume the container is the container
@ -1361,7 +1361,7 @@ PlacesTreeView.prototype = {
dropNearItemId); dropNearItemId);
}, },
drop: function PTV_drop(aRow, aOrientation, aDataTransfer) { drop: function (aRow, aOrientation, aDataTransfer) {
// We are responsible for translating the |index| and |orientation| // We are responsible for translating the |index| and |orientation|
// parameters into a container id and index within the container, // parameters into a container id and index within the container,
// since this information is specific to the tree view. // since this information is specific to the tree view.
@ -1372,12 +1372,12 @@ PlacesTreeView.prototype = {
PlacesControllerDragHelper.currentDropTarget = null; PlacesControllerDragHelper.currentDropTarget = null;
}, },
getParentIndex: function PTV_getParentIndex(aRow) { getParentIndex: function (aRow) {
let [parentNode, parentRow] = this._getParentByChildRow(aRow); let [parentNode, parentRow] = this._getParentByChildRow(aRow);
return parentRow; return parentRow;
}, },
hasNextSibling: function PTV_hasNextSibling(aRow, aAfterIndex) { hasNextSibling: function (aRow, aAfterIndex) {
if (aRow == this._rows.length - 1) { if (aRow == this._rows.length - 1) {
// The last row has no sibling. // The last row has no sibling.
return false; return false;
@ -1407,7 +1407,7 @@ PlacesTreeView.prototype = {
getLevel: function(aRow) this._getNodeForRow(aRow).indentLevel, getLevel: function(aRow) this._getNodeForRow(aRow).indentLevel,
getImageSrc: function PTV_getImageSrc(aRow, aColumn) { getImageSrc: function (aRow, aColumn) {
// Only the title column has an image. // Only the title column has an image.
if (this._getColumnType(aColumn) != this.COLUMN_TYPE_TITLE) if (this._getColumnType(aColumn) != this.COLUMN_TYPE_TITLE)
return ""; return "";
@ -1418,7 +1418,7 @@ PlacesTreeView.prototype = {
getProgressMode: function(aRow, aColumn) { }, getProgressMode: function(aRow, aColumn) { },
getCellValue: function(aRow, aColumn) { }, getCellValue: function(aRow, aColumn) { },
getCellText: function PTV_getCellText(aRow, aColumn) { getCellText: function (aRow, aColumn) {
let node = this._getNodeForRow(aRow); let node = this._getNodeForRow(aRow);
switch (this._getColumnType(aColumn)) { switch (this._getColumnType(aColumn)) {
case this.COLUMN_TYPE_TITLE: case this.COLUMN_TYPE_TITLE:
@ -1515,7 +1515,7 @@ PlacesTreeView.prototype = {
return ""; return "";
}, },
setTree: function PTV_setTree(aTree) { setTree: function (aTree) {
// If we are replacing the tree during a batch, there is a concrete risk // 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. // 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. // This is a no-op if we are not batching.
@ -1538,7 +1538,7 @@ PlacesTreeView.prototype = {
} }
}, },
toggleOpenState: function PTV_toggleOpenState(aRow) { toggleOpenState: function (aRow) {
if (!this._result) if (!this._result)
throw Cr.NS_ERROR_UNEXPECTED; throw Cr.NS_ERROR_UNEXPECTED;
@ -1565,7 +1565,7 @@ PlacesTreeView.prototype = {
node.containerOpen = !node.containerOpen; node.containerOpen = !node.containerOpen;
}, },
cycleHeader: function PTV_cycleHeader(aColumn) { cycleHeader: function (aColumn) {
if (!this._result) if (!this._result)
throw Cr.NS_ERROR_UNEXPECTED; throw Cr.NS_ERROR_UNEXPECTED;
@ -1697,7 +1697,7 @@ PlacesTreeView.prototype = {
this._result.sortingMode = newSort; this._result.sortingMode = newSort;
}, },
isEditable: function PTV_isEditable(aRow, aColumn) { isEditable: function (aRow, aColumn) {
// At this point we only support editing the title field. // At this point we only support editing the title field.
if (aColumn.index != 0) if (aColumn.index != 0)
return false; return false;
@ -1740,7 +1740,7 @@ PlacesTreeView.prototype = {
return true; return true;
}, },
setCellText: function PTV_setCellText(aRow, aColumn, aText) { setCellText: function (aRow, aColumn, aText) {
// We may only get here if the cell is editable. // We may only get here if the cell is editable.
let node = this._rows[aRow]; let node = this._rows[aRow];
if (node.title != aText) { if (node.title != aText) {
@ -1749,7 +1749,7 @@ PlacesTreeView.prototype = {
} }
}, },
toggleCutNode: function PTV_toggleCutNode(aNode, aValue) { toggleCutNode: function (aNode, aValue) {
let currentVal = this._cuttingNodes.has(aNode); let currentVal = this._cuttingNodes.has(aNode);
if (currentVal != aValue) { if (currentVal != aValue) {
if (aValue) if (aValue)