From 050487252bcc3e20c49457fbed3c710905b374b6 Mon Sep 17 00:00:00 2001 From: "dietrich@mozilla.com" Date: Mon, 10 Mar 2008 09:41:52 -0700 Subject: [PATCH] Bug 384370 - test perf run (r=mano) --- browser/app/profile/firefox.js | 7 +- browser/base/content/browser-menubar.inc | 2 +- browser/base/content/browser-places.js | 56 +- browser/base/content/browser.js | 16 +- browser/base/content/nsContextMenu.js | 6 +- browser/components/nsBrowserGlue.js | 131 +- .../places/content/bookmarkProperties.js | 76 +- .../places/content/bookmarksPanel.js | 2 +- .../components/places/content/controller.js | 91 +- .../places/content/editBookmarkOverlay.js | 68 +- .../places/content/history-panel.js | 2 +- browser/components/places/content/menu.xml | 6 +- .../places/content/moveBookmarks.js | 8 +- browser/components/places/content/places.js | 152 +-- browser/components/places/content/places.xul | 2 +- .../places/content/placesOverlay.xul | 9 +- .../components/places/content/sidebarUtils.js | 4 +- browser/components/places/content/toolbar.xml | 6 +- browser/components/places/content/tree.xml | 2 +- browser/components/places/content/treeView.js | 20 +- browser/components/places/content/utils.js | 1194 +++-------------- browser/components/places/src/Makefile.in | 2 + .../src/nsPlacesImportExportService.cpp | 44 +- .../places/src/nsPlacesTransactionsService.js | 17 +- .../places/tests/unit/head_bookmarks.js | 2 + .../places/tests/unit/test_384370.js | 283 +++- .../places/tests/unit/test_398914.js | 7 +- .../places/tests/unit/test_bookmarks_html.js | 1 - browser/components/sidebar/src/nsSidebar.js | 2 +- toolkit/components/places/src/Makefile.in | 4 + .../components/places/src/nsTaggingService.js | 15 +- 31 files changed, 841 insertions(+), 1396 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index da37da6f98d..52b05b6847f 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -322,9 +322,10 @@ pref("browser.tabs.selectOwnerOnClose", true); pref("browser.bookmarks.sort.direction", "descending"); pref("browser.bookmarks.sort.resource", "rdf:http://home.netscape.com/NC-rdf#Name"); -// By default, do not overwrite bookmarks.html in the profile directory -// See bug #381216 for details -pref("browser.bookmarks.overwrite", false); +// By default, do not export HTML at shutdown. +// If true, at shutdown the bookmarks in your menu and toolbar will +// be exported as HTML to the bookmarks.html file. +pref("browser.bookmarks.autoExportHTML", false); // Scripts & Windows prefs pref("dom.disable_open_during_load", true); diff --git a/browser/base/content/browser-menubar.inc b/browser/base/content/browser-menubar.inc index 544b2e5a64f..be13cb0199f 100644 --- a/browser/base/content/browser-menubar.inc +++ b/browser/base/content/browser-menubar.inc @@ -331,7 +331,7 @@ diff --git a/browser/base/content/browser-places.js b/browser/base/content/browser-places.js index f0fa2595d47..5b0bca16478 100644 --- a/browser/base/content/browser-places.js +++ b/browser/base/content/browser-places.js @@ -105,7 +105,7 @@ var StarUI = { this._itemId = -1; this._uri = null; if (this._batching) { - PlacesUtils.ptm.endBatch(); + PlacesUIUtils.ptm.endBatch(); this._batching = false; } } @@ -188,11 +188,11 @@ var StarUI = { // Otherwise, if no changes were done in the edit-item panel, the last // transaction on the undo stack may be the initial createItem transaction, // or worse, the batched editing of some other item. - PlacesUtils.ptm.doTransaction({ doTransaction: function() { }, - undoTransaction: function() { }, - redoTransaction: function() { }, - isTransient: false, - merge: function() { return false; } }); + PlacesUIUtils.ptm.doTransaction({ doTransaction: function() { }, + undoTransaction: function() { }, + redoTransaction: function() { }, + isTransient: false, + merge: function() { return false; } }); if (this.panel.state == "closed") { // Consume dismiss clicks, see bug 400924 @@ -271,7 +271,7 @@ var StarUI = { cancelButtonOnCommand: function SU_cancelButtonOnCommand() { this.endBatch(); - PlacesUtils.ptm.undoTransaction(); + PlacesUIUtils.ptm.undoTransaction(); this.panel.hidePopup(); }, @@ -282,8 +282,8 @@ var StarUI = { // a "Bookmark Removed" notification along with an Undo button is // shown if (this._batching) { - PlacesUtils.ptm.endBatch(); - PlacesUtils.ptm.beginBatch(); // allow undo from within the notification + PlacesUIUtils.ptm.endBatch(); + PlacesUIUtils.ptm.beginBatch(); // allow undo from within the notification var bundle = this._element("bundle_browser"); // "Bookmark Removed" title (the description field is already empty in @@ -308,8 +308,8 @@ var StarUI = { // the tags for the url var itemIds = PlacesUtils.getBookmarksForURI(this._uri); for (var i=0; i < itemIds.length; i++) { - var txn = PlacesUtils.ptm.removeItem(itemIds[i]); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.removeItem(itemIds[i]); + PlacesUIUtils.ptm.doTransaction(txn); } #ifdef ADVANCED_STARRING_UI @@ -324,21 +324,21 @@ var StarUI = { // restore the bookmark by undoing the last transaction and go back // to the edit state this.endBatch(); - PlacesUtils.ptm.undoTransaction(); + PlacesUIUtils.ptm.undoTransaction(); this._itemId = PlacesUtils.getMostRecentBookmarkForURI(this._uri); this.showEditBookmarkPopup(); }, beginBatch: function SU_beginBatch() { if (!this._batching) { - PlacesUtils.ptm.beginBatch(); + PlacesUIUtils.ptm.beginBatch(); this._batching = true; } }, endBatch: function SU_endBatch() { if (this._batching) { - PlacesUtils.ptm.endBatch(); + PlacesUIUtils.ptm.endBatch(); this._batching = false; } } @@ -372,7 +372,7 @@ var PlacesCommandHook = { var description; try { title = webNav.document.title || url.spec; - description = PlacesUtils.getDescriptionFromDocument(webNav.document); + description = PlacesUIUtils.getDescriptionFromDocument(webNav.document); } catch (e) { } @@ -386,9 +386,9 @@ var PlacesCommandHook = { var parent = aParent != undefined ? aParent : PlacesUtils.unfiledBookmarksFolderId; var descAnno = { name: DESCRIPTION_ANNO, value: description }; - var txn = PlacesUtils.ptm.createItem(uri, parent, -1, - title, null, [descAnno]); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.createItem(uri, parent, -1, + title, null, [descAnno]); + PlacesUIUtils.ptm.doTransaction(txn); itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); } @@ -432,8 +432,8 @@ var PlacesCommandHook = { var itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI); if (itemId == -1) { StarUI.beginBatch(); - var txn = PlacesUtils.ptm.createItem(linkURI, aParent, -1, aTitle); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.createItem(linkURI, aParent, -1, aTitle); + PlacesUIUtils.ptm.doTransaction(txn); itemId = PlacesUtils.getMostRecentBookmarkForURI(linkURI); } @@ -474,7 +474,7 @@ var PlacesCommandHook = { */ bookmarkCurrentPages: function PCH_bookmarkCurrentPages() { var tabURIs = this._getUniqueTabInfo(); - PlacesUtils.showMinimalAddMultiBookmarkUI(tabURIs); + PlacesUIUtils.showMinimalAddMultiBookmarkUI(tabURIs); }, @@ -500,12 +500,12 @@ var PlacesCommandHook = { if (arguments.length > 2) description = feedSubtitle; else - description = PlacesUtils.getDescriptionFromDocument(doc); + description = PlacesUIUtils.getDescriptionFromDocument(doc); var toolbarIP = new InsertionPoint(PlacesUtils.bookmarks.toolbarFolder, -1); - PlacesUtils.showMinimalAddLivemarkUI(feedURI, gBrowser.currentURI, - title, description, toolbarIP, true); + PlacesUIUtils.showMinimalAddLivemarkUI(feedURI, gBrowser.currentURI, + title, description, toolbarIP, true); }, /** @@ -581,7 +581,7 @@ var BookmarksEventHandler = { return; var target = aEvent.originalTarget; - var view = PlacesUtils.getViewForNode(target); + var view = PlacesUIUtils.getViewForNode(target); if (target.node && PlacesUtils.nodeIsFolder(target.node)) { // Don't open the root folder in tabs when the empty area on the toolbar // is middle-clicked or when a non-bookmark item except for Open in Tabs) @@ -625,7 +625,7 @@ var BookmarksEventHandler = { onCommand: function BM_onCommand(aEvent) { var target = aEvent.originalTarget; if (target.node) - PlacesUtils.openNodeWithEvent(target.node, aEvent); + PlacesUIUtils.openNodeWithEvent(target.node, aEvent); }, /** @@ -685,7 +685,7 @@ var BookmarksEventHandler = { openHomePage.setAttribute("onclick", "checkForMiddleClick(this, event); event.stopPropagation();"); openHomePage.setAttribute("label", - PlacesUtils.getFormattedString("menuOpenLivemarkOrigin.label", + PlacesUIUtils.getFormattedString("menuOpenLivemarkOrigin.label", [target.parentNode.getAttribute("label")])); target.appendChild(openHomePage); } @@ -694,7 +694,7 @@ var BookmarksEventHandler = { var openInTabs = document.createElement("menuitem"); openInTabs.setAttribute("openInTabs", "true"); openInTabs.setAttribute("oncommand", - "PlacesUtils.openContainerNodeInTabs(this.parentNode._resultNode, event);"); + "PlacesUIUtils.openContainerNodeInTabs(this.parentNode._resultNode, event);"); openInTabs.setAttribute("label", gNavigatorBundle.getString("menuOpenAllInTabs.label")); target.appendChild(openInTabs); diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 7462d63280d..e1fa6ac91a7 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -2616,7 +2616,7 @@ var bookmarksButtonObserver = { var split = aXferData.data.split("\n"); var url = split[0]; if (url != aXferData.data) // do nothing if it's not a valid URL - PlacesUtils.showMinimalAddBookmarkUI(makeURI(url), split[1]); + PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(url), split[1]); }, onDragOver: function (aEvent, aFlavour, aDragSession) @@ -3091,7 +3091,7 @@ function addToUrlbarHistory(aUrlToAdd) try { if (aUrlToAdd.indexOf(" ") == -1) { - PlacesUtils.markPageAsTyped(aUrlToAdd); + PlacesUIUtils.markPageAsTyped(aUrlToAdd); } } catch(ex) { @@ -4724,9 +4724,9 @@ function asyncOpenWebPanel(event) // This is the Opera convention for a special link that - when clicked - allows // you to add a sidebar panel. We support the Opera convention here. The link's // title attribute contains the title that should be used for the sidebar panel. - PlacesUtils.showMinimalAddBookmarkUI(makeURI(wrapper.href), - wrapper.getAttribute("title"), - null, null, true, true); + PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(wrapper.href), + wrapper.getAttribute("title"), + null, null, true, true); event.preventDefault(); return false; } @@ -5690,9 +5690,9 @@ function AddKeywordForSearchField() else spec += "?" + formData.join("&"); - var description = PlacesUtils.getDescriptionFromDocument(node.ownerDocument); - PlacesUtils.showMinimalAddBookmarkUI(makeURI(spec), "", description, null, - null, null, "", postData); + var description = PlacesUIUtils.getDescriptionFromDocument(node.ownerDocument); + PlacesUIUtils.showMinimalAddBookmarkUI(makeURI(spec), "", description, null, + null, null, "", postData); } function SwitchDocumentDirection(aWindow) { diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index bd82882c613..b08b46fdc58 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -1191,13 +1191,13 @@ nsContextMenu.prototype = { var itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); if (itemId == -1) { var title = doc.title; - var description = PlacesUtils.getDescriptionFromDocument(doc); + var description = PlacesUIUtils.getDescriptionFromDocument(doc); var descAnno = { name: DESCRIPTION_ANNO, value: description }; - var txn = PlacesUtils.ptm.createItem(uri, + var txn = PlacesUIUtils.ptm.createItem(uri, PlacesUtils.bookmarksMenuFolderId, -1, title, null, [descAnno]); - PlacesUtils.ptm.doTransaction(txn); + PlacesUIUtils.ptm.doTransaction(txn); itemId = PlacesUtils.getMostRecentBookmarkForURI(uri); StarUI.beginBatch(); } diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 4f499702190..9ce52e6d64f 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -47,6 +47,13 @@ Cu.import("resource:///modules/distribution.js"); const PREF_EM_NEW_ADDONS_LIST = "extensions.newAddons"; +// Check to see if bookmarks need backing up once per +// day on 1 hour idle. +const BOOKMARKS_ARCHIVE_IDLE_TIME = 60 * 60; + +// Backup bookmarks once every 24 hours. +const BOOKMARKS_ARCHIVE_INTERVAL = 86400 * 1000; + // Factory object const BrowserGlueServiceFactory = { _instance: null, @@ -108,15 +115,23 @@ BrowserGlue.prototype = { if (this._saveSession) { this._setPrefToSaveSession(); } + this._shutdownPlaces(); + this.idleService.removeIdleObserver(this, BOOKMARKS_ARCHIVE_IDLE_TIME); break; case "session-save": this._setPrefToSaveSession(); subject.QueryInterface(Ci.nsISupportsPRBool); subject.data = true; break; + case "idle": + if (this.idleService.idleTime > BOOKMARKS_ARCHIVE_IDLE_TIME * 1000) { + // Back up bookmarks. + this._archiveBookmarks(); + } + break; } - } -, + }, + // initialization (called on application startup) _init: function() { @@ -357,6 +372,14 @@ BrowserGlue.prototype = { return Sanitizer; }, + _idleService: null, + get idleService() { + if (!this._idleService) + this._idleService = Cc["@mozilla.org/widget/idleservice;1"]. + getService(Ci.nsIIdleService); + return this._idleService; + }, + /** * Initialize Places * - imports the bookmarks html file if bookmarks datastore is empty @@ -369,10 +392,11 @@ BrowserGlue.prototype = { var histsvc = Cc["@mozilla.org/browser/nav-history-service;1"]. getService(Ci.nsINavHistoryService); + var prefBranch = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + var importBookmarks = false; try { - var prefBranch = Cc["@mozilla.org/preferences-service;1"]. - getService(Ci.nsIPrefBranch); importBookmarks = prefBranch.getBoolPref("browser.places.importBookmarksHTML"); } catch(ex) {} @@ -380,55 +404,86 @@ BrowserGlue.prototype = { // Call it here for Fx3 profiles created before the Places folder // has been added, otherwise it's called during import. this.ensurePlacesDefaultQueriesInitialized(); - return; } + else { + // get latest backup + Cu.import("resource://gre/modules/utils.js"); + var bookmarksFile = PlacesUtils.getMostRecentBackup(); - var dirService = Cc["@mozilla.org/file/directory_service;1"]. - getService(Ci.nsIProperties); - - var bookmarksFile = dirService.get("BMarks", Ci.nsILocalFile); - - if (bookmarksFile.exists()) { - // import the file - try { - var importer = - Cc["@mozilla.org/browser/places/import-export-service;1"]. - getService(Ci.nsIPlacesImportExportService); - importer.importHTMLFromFile(bookmarksFile, true); - } catch(ex) { - } finally { - prefBranch.setBoolPref("browser.places.importBookmarksHTML", false); + if (bookmarksFile && bookmarksFile.leafName.match("\.json$")) { + // restore a JSON backup + PlacesUtils.restoreBookmarksFromJSONFile(bookmarksFile); } + else { + // if there's no json backup use bookmarks.html - // only back up pre-places bookmarks.html if we plan on overwriting it - if (prefBranch.getBoolPref("browser.bookmarks.overwrite")) { - // backup pre-places bookmarks.html - // XXXtodo remove this before betas, after import/export is solid - var profDir = dirService.get("ProfD", Ci.nsILocalFile); - var bookmarksBackup = profDir.clone(); - bookmarksBackup.append("bookmarks.preplaces.html"); - if (!bookmarksBackup.exists()) { - // save old bookmarks.html file as bookmarks.preplaces.html - try { - bookmarksFile.copyTo(profDir, "bookmarks.preplaces.html"); - } catch(ex) { - dump("nsBrowserGlue::_initPlaces(): copy of bookmarks.html to bookmarks.preplaces.html failed: " + ex + "\n"); - } + var dirService = Cc["@mozilla.org/file/directory_service;1"]. + getService(Ci.nsIProperties); + var bookmarksFile = dirService.get("BMarks", Ci.nsILocalFile); + + // import the file + try { + var importer = Cc["@mozilla.org/browser/places/import-export-service;1"]. + getService(Ci.nsIPlacesImportExportService); + importer.importHTMLFromFile(bookmarksFile, true /* overwrite existing */); + } finally { + prefBranch.setBoolPref("browser.places.importBookmarksHTML", false); } } } + + // Initialize bookmark archiving on idle. + // Once a day, either on idle or shutdown, bookmarks are backed up. + this.idleService.addIdleObserver(this, BOOKMARKS_ARCHIVE_IDLE_TIME); }, /** * Places shut-down tasks * - back up and archive bookmarks + * - export bookmarks as HTML, if so configured + * + * Note: quit-application-granted notification is received twice + * so replace this method with a no-op when first called. */ _shutdownPlaces: function bg__shutdownPlaces() { - // backup bookmarks to bookmarks.html - var importer = + // Backup and archive Places bookmarks. + this._archiveBookmarks(); + + // Backup bookmarks to bookmarks.html to support apps that depend + // on the legacy format. + var autoExportHTML = false; + try { + autoExportHTML = prefs.getIntPref("browser.bookmarks.autoExportHTML"); + } catch(ex) {} + + if (autoExportHTML) { Cc["@mozilla.org/browser/places/import-export-service;1"]. - getService(Ci.nsIPlacesImportExportService); - importer.backupBookmarksFile(); + getService(Ci.nsIPlacesImportExportService). + backupBookmarksFile(); + } + }, + + /** + * Back up and archive bookmarks + */ + _archiveBookmarks: function nsBrowserGlue__archiveBookmarks() { + Cu.import("resource://gre/modules/utils.js"); + + var lastBackup = PlacesUtils.getMostRecentBackup(); + + // Backup bookmarks if there aren't any backups or + // they haven't been backed up in the last 24 hrs. + if (!lastBackup || + Date.now() - lastBackup.lastModifiedTime > BOOKMARKS_ARCHIVE_INTERVAL) { + var maxBackups = 5; + var prefs = Cc["@mozilla.org/preferences-service;1"]. + getService(Ci.nsIPrefBranch); + try { + maxBackups = prefs.getIntPref("browser.bookmarks.max_backups"); + } catch(ex) {} + + PlacesUtils.archiveBookmarksFile(maxBackups, false /* don't force */); + } }, _migrateUI: function bg__migrateUI() { diff --git a/browser/components/places/content/bookmarkProperties.js b/browser/components/places/content/bookmarkProperties.js index a1dd76f4f4c..540d67e4c68 100755 --- a/browser/components/places/content/bookmarkProperties.js +++ b/browser/components/places/content/bookmarkProperties.js @@ -567,8 +567,8 @@ var BookmarkPropertiesPanel = { var itemToSelect = userEnteredNameField; try { this._microsummaries = - PlacesUtils.microsummaries.getMicrosummaries(this._bookmarkURI, - this._bookmarkId); + PlacesUIUtils.microsummaries.getMicrosummaries(this._bookmarkURI, + this._bookmarkId); } catch(ex) { // getMicrosummaries will throw an exception if the page to which the URI @@ -590,8 +590,8 @@ var BookmarkPropertiesPanel = { var menuItem = this._createMicrosummaryMenuItem(microsummary); if (this._action == ACTION_EDIT && - PlacesUtils.microsummaries - .isMicrosummary(this._bookmarkId, microsummary)) + PlacesUIUtils.microsummaries + .isMicrosummary(this._bookmarkId, microsummary)) itemToSelect = menuItem; menupopup.appendChild(menuItem); @@ -713,7 +713,7 @@ var BookmarkPropertiesPanel = { try { var value = this._element(aTextboxID).value; if (value) { - var uri = PlacesUtils.createFixedURI(value); + var uri = PlacesUIUtils.createFixedURI(value); return true; } } catch (e) { } @@ -725,7 +725,7 @@ var BookmarkPropertiesPanel = { */ _getEditTitleTransaction: function BPP__getEditTitleTransaction(aItemId, aNewTitle) { - return PlacesUtils.ptm.editItemTitle(aItemId, aNewTitle); + return PlacesUIUtils.ptm.editItemTitle(aItemId, aNewTitle); }, /** @@ -813,21 +813,21 @@ var BookmarkPropertiesPanel = { // description var description = this._element("descriptionTextfield").value; if (description != this._itemDescription) { - transactions.push(PlacesUtils.ptm. + transactions.push(PlacesUIUtils.ptm. editItemDescription(itemId, description, this._itemType != BOOKMARK_ITEM)); } if (this._itemType == BOOKMARK_ITEM) { // location - var url = PlacesUtils.createFixedURI(this._element("editURLBar").value); + var url = PlacesUIUtils.createFixedURI(this._element("editURLBar").value); if (!this._bookmarkURI.equals(url)) - transactions.push(PlacesUtils.ptm.editBookmarkURI(itemId, url)); + transactions.push(PlacesUIUtils.ptm.editBookmarkURI(itemId, url)); // keyword transactions var newKeyword = this._element("keywordTextfield").value; if (newKeyword != this._bookmarkKeyword) { - transactions.push(PlacesUtils.ptm. + transactions.push(PlacesUIUtils.ptm. editBookmarkKeyword(itemId, newKeyword)); } @@ -841,39 +841,39 @@ var BookmarkPropertiesPanel = { // selected a microsummary which is not the one the bookmark previously // had. if ((newMicrosummary == null && - PlacesUtils.microsummaries.hasMicrosummary(itemId)) || + PlacesUIUtils.microsummaries.hasMicrosummary(itemId)) || (newMicrosummary != null && - !PlacesUtils.microsummaries - .isMicrosummary(itemId, newMicrosummary))) { + !PlacesUIUtils.microsummaries + .isMicrosummary(itemId, newMicrosummary))) { transactions.push( - PlacesUtils.ptm.editBookmarkMicrosummary(itemId, newMicrosummary)); + PlacesUIUtils.ptm.editBookmarkMicrosummary(itemId, newMicrosummary)); } // load in sidebar var loadInSidebarChecked = this._element("loadInSidebarCheckbox").checked; if (loadInSidebarChecked != this._loadBookmarkInSidebar) { transactions.push( - PlacesUtils.ptm.setLoadInSidebar(itemId, loadInSidebarChecked)); + PlacesUIUtils.ptm.setLoadInSidebar(itemId, loadInSidebarChecked)); } } else if (this._itemType == LIVEMARK_CONTAINER) { var feedURIString = this._element("feedLocationTextfield").value; - var feedURI = PlacesUtils.createFixedURI(feedURIString); + var feedURI = PlacesUIUtils.createFixedURI(feedURIString); if (!this._feedURI.equals(feedURI)) { transactions.push( - PlacesUtils.ptm.editLivemarkFeedURI(this._folderId, feedURI)); + PlacesUIUtils.ptm.editLivemarkFeedURI(this._folderId, feedURI)); } // Site Location is empty, we can set its URI to null var newSiteURIString = this._element("feedSiteLocationTextfield").value; var newSiteURI = null; if (newSiteURIString) - newSiteURI = PlacesUtils.createFixedURI(newSiteURIString); + newSiteURI = PlacesUIUtils.createFixedURI(newSiteURIString); if ((!newSiteURI && this._siteURI) || (newSiteURI && (!this._siteURI || !this._siteURI.equals(newSiteURI)))) { transactions.push( - PlacesUtils.ptm.editLivemarkSiteURI(this._folderId, newSiteURI)); + PlacesUIUtils.ptm.editLivemarkSiteURI(this._folderId, newSiteURI)); } } @@ -882,8 +882,8 @@ var BookmarkPropertiesPanel = { if (transactions.length > 0) { window.arguments[0].performed = true; var aggregate = - PlacesUtils.ptm.aggregateTransactions(this._getDialogTitle(), transactions); - PlacesUtils.ptm.doTransaction(aggregate); + PlacesUIUtils.ptm.aggregateTransactions(this._getDialogTitle(), transactions); + PlacesUIUtils.ptm.doTransaction(aggregate); } }, @@ -912,7 +912,7 @@ var BookmarkPropertiesPanel = { */ _getCreateNewBookmarkTransaction: function BPP__getCreateNewBookmarkTransaction(aContainer, aIndex) { - var uri = PlacesUtils.createFixedURI(this._element("editURLBar").value); + var uri = PlacesUIUtils.createFixedURI(this._element("editURLBar").value); var title = this._element("userEnteredName").label; var keyword = this._element("keywordTextfield").value; var annotations = []; @@ -928,20 +928,20 @@ var BookmarkPropertiesPanel = { var microsummary = this._element("namePicker").selectedItem.microsummary; if (microsummary) { childTransactions.push( - PlacesUtils.ptm.editBookmarkMicrosummary(-1, microsummary)); + PlacesUIUtils.ptm.editBookmarkMicrosummary(-1, microsummary)); } if (this._postData) { childTransactions.push( - PlacesUtils.ptm.editBookmarkPostData(-1, this._postData)); + PlacesUIUtils.ptm.editBookmarkPostData(-1, this._postData)); } - var transactions = [PlacesUtils.ptm.createItem(uri, aContainer, aIndex, - title, keyword, - annotations, - childTransactions)]; + var transactions = [PlacesUIUtils.ptm.createItem(uri, aContainer, aIndex, + title, keyword, + annotations, + childTransactions)]; - return PlacesUtils.ptm.aggregateTransactions(this._getDialogTitle(), transactions); + return PlacesUIUtils.ptm.aggregateTransactions(this._getDialogTitle(), transactions); }, /** @@ -953,7 +953,7 @@ var BookmarkPropertiesPanel = { for (var i = 0; i < this._URIList.length; ++i) { var uri = this._URIList[i]; var title = this._getURITitleFromHistory(uri); - transactions.push(PlacesUtils.ptm.createItem(uri, -1, -1, title)); + transactions.push(PlacesUIUtils.ptm.createItem(uri, -1, -1, title)); } return transactions; }, @@ -973,8 +973,8 @@ var BookmarkPropertiesPanel = { if (description) annotations.push(this._getDescriptionAnnotation(description)); - return PlacesUtils.ptm.createFolder(folderName, aContainer, aIndex, - annotations, childItemsTransactions); + return PlacesUIUtils.ptm.createFolder(folderName, aContainer, aIndex, + annotations, childItemsTransactions); }, /** @@ -984,16 +984,16 @@ var BookmarkPropertiesPanel = { _getCreateNewLivemarkTransaction: function BPP__getCreateNewLivemarkTransaction(aContainer, aIndex) { var feedURIString = this._element("feedLocationTextfield").value; - var feedURI = PlacesUtils.createFixedURI(feedURIString); + var feedURI = PlacesUIUtils.createFixedURI(feedURIString); var siteURIString = this._element("feedSiteLocationTextfield").value; var siteURI = null; if (siteURIString) - siteURI = PlacesUtils.createFixedURI(siteURIString); + siteURI = PlacesUIUtils.createFixedURI(siteURIString); var name = this._element("namePicker").value; - return PlacesUtils.ptm.createLivemark(feedURI, siteURI, name, - aContainer, aIndex); + return PlacesUIUtils.ptm.createLivemark(feedURI, siteURI, name, + aContainer, aIndex); }, /** @@ -1018,7 +1018,7 @@ var BookmarkPropertiesPanel = { // perfrom our transaction do via the transaction manager passed by the // opener so it can be undone. window.arguments[0].performed = true; - PlacesUtils.ptm.doTransaction(createTxn); + PlacesUIUtils.ptm.doTransaction(createTxn); }, onNamePickerInput: function BPP_onNamePickerInput() { @@ -1049,7 +1049,7 @@ var BookmarkPropertiesPanel = { if (!this._folderTree.place) { const FOLDER_TREE_PLACE_URI = "place:excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1&folder=" + - PlacesUtils.allBookmarksFolderId; + PlacesUIUtils.allBookmarksFolderId; this._folderTree.place = FOLDER_TREE_PLACE_URI; } diff --git a/browser/components/places/content/bookmarksPanel.js b/browser/components/places/content/bookmarksPanel.js index 5884a4d22a3..4f0b7de924d 100644 --- a/browser/components/places/content/bookmarksPanel.js +++ b/browser/components/places/content/bookmarksPanel.js @@ -37,7 +37,7 @@ function init() { document.getElementById("bookmarks-view").place = - "place:queryType=1&folder=" + window.top.PlacesUtils.allBookmarksFolderId; + "place:queryType=1&folder=" + window.top.PlacesUIUtils.allBookmarksFolderId; document.getElementById("search-box").focus(); } diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js index ff470ae38a7..3ff5a0d1ebb 100755 --- a/browser/components/places/content/controller.js +++ b/browser/components/places/content/controller.js @@ -103,9 +103,9 @@ PlacesController.prototype = { isCommandEnabled: function PC_isCommandEnabled(aCommand) { switch (aCommand) { case "cmd_undo": - return PlacesUtils.ptm.numberOfUndoItems > 0; + return PlacesUIUtils.ptm.numberOfUndoItems > 0; case "cmd_redo": - return PlacesUtils.ptm.numberOfRedoItems > 0; + return PlacesUIUtils.ptm.numberOfRedoItems > 0; case "cmd_cut": case "cmd_delete": return this._hasRemovableSelection(false); @@ -152,7 +152,7 @@ PlacesController.prototype = { case "placesCmd_reloadMicrosummary": var selectedNode = this._view.selectedNode; return selectedNode && PlacesUtils.nodeIsBookmark(selectedNode) && - PlacesUtils.microsummaries.hasMicrosummary(selectedNode.itemId); + PlacesUIUtils.microsummaries.hasMicrosummary(selectedNode.itemId); case "placesCmd_reload": // Livemark containers var selectedNode = this._view.selectedNode; @@ -192,10 +192,10 @@ PlacesController.prototype = { doCommand: function PC_doCommand(aCommand) { switch (aCommand) { case "cmd_undo": - PlacesUtils.ptm.undoTransaction(); + PlacesUIUtils.ptm.undoTransaction(); break; case "cmd_redo": - PlacesUtils.ptm.redoTransaction(); + PlacesUIUtils.ptm.redoTransaction(); break; case "cmd_cut": this.cut(); @@ -213,13 +213,13 @@ PlacesController.prototype = { this.selectAll(); break; case "placesCmd_open": - PlacesUtils.openNodeIn(this._view.selectedNode, "current"); + PlacesUIUtils.openNodeIn(this._view.selectedNode, "current"); break; case "placesCmd_open:window": - PlacesUtils.openNodeIn(this._view.selectedNode, "window"); + PlacesUIUtils.openNodeIn(this._view.selectedNode, "window"); break; case "placesCmd_open:tab": - PlacesUtils.openNodeIn(this._view.selectedNode, "tab"); + PlacesUIUtils.openNodeIn(this._view.selectedNode, "tab"); break; case "placesCmd_new:folder": this.newItem("folder"); @@ -337,8 +337,8 @@ PlacesController.prototype = { // if the clipboard contains TYPE_X_MOZ_PLACE_* data, it is definitely // pasteable, with no need to unwrap all the nodes. - var flavors = PlacesUtils.placesFlavors; - var clipboard = PlacesUtils.clipboard; + var flavors = PlacesUIUtils.placesFlavors; + var clipboard = PlacesUIUtils.clipboard; var hasPlacesData = clipboard.hasDataMatchingFlavors(flavors, flavors.length, Ci.nsIClipboard.kGlobalClipboard); @@ -442,7 +442,7 @@ PlacesController.prototype = { uri = PlacesUtils._uri(node.uri); if (PlacesUtils.nodeIsBookmark(node)) { nodeData["bookmark"] = true; - var mss = PlacesUtils.microsummaries; + var mss = PlacesUIUtils.microsummaries; if (mss.hasMicrosummary(node.itemId)) nodeData["microsummary"] = true; else if (node.parent && @@ -628,9 +628,9 @@ PlacesController.prototype = { return; if (PlacesUtils.nodeIsFolder(node)) - PlacesUtils.showFolderProperties(node.itemId); + PlacesUIUtils.showFolderProperties(node.itemId); else if (PlacesUtils.nodeIsBookmark(node)) - PlacesUtils.showBookmarkProperties(node.itemId); + PlacesUIUtils.showBookmarkProperties(node.itemId); }, /** @@ -656,7 +656,7 @@ PlacesController.prototype = { */ reloadSelectedMicrosummary: function PC_reloadSelectedMicrosummary() { var selectedNode = this._view.selectedNode; - var mss = PlacesUtils.microsummaries; + var mss = PlacesUIUtils.microsummaries; if (mss.hasMicrosummary(selectedNode.itemId)) mss.refreshMicrosummary(selectedNode.itemId); }, @@ -688,14 +688,14 @@ PlacesController.prototype = { GetStringFromName("brandShortName"); var buttonPressed = promptService.confirmEx(window, - PlacesUtils.getString("tabs.openWarningTitle"), - PlacesUtils.getFormattedString(messageKey, + PlacesUIUtils.getString("tabs.openWarningTitle"), + PlacesUIUtils.getFormattedString(messageKey, [numTabsToOpen, brandShortName]), (promptService.BUTTON_TITLE_IS_STRING * promptService.BUTTON_POS_0) + (promptService.BUTTON_TITLE_CANCEL * promptService.BUTTON_POS_1), - PlacesUtils.getString(openKey), + PlacesUIUtils.getString(openKey), null, null, - PlacesUtils.getFormattedString("tabs.openWarningPromptMeBranded", + PlacesUIUtils.getFormattedString("tabs.openWarningPromptMeBranded", [brandShortName]), warnOnOpen); @@ -714,9 +714,9 @@ PlacesController.prototype = { openSelectionInTabs: function PC_openLinksInTabs(aEvent) { var node = this._view.selectedNode; if (node && PlacesUtils.nodeIsContainer(node)) - PlacesUtils.openContainerNodeInTabs(this._view.selectedNode, aEvent); + PlacesUIUtils.openContainerNodeInTabs(this._view.selectedNode, aEvent); else - PlacesUtils.openURINodesInTabs(this._view.getSelectionNodes(), aEvent); + PlacesUIUtils.openURINodesInTabs(this._view.getSelectionNodes(), aEvent); }, /** @@ -732,11 +732,11 @@ PlacesController.prototype = { var performed = false; if (aType == "bookmark") - performed = PlacesUtils.showAddBookmarkUI(null, null, null, ip); + performed = PlacesUIUtils.showAddBookmarkUI(null, null, null, ip); else if (aType == "livemark") - performed = PlacesUtils.showAddLivemarkUI(null, null, null, null, ip); + performed = PlacesUIUtils.showAddLivemarkUI(null, null, null, null, ip); else // folder - performed = PlacesUtils.showAddFolderUI(null, ip); + performed = PlacesUIUtils.showAddFolderUI(null, ip); if (performed) { // select the new item @@ -757,7 +757,7 @@ PlacesController.prototype = { throw Cr.NS_ERROR_NOT_AVAILABLE; var performed = false; - performed = PlacesUtils.showAddFolderUI(null, ip); + performed = PlacesUIUtils.showAddFolderUI(null, ip); if (performed) { // select the new item var insertedNodeId = PlacesUtils.bookmarks @@ -773,8 +773,8 @@ PlacesController.prototype = { var ip = this._view.insertionPoint; if (!ip) throw Cr.NS_ERROR_NOT_AVAILABLE; - var txn = PlacesUtils.ptm.createSeparator(ip.itemId, ip.index); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.createSeparator(ip.itemId, ip.index); + PlacesUIUtils.ptm.doTransaction(txn); // select the new item var insertedNodeId = PlacesUtils.bookmarks .getIdForItemAt(ip.itemId, ip.index); @@ -795,8 +795,8 @@ PlacesController.prototype = { */ sortFolderByName: function PC_sortFolderByName() { var itemId = PlacesUtils.getConcreteItemId(this._view.selectedNode); - var txn = PlacesUtils.ptm.sortFolderByName(itemId); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.sortFolderByName(itemId); + PlacesUIUtils.ptm.doTransaction(txn); }, /** @@ -856,7 +856,7 @@ PlacesController.prototype = { if (PlacesUtils.nodeIsFolder(node)) removedFolders.push(node); - transactions.push(PlacesUtils.ptm.removeItem(node.itemId)); + transactions.push(PlacesUIUtils.ptm.removeItem(node.itemId)); } }, @@ -873,8 +873,8 @@ PlacesController.prototype = { for (var i = ranges.length - 1; i >= 0 ; --i) this._removeRange(ranges[i], transactions); if (transactions.length > 0) { - var txn = PlacesUtils.ptm.aggregateTransactions(txnName, transactions); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.aggregateTransactions(txnName, transactions); + PlacesUIUtils.ptm.doTransaction(txn); } }, @@ -997,7 +997,7 @@ PlacesController.prototype = { var data = new TransferData(); function addData(type, overrideURI) { - data.addDataForFlavour(type, PlacesUtils._wrapString( + data.addDataForFlavour(type, PlacesUIUtils._wrapString( PlacesUtils.wrapNode(node, type, overrideURI))); } @@ -1075,7 +1075,7 @@ PlacesController.prototype = { function addData(type, data) { xferable.addDataFlavor(type); - xferable.setTransferData(type, PlacesUtils._wrapString(data), data.length * 2); + xferable.setTransferData(type, PlacesUIUtils._wrapString(data), data.length * 2); } // This order is _important_! It controls how this and other applications // select data to be inserted based on type. @@ -1089,7 +1089,7 @@ PlacesController.prototype = { addData(PlacesUtils.TYPE_HTML, htmlString); if (placeString || unicodeString || htmlString || mozURLString) { - PlacesUtils.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard); + PlacesUIUtils.clipboard.setData(xferable, null, Ci.nsIClipboard.kGlobalClipboard); } } finally { @@ -1116,6 +1116,7 @@ PlacesController.prototype = { // clipboard. We need to get all of that data and build edit transactions // for them. This means asking the clipboard once for each type and // aggregating the results. + dump("PASTING\n"); /** * Constructs a transferable that can receive data of specific types. @@ -1133,7 +1134,7 @@ PlacesController.prototype = { return xferable; } - var clipboard = PlacesUtils.clipboard; + var clipboard = PlacesUIUtils.clipboard; var ip = this._view.insertionPoint; if (!ip) @@ -1161,9 +1162,9 @@ PlacesController.prototype = { // transactions insert differently if index == -1 if (ip.index > -1) index = ip.index + i; - transactions.push(PlacesUtils.makeTransaction(items[i], type.value, - ip.itemId, index, - true)); + transactions.push(PlacesUIUtils.makeTransaction(items[i], type.value, + ip.itemId, index, + true)); } return transactions; } @@ -1182,8 +1183,8 @@ PlacesController.prototype = { var transactions = getTransactions([PlacesUtils.TYPE_X_MOZ_PLACE, PlacesUtils.TYPE_X_MOZ_URL, PlacesUtils.TYPE_UNICODE]); - var txn = PlacesUtils.ptm.aggregateTransactions("Paste", transactions); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.aggregateTransactions("Paste", transactions); + PlacesUIUtils.ptm.doTransaction(txn); // select the pasted items, they should be consecutive var insertedNodeIds = []; @@ -1243,7 +1244,7 @@ var PlacesControllerDragHelper = { canDrop: function PCDH_canDrop() { var session = this.getSession(); if (session) { - var types = PlacesUtils.GENERIC_VIEW_DROP_TYPES; + var types = PlacesUIUtils.GENERIC_VIEW_DROP_TYPES; for (var i = 0; i < types.length; ++i) { if (session.isDataFlavorSupported(types[i])) return true; @@ -1263,7 +1264,7 @@ var PlacesControllerDragHelper = { _initTransferable: function PCDH__initTransferable(session) { var xferable = Cc["@mozilla.org/widget/transferable;1"]. createInstance(Ci.nsITransferable); - var types = PlacesUtils.GENERIC_VIEW_DROP_TYPES; + var types = PlacesUIUtils.GENERIC_VIEW_DROP_TYPES; for (var i = 0; i < types.length; ++i) { if (session.isDataFlavorSupported(types[i])) xferable.addDataFlavor(types[i]); @@ -1306,13 +1307,13 @@ var PlacesControllerDragHelper = { movedCount++; } - transactions.push(PlacesUtils.makeTransaction(unwrapped, + transactions.push(PlacesUIUtils.makeTransaction(unwrapped, flavor.value, insertionPoint.itemId, index, copy)); } - var txn = PlacesUtils.ptm.aggregateTransactions("DropItems", transactions); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.aggregateTransactions("DropItems", transactions); + PlacesUIUtils.ptm.doTransaction(txn); } }; diff --git a/browser/components/places/content/editBookmarkOverlay.js b/browser/components/places/content/editBookmarkOverlay.js index d957f9f3a52..586805568c7 100644 --- a/browser/components/places/content/editBookmarkOverlay.js +++ b/browser/components/places/content/editBookmarkOverlay.js @@ -145,7 +145,7 @@ var gEditItemOverlay = { // description field this._initTextField("descriptionField", - PlacesUtils.getItemDescription(this._itemId)); + PlacesUIUtils.getItemDescription(this._itemId)); this._showHideRows(); @@ -324,8 +324,8 @@ var gEditItemOverlay = { try { if (this._itemType == Ci.nsINavBookmarksService.TYPE_BOOKMARK && !this._readOnly) - this._microsummaries = PlacesUtils.microsummaries - .getMicrosummaries(this._uri, -1); + this._microsummaries = PlacesUIUtils.microsummaries + .getMicrosummaries(this._uri, -1); } catch(ex) { // getMicrosummaries will throw an exception in at least two cases: @@ -346,8 +346,8 @@ var gEditItemOverlay = { var microsummary = enumerator.getNext() .QueryInterface(Ci.nsIMicrosummary); var menuItem = this._createMicrosummaryMenuItem(microsummary); - if (PlacesUtils.microsummaries - .isMicrosummary(this._itemId, microsummary)) + if (PlacesUIUtils.microsummaries + .isMicrosummary(this._itemId, microsummary)) itemToSelect = menuItem; menupopup.appendChild(menuItem); @@ -449,12 +449,12 @@ var gEditItemOverlay = { } if (tagsToAdd.length > 0) { - var tagTxn = PlacesUtils.ptm.tagURI(this._uri, tagsToAdd); - PlacesUtils.ptm.doTransaction(tagTxn); + var tagTxn = PlacesUIUtils.ptm.tagURI(this._uri, tagsToAdd); + PlacesUIUtils.ptm.doTransaction(tagTxn); } if (tagsToRemove.length > 0) { - var untagTxn = PlacesUtils.ptm.untagURI(this._uri, tagsToRemove); - PlacesUtils.ptm.doTransaction(untagTxn); + var untagTxn = PlacesUIUtils.ptm.untagURI(this._uri, tagsToRemove); + PlacesUIUtils.ptm.doTransaction(untagTxn); } } }, @@ -470,12 +470,12 @@ var gEditItemOverlay = { var namePicker = this._element("namePicker") var txns = []; - const ptm = PlacesUtils.ptm; + const ptm = PlacesUIUtils.ptm; // Here we update either the item title or its cached static title var newTitle = this._element("userEnteredName").label; if (this._getItemStaticTitle() != newTitle) { - if (PlacesUtils.microsummaries.hasMicrosummary(this._itemId)) { + if (PlacesUIUtils.microsummaries.hasMicrosummary(this._itemId)) { // Note: this implicitly also takes care of the microsummary->static // title case, the removeMicorosummary method in the service will set // the item-title to the value of this annotation. @@ -496,10 +496,10 @@ var gEditItemOverlay = { // bookmark previously had one, or the user selected a microsummary which // is not the one the bookmark previously had if ((newMicrosummary == null && - PlacesUtils.microsummaries.hasMicrosummary(this._itemId)) || + PlacesUIUtils.microsummaries.hasMicrosummary(this._itemId)) || (newMicrosummary != null && - !PlacesUtils.microsummaries - .isMicrosummary(this._itemId, newMicrosummary))) { + !PlacesUIUtils.microsummaries + .isMicrosummary(this._itemId, newMicrosummary))) { txns.push(ptm.editBookmarkMicrosummary(this._itemId, newMicrosummary)); } @@ -510,67 +510,67 @@ var gEditItemOverlay = { onDescriptionFieldBlur: function EIO_onDescriptionFieldInput() { var description = this._element("descriptionField").value; if (description != PlacesUtils.getItemDescription(this._itemId)) { - var txn = PlacesUtils.ptm - .editItemDescription(this._itemId, description); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm + .editItemDescription(this._itemId, description); + PlacesUIUtils.ptm.doTransaction(txn); } }, onLocationFieldBlur: function EIO_onLocationFieldBlur() { var uri; try { - uri = PlacesUtils.createFixedURI(this._element("locationField").value); + uri = PlacesUIUtils.createFixedURI(this._element("locationField").value); } catch(ex) { return; } if (!this._uri.equals(uri)) { - var txn = PlacesUtils.ptm.editBookmarkURI(this._itemId, uri); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.editBookmarkURI(this._itemId, uri); + PlacesUIUtils.ptm.doTransaction(txn); } }, onKeywordFieldBlur: function EIO_onKeywordFieldBlur() { var keyword = this._element("keywordField").value; if (keyword != PlacesUtils.bookmarks.getKeywordForBookmark(this._itemId)) { - var txn = PlacesUtils.ptm.editBookmarkKeyword(this._itemId, keyword); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.editBookmarkKeyword(this._itemId, keyword); + PlacesUIUtils.ptm.doTransaction(txn); } }, onFeedLocationFieldBlur: function EIO_onFeedLocationFieldBlur() { var uri; try { - uri = PlacesUtils.createFixedURI(this._element("feedLocationField").value); + uri = PlacesUIUtils.createFixedURI(this._element("feedLocationField").value); } catch(ex) { return; } var currentFeedURI = PlacesUtils.livemarks.getFeedURI(this._itemId); if (!currentFeedURI.equals(uri)) { - var txn = PlacesUtils.ptm.editLivemarkFeedURI(this._itemId, uri); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.editLivemarkFeedURI(this._itemId, uri); + PlacesUIUtils.ptm.doTransaction(txn); } }, onSiteLocationFieldBlur: function EIO_onSiteLocationFieldBlur() { var uri = null; try { - uri = PlacesUtils.createFixedURI(this._element("siteLocationField").value); + uri = PlacesUIUtils.createFixedURI(this._element("siteLocationField").value); } catch(ex) { } var currentSiteURI = PlacesUtils.livemarks.getSiteURI(this._itemId); if (!uri || !currentSiteURI.equals(uri)) { - var txn = PlacesUtils.ptm.editLivemarkSiteURI(this._itemId, uri); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.editLivemarkSiteURI(this._itemId, uri); + PlacesUIUtils.ptm.doTransaction(txn); } }, onLoadInSidebarCheckboxCommand: function EIO_onLoadInSidebarCheckboxCommand() { var loadInSidebarChecked = this._element("loadInSidebarCheckbox").checked; - var txn = PlacesUtils.ptm.setLoadInSidebar(this._itemId, - loadInSidebarChecked); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.setLoadInSidebar(this._itemId, + loadInSidebarChecked); + PlacesUIUtils.ptm.doTransaction(txn); }, toggleFolderTreeVisibility: function EIO_toggleFolderTreeVisibility() { @@ -591,7 +591,7 @@ var gEditItemOverlay = { if (!this._folderTree.place) { const FOLDER_TREE_PLACE_URI = "place:excludeItems=1&excludeQueries=1&excludeReadOnlyFolders=1&folder=" + - window.top.PlacesUtils.allBookmarksFolderId; + window.top.PlacesUIUtils.allBookmarksFolderId; this._folderTree.place = FOLDER_TREE_PLACE_URI; } @@ -651,8 +651,8 @@ var gEditItemOverlay = { // Move the item var container = this._getFolderIdFromMenuList(); if (PlacesUtils.bookmarks.getFolderIdForItem(this._itemId) != container) { - var txn = PlacesUtils.ptm.moveItem(this._itemId, container, -1); - PlacesUtils.ptm.doTransaction(txn); + var txn = PlacesUIUtils.ptm.moveItem(this._itemId, container, -1); + PlacesUIUtils.ptm.doTransaction(txn); // Mark the containing folder as recently-used if it isn't in the // static list diff --git a/browser/components/places/content/history-panel.js b/browser/components/places/content/history-panel.js index cd52ec41c10..e83a049924b 100644 --- a/browser/components/places/content/history-panel.js +++ b/browser/components/places/content/history-panel.js @@ -104,7 +104,7 @@ function historyAddBookmarks() // or if the selected item is not a URI node var node = gHistoryTree.selectedNode; if (node && PlacesUtils.nodeIsURI(node)) - PlacesUtils.showMinimalAddBookmarkUI(PlacesUtils._uri(node.uri), node.title); + PlacesUIUtils.showMinimalAddBookmarkUI(PlacesUtils._uri(node.uri), node.title); } function searchHistory(aInput) diff --git a/browser/components/places/content/menu.xml b/browser/components/places/content/menu.xml index e824d538abe..29d1477d0e1 100755 --- a/browser/components/places/content/menu.xml +++ b/browser/components/places/content/menu.xml @@ -215,7 +215,7 @@ @@ -601,7 +601,7 @@ + oncommand="PlacesOrganizer.onRestoreBookmarksFromFile();"/>