|
@@ -0,0 +1,801 @@
|
|
|
|
+# HG changeset patch
|
|
|
|
+# User Marco Bonardo <mbonardo@mozilla.com>
|
|
|
|
+# Date 1507127626 -7200
|
|
|
|
+# Node ID 34e534c39b37775587ab03605f32d1aa7d67df61
|
|
|
|
+# Parent 28947ae84de43dbdd45b50a6e1930a6d4353192f
|
|
|
|
+Bug 1405687 - Remove some deprecated code from Places related code. r=standard8
|
|
|
|
+
|
|
|
|
+MozReview-Commit-ID: 411z07otlfN
|
|
|
|
+
|
|
|
|
+diff --git a/browser/base/content/browser.css b/browser/base/content/browser.css
|
|
|
|
+--- a/browser/base/content/browser.css
|
|
|
|
++++ b/browser/base/content/browser.css
|
|
|
|
+@@ -515,20 +515,16 @@ toolbar:not(#TabsToolbar) > #personal-bo
|
|
|
|
+
|
|
|
|
+ :root[lwthemefooter=true] #browser-bottombox:-moz-lwtheme {
|
|
|
|
+ background-repeat: no-repeat;
|
|
|
|
+ background-position: bottom left;
|
|
|
|
+ background-color: var(--lwt-accent-color);
|
|
|
|
+ background-image: var(--lwt-footer-image);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+-.menuitem-iconic-tooltip {
|
|
|
|
+- -moz-binding: url("chrome://browser/content/urlbarBindings.xml#menuitem-iconic-tooltip");
|
|
|
|
+-}
|
|
|
|
+-
|
|
|
|
+ /* Hide menu elements intended for keyboard access support */
|
|
|
|
+ #main-menubar[openedwithkey=false] .show-only-for-keyboard {
|
|
|
|
+ display: none;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /* ::::: location bar & search bar ::::: */
|
|
|
|
+
|
|
|
|
+ #urlbar-container {
|
|
|
|
+diff --git a/browser/components/places/PlacesUIUtils.jsm b/browser/components/places/PlacesUIUtils.jsm
|
|
|
|
+--- a/browser/components/places/PlacesUIUtils.jsm
|
|
|
|
++++ b/browser/components/places/PlacesUIUtils.jsm
|
|
|
|
+@@ -4,36 +4,32 @@
|
|
|
|
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
+
|
|
|
|
+ var EXPORTED_SYMBOLS = ["PlacesUIUtils"];
|
|
|
|
+
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/Timer.jsm");
|
|
|
|
+
|
|
|
|
+-ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "PluralForm",
|
|
|
|
+- "resource://gre/modules/PluralForm.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "PrivateBrowsingUtils",
|
|
|
|
+- "resource://gre/modules/PrivateBrowsingUtils.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "NetUtil",
|
|
|
|
+- "resource://gre/modules/NetUtil.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "RecentWindow",
|
|
|
|
+- "resource:///modules/RecentWindow.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "PromiseUtils",
|
|
|
|
+- "resource://gre/modules/PromiseUtils.jsm");
|
|
|
|
+-
|
|
|
|
+-// PlacesUtils exposes multiple symbols, so we can't use defineLazyModuleGetter.
|
|
|
|
++// PlacesUtils exposes multiple symbols, so we can't use defineLazyModuleGetter
|
|
|
|
++// until we remove legacy transactions (Bug 1131491).
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
|
|
|
|
+
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "PlacesTransactions",
|
|
|
|
+- "resource://gre/modules/PlacesTransactions.jsm");
|
|
|
|
++XPCOMUtils.defineLazyModuleGetters(this, {
|
|
|
|
++ PluralForm: "resource://gre/modules/PluralForm.jsm",
|
|
|
|
++ PrivateBrowsingUtils: "resource://gre/modules/PrivateBrowsingUtils.jsm",
|
|
|
|
++ RecentWindow: "resource:///modules/RecentWindow.jsm",
|
|
|
|
++ PromiseUtils: "resource://gre/modules/PromiseUtils.jsm",
|
|
|
|
++ PlacesTransactions: "resource://gre/modules/PlacesTransactions.jsm",
|
|
|
|
++ Weave: "resource://services-sync/main.js",
|
|
|
|
++});
|
|
|
|
+
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "Weave",
|
|
|
|
+- "resource://services-sync/main.js");
|
|
|
|
++XPCOMUtils.defineLazyGetter(this, "bundle", function() {
|
|
|
|
++ return Services.strings.createBundle("chrome://browser/locale/places/places.properties");
|
|
|
|
++});
|
|
|
|
+
|
|
|
|
+ const gInContentProcess = Services.appinfo.processType == Ci.nsIXULRuntime.PROCESS_TYPE_CONTENT;
|
|
|
|
+ const FAVICON_REQUEST_TIMEOUT = 60 * 1000;
|
|
|
|
+ // Map from windows to arrays of data about pending favicon loads.
|
|
|
|
+ let gFaviconLoadDataMap = new Map();
|
|
|
|
+
|
|
|
|
+ const ITEM_CHANGED_BATCH_NOTIFICATION_THRESHOLD = 10;
|
|
|
|
+
|
|
|
|
+@@ -52,18 +48,16 @@ function IsLivemark(aItemId) {
|
|
|
|
+ const LIVEMARK_ANNO = PlacesUtils.LMANNO_FEEDURI;
|
|
|
|
+
|
|
|
|
+ let idsVec = PlacesUtils.annotations.getItemsWithAnnotation(LIVEMARK_ANNO);
|
|
|
|
+ self.ids = new Set(idsVec);
|
|
|
|
+
|
|
|
|
+ let obs = Object.freeze({
|
|
|
|
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsINavBookmarksObserver]),
|
|
|
|
+
|
|
|
|
+- // Ci.nsINavBookmarkObserver items.
|
|
|
|
+-
|
|
|
|
+ onItemChanged(itemId, property, isAnnoProperty, newValue, lastModified,
|
|
|
|
+ itemType, parentId, guid) {
|
|
|
|
+ if (isAnnoProperty && property == LIVEMARK_ANNO) {
|
|
|
|
+ self.ids.add(itemId);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ onItemRemoved(itemId) {
|
|
|
|
+@@ -75,17 +69,17 @@ function IsLivemark(aItemId) {
|
|
|
|
+ onItemAdded() {},
|
|
|
|
+ onBeginUpdateBatch() {},
|
|
|
|
+ onEndUpdateBatch() {},
|
|
|
|
+ onItemVisited() {},
|
|
|
|
+ onItemMoved() {},
|
|
|
|
+ onPageAnnotationSet() { },
|
|
|
|
+ onPageAnnotationRemoved() { },
|
|
|
|
+ skipDescendantsOnItemRemoval: false,
|
|
|
|
+- skipTags: false,
|
|
|
|
++ skipTags: true,
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ PlacesUtils.bookmarks.addObserver(obs);
|
|
|
|
+ PlacesUtils.registerShutdownFunction(() => {
|
|
|
|
+ PlacesUtils.bookmarks.removeObserver(obs);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+ return self.ids.has(aItemId);
|
|
|
|
+@@ -273,17 +267,17 @@ var PlacesUIUtils = {
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Makes a URI from a spec, and do fixup
|
|
|
|
+ * @param aSpec
|
|
|
|
+ * The string spec of the URI
|
|
|
|
+ * @return A URI object for the spec.
|
|
|
|
+ */
|
|
|
|
+ createFixedURI: function PUIU_createFixedURI(aSpec) {
|
|
|
|
+- return URIFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
|
|
|
++ return Services.uriFixup.createFixupURI(aSpec, Ci.nsIURIFixup.FIXUP_FLAG_NONE);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ getFormattedString: function PUIU_getFormattedString(key, params) {
|
|
|
|
+ return bundle.formatStringFromName(key, params, params.length);
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Get a localized plural string for the specified key name and numeric value
|
|
|
|
+@@ -429,17 +423,17 @@ var PlacesUIUtils = {
|
|
|
|
+ if (aContainer == PlacesUtils.tagsFolderId) { // Copying into a tag folder.
|
|
|
|
+ let transactions = [];
|
|
|
|
+ if (!aData.livemark && aData.type == PlacesUtils.TYPE_X_MOZ_PLACE_CONTAINER) {
|
|
|
|
+ let {root} = PlacesUtils.getFolderContents(aData.id, false, false);
|
|
|
|
+ let urls = PlacesUtils.getURLsForContainerNode(root);
|
|
|
|
+ root.containerOpen = false;
|
|
|
|
+ for (let { uri } of urls) {
|
|
|
|
+ transactions.push(
|
|
|
|
+- new PlacesTagURITransaction(NetUtil.newURI(uri), [aData.title])
|
|
|
|
++ new PlacesTagURITransaction(Services.io.newURI(uri), [aData.title])
|
|
|
|
+ );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ return new PlacesAggregatedTransaction("addTags", transactions);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (aData.livemark && aData.annos) { // Copying a livemark.
|
|
|
|
+ return this._getLivemarkCopyTransaction(aData, aContainer, aIndex);
|
|
|
|
+@@ -671,20 +665,16 @@ var PlacesUIUtils = {
|
|
|
|
+ topUndoEntry != PlacesTransactions.topUndoEntry) {
|
|
|
|
+ PlacesTransactions.undo().catch(Cu.reportError);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return performed;
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+- _getTopBrowserWin: function PUIU__getTopBrowserWin() {
|
|
|
|
+- return RecentWindow.getMostRecentBrowserWindow();
|
|
|
|
+- },
|
|
|
|
+-
|
|
|
|
+ /**
|
|
|
|
+ * set and fetch a favicon. Can only be used from the parent process.
|
|
|
|
+ * @param browser {Browser} The XUL browser element for which we're fetching a favicon.
|
|
|
|
+ * @param principal {Principal} The loading principal to use for the fetch.
|
|
|
|
+ * @param uri {URI} The URI to fetch.
|
|
|
|
+ */
|
|
|
|
+ loadFavicon(browser, principal, uri, requestContextID) {
|
|
|
|
+ if (gInContentProcess) {
|
|
|
|
+@@ -952,17 +942,17 @@ var PlacesUIUtils = {
|
|
|
|
+ if (!aItemsToOpen.length)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ // Prefer the caller window if it's a browser window, otherwise use
|
|
|
|
+ // the top browser window.
|
|
|
|
+ var browserWindow = null;
|
|
|
|
+ browserWindow =
|
|
|
|
+ aWindow && aWindow.document.documentElement.getAttribute("windowtype") == "navigator:browser" ?
|
|
|
|
+- aWindow : this._getTopBrowserWin();
|
|
|
|
++ aWindow : RecentWindow.getMostRecentBrowserWindow();
|
|
|
|
+
|
|
|
|
+ var urls = [];
|
|
|
|
+ let skipMarking = browserWindow && PrivateBrowsingUtils.isWindowPrivate(browserWindow);
|
|
|
|
+ for (let item of aItemsToOpen) {
|
|
|
|
+ urls.push(item.uri);
|
|
|
|
+ if (skipMarking) {
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+@@ -1086,17 +1076,17 @@ var PlacesUIUtils = {
|
|
|
|
+ this.markPageAsTyped(aNode.uri);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Check whether the node is a bookmark which should be opened as
|
|
|
|
+ // a web panel
|
|
|
|
+ if (aWhere == "current" && isBookmark) {
|
|
|
|
+ if (PlacesUtils.annotations
|
|
|
|
+ .itemHasAnnotation(aNode.itemId, this.LOAD_IN_SIDEBAR_ANNO)) {
|
|
|
|
+- let browserWin = this._getTopBrowserWin();
|
|
|
|
++ let browserWin = RecentWindow.getMostRecentBrowserWindow();
|
|
|
|
+ if (browserWin) {
|
|
|
|
+ browserWin.openWebPanel(aNode.title, aNode.uri);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ aWindow.openUILinkIn(aNode.uri, aWhere, {
|
|
|
|
+@@ -1581,206 +1571,19 @@ PlacesUIUtils.PLACES_FLAVORS = [PlacesUt
|
|
|
|
+
|
|
|
|
+ PlacesUIUtils.URI_FLAVORS = [PlacesUtils.TYPE_X_MOZ_URL,
|
|
|
|
+ TAB_DROP_TYPE,
|
|
|
|
+ PlacesUtils.TYPE_UNICODE],
|
|
|
|
+
|
|
|
|
+ PlacesUIUtils.SUPPORTED_FLAVORS = [...PlacesUIUtils.PLACES_FLAVORS,
|
|
|
|
+ ...PlacesUIUtils.URI_FLAVORS];
|
|
|
|
+
|
|
|
|
+-XPCOMUtils.defineLazyServiceGetter(PlacesUIUtils, "RDF",
|
|
|
|
+- "@mozilla.org/rdf/rdf-service;1",
|
|
|
|
+- "nsIRDFService");
|
|
|
|
+-
|
|
|
|
+ XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ellipsis", function() {
|
|
|
|
+ return Services.prefs.getComplexValue("intl.ellipsis",
|
|
|
|
+ Ci.nsIPrefLocalizedString).data;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+-XPCOMUtils.defineLazyGetter(PlacesUIUtils, "useAsyncTransactions", function() {
|
|
|
|
+- try {
|
|
|
|
+- return Services.prefs.getBoolPref("browser.places.useAsyncTransactions");
|
|
|
|
+- } catch (ex) { }
|
|
|
|
+- return false;
|
|
|
|
+-});
|
|
|
|
+-
|
|
|
|
++XPCOMUtils.defineLazyPreferenceGetter(PlacesUIUtils, "useAsyncTransactions",
|
|
|
|
++ "browser.places.useAsyncTransactions", false);
|
|
|
|
+ XPCOMUtils.defineLazyPreferenceGetter(PlacesUIUtils, "loadBookmarksInBackground",
|
|
|
|
+ PREF_LOAD_BOOKMARKS_IN_BACKGROUND, false);
|
|
|
|
+ XPCOMUtils.defineLazyPreferenceGetter(PlacesUIUtils, "loadBookmarksInTabs",
|
|
|
|
+ PREF_LOAD_BOOKMARKS_IN_TABS, false);
|
|
|
|
+-
|
|
|
|
+-XPCOMUtils.defineLazyServiceGetter(this, "URIFixup",
|
|
|
|
+- "@mozilla.org/docshell/urifixup;1",
|
|
|
|
+- "nsIURIFixup");
|
|
|
|
+-
|
|
|
|
+-XPCOMUtils.defineLazyGetter(this, "bundle", function() {
|
|
|
|
+- const PLACES_STRING_BUNDLE_URI =
|
|
|
|
+- "chrome://browser/locale/places/places.properties";
|
|
|
|
+- return Cc["@mozilla.org/intl/stringbundle;1"].
|
|
|
|
+- getService(Ci.nsIStringBundleService).
|
|
|
|
+- createBundle(PLACES_STRING_BUNDLE_URI);
|
|
|
|
+-});
|
|
|
|
+-
|
|
|
|
+-/**
|
|
|
|
+- * This is a compatibility shim for old PUIU.ptm users.
|
|
|
|
+- *
|
|
|
|
+- * If you're looking for transactions and writing new code using them, directly
|
|
|
|
+- * use the transactions objects exported by the PlacesUtils.jsm module.
|
|
|
|
+- *
|
|
|
|
+- * This object will be removed once enough users are converted to the new API.
|
|
|
|
+- */
|
|
|
|
+-XPCOMUtils.defineLazyGetter(PlacesUIUtils, "ptm", function() {
|
|
|
|
+- // Ensure PlacesUtils is imported in scope.
|
|
|
|
+- PlacesUtils;
|
|
|
|
+-
|
|
|
|
+- return {
|
|
|
|
+- aggregateTransactions: (aName, aTransactions) =>
|
|
|
|
+- new PlacesAggregatedTransaction(aName, aTransactions),
|
|
|
|
+-
|
|
|
|
+- createFolder: (aName, aContainer, aIndex, aAnnotations,
|
|
|
|
+- aChildItemsTransactions) =>
|
|
|
|
+- new PlacesCreateFolderTransaction(aName, aContainer, aIndex, aAnnotations,
|
|
|
|
+- aChildItemsTransactions),
|
|
|
|
+-
|
|
|
|
+- createItem: (aURI, aContainer, aIndex, aTitle, aKeyword,
|
|
|
|
+- aAnnotations, aChildTransactions) =>
|
|
|
|
+- new PlacesCreateBookmarkTransaction(aURI, aContainer, aIndex, aTitle,
|
|
|
|
+- aKeyword, aAnnotations,
|
|
|
|
+- aChildTransactions),
|
|
|
|
+-
|
|
|
|
+- createSeparator: (aContainer, aIndex) =>
|
|
|
|
+- new PlacesCreateSeparatorTransaction(aContainer, aIndex),
|
|
|
|
+-
|
|
|
|
+- createLivemark: (aFeedURI, aSiteURI, aName, aContainer, aIndex,
|
|
|
|
+- aAnnotations) =>
|
|
|
|
+- new PlacesCreateLivemarkTransaction(aFeedURI, aSiteURI, aName, aContainer,
|
|
|
|
+- aIndex, aAnnotations),
|
|
|
|
+-
|
|
|
|
+- moveItem: (aItemId, aNewContainer, aNewIndex) =>
|
|
|
|
+- new PlacesMoveItemTransaction(aItemId, aNewContainer, aNewIndex),
|
|
|
|
+-
|
|
|
|
+- removeItem: (aItemId) =>
|
|
|
|
+- new PlacesRemoveItemTransaction(aItemId),
|
|
|
|
+-
|
|
|
|
+- editItemTitle: (aItemId, aNewTitle) =>
|
|
|
|
+- new PlacesEditItemTitleTransaction(aItemId, aNewTitle),
|
|
|
|
+-
|
|
|
|
+- editBookmarkURI: (aItemId, aNewURI) =>
|
|
|
|
+- new PlacesEditBookmarkURITransaction(aItemId, aNewURI),
|
|
|
|
+-
|
|
|
|
+- setItemAnnotation: (aItemId, aAnnotationObject) =>
|
|
|
|
+- new PlacesSetItemAnnotationTransaction(aItemId, aAnnotationObject),
|
|
|
|
+-
|
|
|
|
+- setPageAnnotation: (aURI, aAnnotationObject) =>
|
|
|
|
+- new PlacesSetPageAnnotationTransaction(aURI, aAnnotationObject),
|
|
|
|
+-
|
|
|
|
+- editBookmarkKeyword: (aItemId, aNewKeyword) =>
|
|
|
|
+- new PlacesEditBookmarkKeywordTransaction(aItemId, aNewKeyword),
|
|
|
|
+-
|
|
|
|
+- editLivemarkSiteURI: (aLivemarkId, aSiteURI) =>
|
|
|
|
+- new PlacesEditLivemarkSiteURITransaction(aLivemarkId, aSiteURI),
|
|
|
|
+-
|
|
|
|
+- editLivemarkFeedURI: (aLivemarkId, aFeedURI) =>
|
|
|
|
+- new PlacesEditLivemarkFeedURITransaction(aLivemarkId, aFeedURI),
|
|
|
|
+-
|
|
|
|
+- editItemDateAdded: (aItemId, aNewDateAdded) =>
|
|
|
|
+- new PlacesEditItemDateAddedTransaction(aItemId, aNewDateAdded),
|
|
|
|
+-
|
|
|
|
+- editItemLastModified: (aItemId, aNewLastModified) =>
|
|
|
|
+- new PlacesEditItemLastModifiedTransaction(aItemId, aNewLastModified),
|
|
|
|
+-
|
|
|
|
+- sortFolderByName: (aFolderId) =>
|
|
|
|
+- new PlacesSortFolderByNameTransaction(aFolderId),
|
|
|
|
+-
|
|
|
|
+- tagURI: (aURI, aTags) =>
|
|
|
|
+- new PlacesTagURITransaction(aURI, aTags),
|
|
|
|
+-
|
|
|
|
+- untagURI: (aURI, aTags) =>
|
|
|
|
+- new PlacesUntagURITransaction(aURI, aTags),
|
|
|
|
+-
|
|
|
|
+- /**
|
|
|
|
+- * Transaction for setting/unsetting Load-in-sidebar annotation.
|
|
|
|
+- *
|
|
|
|
+- * @param aBookmarkId
|
|
|
|
+- * id of the bookmark where to set Load-in-sidebar annotation.
|
|
|
|
+- * @param aLoadInSidebar
|
|
|
|
+- * boolean value.
|
|
|
|
+- * @return nsITransaction object.
|
|
|
|
+- */
|
|
|
|
+- setLoadInSidebar(aItemId, aLoadInSidebar) {
|
|
|
|
+- let annoObj = { name: PlacesUIUtils.LOAD_IN_SIDEBAR_ANNO,
|
|
|
|
+- type: Ci.nsIAnnotationService.TYPE_INT32,
|
|
|
|
+- flags: 0,
|
|
|
|
+- value: aLoadInSidebar,
|
|
|
|
+- expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
|
|
|
+- return new PlacesSetItemAnnotationTransaction(aItemId, annoObj);
|
|
|
|
+- },
|
|
|
|
+-
|
|
|
|
+- /**
|
|
|
|
+- * Transaction for editing the description of a bookmark or a folder.
|
|
|
|
+- *
|
|
|
|
+- * @param aItemId
|
|
|
|
+- * id of the item to edit.
|
|
|
|
+- * @param aDescription
|
|
|
|
+- * new description.
|
|
|
|
+- * @return nsITransaction object.
|
|
|
|
+- */
|
|
|
|
+- editItemDescription(aItemId, aDescription) {
|
|
|
|
+- let annoObj = { name: PlacesUIUtils.DESCRIPTION_ANNO,
|
|
|
|
+- type: Ci.nsIAnnotationService.TYPE_STRING,
|
|
|
|
+- flags: 0,
|
|
|
|
+- value: aDescription,
|
|
|
|
+- expires: Ci.nsIAnnotationService.EXPIRE_NEVER };
|
|
|
|
+- return new PlacesSetItemAnnotationTransaction(aItemId, annoObj);
|
|
|
|
+- },
|
|
|
|
+-
|
|
|
|
+- // nsITransactionManager forwarders.
|
|
|
|
+-
|
|
|
|
+- beginBatch: () =>
|
|
|
|
+- PlacesUtils.transactionManager.beginBatch(null),
|
|
|
|
+-
|
|
|
|
+- endBatch: () =>
|
|
|
|
+- PlacesUtils.transactionManager.endBatch(false),
|
|
|
|
+-
|
|
|
|
+- doTransaction: (txn) =>
|
|
|
|
+- PlacesUtils.transactionManager.doTransaction(txn),
|
|
|
|
+-
|
|
|
|
+- undoTransaction: () =>
|
|
|
|
+- PlacesUtils.transactionManager.undoTransaction(),
|
|
|
|
+-
|
|
|
|
+- redoTransaction: () =>
|
|
|
|
+- PlacesUtils.transactionManager.redoTransaction(),
|
|
|
|
+-
|
|
|
|
+- get numberOfUndoItems() {
|
|
|
|
+- return PlacesUtils.transactionManager.numberOfUndoItems;
|
|
|
|
+- },
|
|
|
|
+- get numberOfRedoItems() {
|
|
|
|
+- return PlacesUtils.transactionManager.numberOfRedoItems;
|
|
|
|
+- },
|
|
|
|
+- get maxTransactionCount() {
|
|
|
|
+- return PlacesUtils.transactionManager.maxTransactionCount;
|
|
|
|
+- },
|
|
|
|
+- set maxTransactionCount(val) {
|
|
|
|
+- PlacesUtils.transactionManager.maxTransactionCount = val;
|
|
|
|
+- },
|
|
|
|
+-
|
|
|
|
+- clear: () =>
|
|
|
|
+- PlacesUtils.transactionManager.clear(),
|
|
|
|
+-
|
|
|
|
+- peekUndoStack: () =>
|
|
|
|
+- PlacesUtils.transactionManager.peekUndoStack(),
|
|
|
|
+-
|
|
|
|
+- peekRedoStack: () =>
|
|
|
|
+- PlacesUtils.transactionManager.peekRedoStack(),
|
|
|
|
+-
|
|
|
|
+- getUndoStack: () =>
|
|
|
|
+- PlacesUtils.transactionManager.getUndoStack(),
|
|
|
|
+-
|
|
|
|
+- getRedoStack: () =>
|
|
|
|
+- PlacesUtils.transactionManager.getRedoStack(),
|
|
|
|
+-
|
|
|
|
+- AddListener: (aListener) =>
|
|
|
|
+- PlacesUtils.transactionManager.AddListener(aListener),
|
|
|
|
+-
|
|
|
|
+- RemoveListener: (aListener) =>
|
|
|
|
+- PlacesUtils.transactionManager.RemoveListener(aListener)
|
|
|
|
+- }
|
|
|
|
+-});
|
|
|
|
+diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js
|
|
|
|
+--- a/browser/components/places/content/controller.js
|
|
|
|
++++ b/browser/components/places/content/controller.js
|
|
|
|
+@@ -954,29 +954,29 @@ PlacesController.prototype = {
|
|
|
|
+ * @param [in] aContainerNode
|
|
|
|
+ * The container node to remove.
|
|
|
|
+ *
|
|
|
|
+ * @note history deletes are not undoable.
|
|
|
|
+ */
|
|
|
|
+ _removeHistoryContainer: function PC__removeHistoryContainer(aContainerNode) {
|
|
|
|
+ if (PlacesUtils.nodeIsHost(aContainerNode)) {
|
|
|
|
+ // Site container.
|
|
|
|
+- PlacesUtils.bhistory.removePagesFromHost(aContainerNode.title, true);
|
|
|
|
++ PlacesUtils.history.removePagesFromHost(aContainerNode.title, true);
|
|
|
|
+ } else if (PlacesUtils.nodeIsDay(aContainerNode)) {
|
|
|
|
+ // Day container.
|
|
|
|
+ let query = aContainerNode.getQueries()[0];
|
|
|
|
+ let beginTime = query.beginTime;
|
|
|
|
+ let endTime = query.endTime;
|
|
|
|
+ if (!query || !beginTime || !endTime)
|
|
|
|
+ throw new Error("A valid date container query should exist!");
|
|
|
|
+ // We want to exclude beginTime from the removal because
|
|
|
|
+ // removePagesByTimeframe includes both extremes, while date containers
|
|
|
|
+ // exclude the lower extreme. So, if we would not exclude it, we would
|
|
|
|
+ // end up removing more history than requested.
|
|
|
|
+- PlacesUtils.bhistory.removePagesByTimeframe(beginTime + 1, endTime);
|
|
|
|
++ PlacesUtils.history.removePagesByTimeframe(beginTime + 1, endTime);
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * Removes the selection
|
|
|
|
+ * @param aTxnName
|
|
|
|
+ * A name for the transaction if this is being performed
|
|
|
|
+ * as part of another operation.
|
|
|
|
+diff --git a/browser/components/places/content/editBookmarkOverlay.js b/browser/components/places/content/editBookmarkOverlay.js
|
|
|
|
+--- a/browser/components/places/content/editBookmarkOverlay.js
|
|
|
|
++++ b/browser/components/places/content/editBookmarkOverlay.js
|
|
|
|
+@@ -16,18 +16,17 @@ var gEditItemOverlay = {
|
|
|
|
+ if (!aInitInfo)
|
|
|
|
+ return this._paneInfo = null;
|
|
|
|
+
|
|
|
|
+ if ("uris" in aInitInfo && "node" in aInitInfo)
|
|
|
|
+ throw new Error("ambiguous pane info");
|
|
|
|
+ if (!("uris" in aInitInfo) && !("node" in aInitInfo))
|
|
|
|
+ throw new Error("Neither node nor uris set for pane info");
|
|
|
|
+
|
|
|
|
+- // Once we stop supporting legacy add-ons the code should throw if a node is
|
|
|
|
+- // not passed.
|
|
|
|
++ // We either pass a node or uris.
|
|
|
|
+ let node = "node" in aInitInfo ? aInitInfo.node : null;
|
|
|
|
+
|
|
|
|
+ // Since there's no true UI for folder shortcuts (they show up just as their target
|
|
|
|
+ // folders), when the pane shows for them it's opened in read-only mode, showing the
|
|
|
|
+ // properties of the target folder.
|
|
|
|
+ let itemId = node ? node.itemId : -1;
|
|
|
|
+ let itemGuid = node ? PlacesUtils.getConcreteItemGuid(node) : null;
|
|
|
|
+ let isItem = itemId != -1;
|
|
|
|
+diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm
|
|
|
|
+--- a/toolkit/components/places/PlacesUtils.jsm
|
|
|
|
++++ b/toolkit/components/places/PlacesUtils.jsm
|
|
|
|
+@@ -30,17 +30,16 @@ Cu.importGlobalProperties(["URL"]);
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
|
|
|
|
+
|
|
|
|
+ XPCOMUtils.defineLazyModuleGetters(this, {
|
|
|
|
+ Services: "resource://gre/modules/Services.jsm",
|
|
|
|
+ NetUtil: "resource://gre/modules/NetUtil.jsm",
|
|
|
|
+ OS: "resource://gre/modules/osfile.jsm",
|
|
|
|
+ Sqlite: "resource://gre/modules/Sqlite.jsm",
|
|
|
|
+- Deprecated: "resource://gre/modules/Deprecated.jsm",
|
|
|
|
+ Bookmarks: "resource://gre/modules/Bookmarks.jsm",
|
|
|
|
+ History: "resource://gre/modules/History.jsm",
|
|
|
|
+ AsyncShutdown: "resource://gre/modules/AsyncShutdown.jsm",
|
|
|
|
+ PlacesSyncUtils: "resource://gre/modules/PlacesSyncUtils.jsm",
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // The minimum amount of transactions before starting a batch. Usually we do
|
|
|
|
+ // do incremental updates, a batch will cause views to completely
|
|
|
|
+@@ -1950,20 +1949,16 @@ XPCOMUtils.defineLazyGetter(PlacesUtils,
|
|
|
|
+ }
|
|
|
|
+ }));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ XPCOMUtils.defineLazyServiceGetter(PlacesUtils, "asyncHistory",
|
|
|
|
+ "@mozilla.org/browser/history;1",
|
|
|
|
+ "mozIAsyncHistory");
|
|
|
|
+
|
|
|
|
+-XPCOMUtils.defineLazyGetter(PlacesUtils, "bhistory", function() {
|
|
|
|
+- return PlacesUtils.history;
|
|
|
|
+-});
|
|
|
|
+-
|
|
|
|
+ XPCOMUtils.defineLazyServiceGetter(PlacesUtils, "favicons",
|
|
|
|
+ "@mozilla.org/browser/favicon-service;1",
|
|
|
|
+ "mozIAsyncFavicons");
|
|
|
|
+
|
|
|
|
+ XPCOMUtils.defineLazyServiceGetter(this, "bmsvc",
|
|
|
|
+ "@mozilla.org/browser/nav-bookmarks-service;1",
|
|
|
|
+ "nsINavBookmarksService");
|
|
|
|
+ XPCOMUtils.defineLazyGetter(PlacesUtils, "bookmarks", () => {
|
|
|
|
+diff --git a/toolkit/components/places/nsIBrowserHistory.idl b/toolkit/components/places/nsIBrowserHistory.idl
|
|
|
|
+--- a/toolkit/components/places/nsIBrowserHistory.idl
|
|
|
|
++++ b/toolkit/components/places/nsIBrowserHistory.idl
|
|
|
|
+@@ -9,40 +9,16 @@
|
|
|
|
+
|
|
|
|
+ #include "nsISupports.idl"
|
|
|
|
+ #include "nsIGlobalHistory2.idl"
|
|
|
|
+
|
|
|
|
+ [scriptable, uuid(20d31479-38de-49f4-9300-566d6e834c66)]
|
|
|
|
+ interface nsIBrowserHistory : nsISupports
|
|
|
|
+ {
|
|
|
|
+ /**
|
|
|
|
+- * Removes a page from global history.
|
|
|
|
+- *
|
|
|
|
+- * @note It is preferrable to use this one rather then RemovePages when
|
|
|
|
+- * removing less than 10 pages, since it won't start a full batch
|
|
|
|
+- * operation.
|
|
|
|
+- * @deprecated Use PlacesUtils.history.remove() API instead.
|
|
|
|
+- */
|
|
|
|
+- void removePage(in nsIURI aURI);
|
|
|
|
+-
|
|
|
|
+- /**
|
|
|
|
+- * Removes a list of pages from global history.
|
|
|
|
+- *
|
|
|
|
+- * @param aURIs
|
|
|
|
+- * Array of URIs to be removed.
|
|
|
|
+- * @param aLength
|
|
|
|
+- * Length of the array.
|
|
|
|
+- *
|
|
|
|
+- * @note the removal happens in a batch.
|
|
|
|
+- * @deprecated Use PlacesUtils.history.remove() API instead.
|
|
|
|
+- */
|
|
|
|
+- void removePages([array, size_is(aLength)] in nsIURI aURIs,
|
|
|
|
+- in unsigned long aLength);
|
|
|
|
+-
|
|
|
|
+- /**
|
|
|
|
+ * Removes all global history information about pages for a given host.
|
|
|
|
+ *
|
|
|
|
+ * @param aHost
|
|
|
|
+ * Hostname to be removed.
|
|
|
|
+ * An empty host name means local files and anything else with no
|
|
|
|
+ * hostname. You can also pass in the localized "(local files)"
|
|
|
|
+ * title given to you from a history query to remove all
|
|
|
|
+ * history information from local files.
|
|
|
|
+diff --git a/toolkit/components/places/nsLivemarkService.js b/toolkit/components/places/nsLivemarkService.js
|
|
|
|
+--- a/toolkit/components/places/nsLivemarkService.js
|
|
|
|
++++ b/toolkit/components/places/nsLivemarkService.js
|
|
|
|
+@@ -5,18 +5,16 @@
|
|
|
|
+ // Modules and services.
|
|
|
|
+
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
|
|
+ ChromeUtils.defineModuleGetter(this, "PlacesUtils",
|
|
|
|
+ "resource://gre/modules/PlacesUtils.jsm");
|
|
|
|
+ ChromeUtils.defineModuleGetter(this, "NetUtil",
|
|
|
|
+ "resource://gre/modules/NetUtil.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "Deprecated",
|
|
|
|
+- "resource://gre/modules/Deprecated.jsm");
|
|
|
|
+
|
|
|
|
+ XPCOMUtils.defineLazyGetter(this, "history", function() {
|
|
|
|
+ // Lazily add an history observer when it's actually needed.
|
|
|
|
+ PlacesUtils.history.addObserver(PlacesUtils.livemarks, true);
|
|
|
|
+ return PlacesUtils.history;
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // Constants
|
|
|
|
+diff --git a/toolkit/components/places/nsNavHistory.cpp b/toolkit/components/places/nsNavHistory.cpp
|
|
|
|
+--- a/toolkit/components/places/nsNavHistory.cpp
|
|
|
|
++++ b/toolkit/components/places/nsNavHistory.cpp
|
|
|
|
+@@ -2532,91 +2532,16 @@ nsNavHistory::CleanupPlacesOnVisitsDelet
|
|
|
|
+ nsINavHistoryObserver,
|
|
|
|
+ OnDeleteURI(URIs[i], GUIDs[i], nsINavHistoryObserver::REASON_DELETED));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return NS_OK;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+-// nsNavHistory::RemovePages
|
|
|
|
+-//
|
|
|
|
+-// Removes a bunch of uris from history.
|
|
|
|
+-// Has better performance than RemovePage when deleting a lot of history.
|
|
|
|
+-// We don't do duplicates removal, URIs array should be cleaned-up before.
|
|
|
|
+-
|
|
|
|
+-NS_IMETHODIMP
|
|
|
|
+-nsNavHistory::RemovePages(nsIURI **aURIs, uint32_t aLength)
|
|
|
|
+-{
|
|
|
|
+- PLACES_WARN_DEPRECATED();
|
|
|
|
+- NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
|
|
|
+- NS_ENSURE_ARG(aURIs);
|
|
|
|
+-
|
|
|
|
+- nsresult rv;
|
|
|
|
+- // build a list of place ids to delete
|
|
|
|
+- nsCString deletePlaceIdsQueryString;
|
|
|
|
+- for (uint32_t i = 0; i < aLength; i++) {
|
|
|
|
+- int64_t placeId;
|
|
|
|
+- nsAutoCString guid;
|
|
|
|
+- if (!aURIs[i])
|
|
|
|
+- continue;
|
|
|
|
+- rv = GetIdForPage(aURIs[i], &placeId, guid);
|
|
|
|
+- NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+- if (placeId != 0) {
|
|
|
|
+- if (!deletePlaceIdsQueryString.IsEmpty())
|
|
|
|
+- deletePlaceIdsQueryString.Append(',');
|
|
|
|
+- deletePlaceIdsQueryString.AppendInt(placeId);
|
|
|
|
+- }
|
|
|
|
+- }
|
|
|
|
+-
|
|
|
|
+- UpdateBatchScoper batch(*this); // sends Begin/EndUpdateBatch to observers
|
|
|
|
+-
|
|
|
|
+- rv = RemovePagesInternal(deletePlaceIdsQueryString);
|
|
|
|
+- NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+-
|
|
|
|
+- // Clear the registered embed visits.
|
|
|
|
+- clearEmbedVisits();
|
|
|
|
+-
|
|
|
|
+- return NS_OK;
|
|
|
|
+-}
|
|
|
|
+-
|
|
|
|
+-
|
|
|
|
+-// nsNavHistory::RemovePage
|
|
|
|
+-//
|
|
|
|
+-// Removes all visits and the main history entry for the given URI.
|
|
|
|
+-// Silently fails if we have no knowledge of the page.
|
|
|
|
+-
|
|
|
|
+-NS_IMETHODIMP
|
|
|
|
+-nsNavHistory::RemovePage(nsIURI *aURI)
|
|
|
|
+-{
|
|
|
|
+- PLACES_WARN_DEPRECATED();
|
|
|
|
+- NS_ASSERTION(NS_IsMainThread(), "This can only be called on the main thread");
|
|
|
|
+- NS_ENSURE_ARG(aURI);
|
|
|
|
+-
|
|
|
|
+- // Build a list of place ids to delete.
|
|
|
|
+- int64_t placeId;
|
|
|
|
+- nsAutoCString guid;
|
|
|
|
+- nsresult rv = GetIdForPage(aURI, &placeId, guid);
|
|
|
|
+- NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+- if (placeId == 0) {
|
|
|
|
+- return NS_OK;
|
|
|
|
+- }
|
|
|
|
+- nsAutoCString deletePlaceIdQueryString;
|
|
|
|
+- deletePlaceIdQueryString.AppendInt(placeId);
|
|
|
|
+-
|
|
|
|
+- rv = RemovePagesInternal(deletePlaceIdQueryString);
|
|
|
|
+- NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
+-
|
|
|
|
+- // Clear the registered embed visits.
|
|
|
|
+- clearEmbedVisits();
|
|
|
|
+-
|
|
|
|
+- return NS_OK;
|
|
|
|
+-}
|
|
|
|
+-
|
|
|
|
+-
|
|
|
|
+ // nsNavHistory::RemovePagesFromHost
|
|
|
|
+ //
|
|
|
|
+ // This function will delete all history information about pages from a
|
|
|
|
+ // given host. If aEntireDomain is set, we will also delete pages from
|
|
|
|
+ // sub hosts (so if we are passed in "microsoft.com" we delete
|
|
|
|
+ // "www.microsoft.com", "msdn.microsoft.com", etc.). An empty host name
|
|
|
|
+ // means local files and anything else with no host name. You can also pass
|
|
|
|
+ // in the localized "(local files)" title given to you from a history query.
|
|
|
|
+diff --git a/toolkit/components/places/nsTaggingService.js b/toolkit/components/places/nsTaggingService.js
|
|
|
|
+--- a/toolkit/components/places/nsTaggingService.js
|
|
|
|
++++ b/toolkit/components/places/nsTaggingService.js
|
|
|
|
+@@ -1,18 +1,16 @@
|
|
|
|
+ /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*-
|
|
|
|
+ * This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
+
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/Services.jsm");
|
|
|
|
+ ChromeUtils.import("resource://gre/modules/PlacesUtils.jsm");
|
|
|
|
+-ChromeUtils.defineModuleGetter(this, "Deprecated",
|
|
|
|
+- "resource://gre/modules/Deprecated.jsm");
|
|
|
|
+
|
|
|
|
+ const TOPIC_SHUTDOWN = "places-shutdown";
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The Places Tagging Service
|
|
|
|
+ */
|
|
|
|
+ function TaggingService() {
|
|
|
|
+ // Observe bookmarks changes.
|
|
|
|
+@@ -212,18 +210,18 @@ TaggingService.prototype = {
|
|
|
|
+ aTags = this.getTagsForURI(aURI);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // This also does some input validation.
|
|
|
|
+ let tags = this._convertInputMixedTagsArray(aTags);
|
|
|
|
+
|
|
|
|
+ let isAnyTagNotTrimmed = tags.some(tag => /^\s|\s$/.test(tag.name));
|
|
|
|
+ if (isAnyTagNotTrimmed) {
|
|
|
|
+- Deprecated.warning("At least one tag passed to untagURI was not trimmed",
|
|
|
|
+- "https://bugzilla.mozilla.org/show_bug.cgi?id=967196");
|
|
|
|
++ throw Components.Exception("At least one tag passed to untagURI was not trimmed",
|
|
|
|
++ Cr.NS_ERROR_INVALID_ARG);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (let tag of tags) {
|
|
|
|
+ if (tag.id != -1) {
|
|
|
|
+ // A tag could exist.
|
|
|
|
+ let itemId = this._getItemIdForTaggedURI(aURI, tag.name);
|
|
|
|
+ if (itemId != -1) {
|
|
|
|
+ // There is a tagged item.
|
|
|
|
+@@ -235,18 +233,18 @@ TaggingService.prototype = {
|
|
|
|
+
|
|
|
|
+ // nsITaggingService
|
|
|
|
+ getURIsForTag: function TS_getURIsForTag(aTagName) {
|
|
|
|
+ if (!aTagName || aTagName.length == 0) {
|
|
|
|
+ throw Components.Exception("Invalid tag name", Cr.NS_ERROR_INVALID_ARG);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (/^\s|\s$/.test(aTagName)) {
|
|
|
|
+- Deprecated.warning("Tag passed to getURIsForTag was not trimmed",
|
|
|
|
+- "https://bugzilla.mozilla.org/show_bug.cgi?id=967196");
|
|
|
|
++ throw Components.Exception("Tag passed to getURIsForTag was not trimmed",
|
|
|
|
++ Cr.NS_ERROR_INVALID_ARG);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ let uris = [];
|
|
|
|
+ let tagId = this._getItemIdForTag(aTagName);
|
|
|
|
+ if (tagId == -1)
|
|
|
|
+ return uris;
|
|
|
|
+
|
|
|
|
+ let db = PlacesUtils.history.QueryInterface(Ci.nsPIPlacesDatabase)
|
|
|
|
+diff --git a/toolkit/components/places/tests/unit/test_browserhistory.js b/toolkit/components/places/tests/unit/test_browserhistory.js
|
|
|
|
+--- a/toolkit/components/places/tests/unit/test_browserhistory.js
|
|
|
|
++++ b/toolkit/components/places/tests/unit/test_browserhistory.js
|
|
|
|
+@@ -69,38 +69,38 @@ add_task(async function test_removePages
|
|
|
|
+ uri: NetUtil.newURI(TEST_URI.spec + i),
|
|
|
|
+ visitDate: startDate + i * 1000
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ await PlacesTestUtils.addVisits(visits);
|
|
|
|
+
|
|
|
|
+ // Delete all pages except the first and the last.
|
|
|
|
+- PlacesUtils.bhistory.removePagesByTimeframe(startDate + 1000, startDate + 8000);
|
|
|
|
++ PlacesUtils.history.removePagesByTimeframe(startDate + 1000, startDate + 8000);
|
|
|
|
+
|
|
|
|
+ // Check that we have removed the correct pages.
|
|
|
|
+ for (let i = 0; i < 10; i++) {
|
|
|
|
+ Assert.equal(page_in_database(NetUtil.newURI(TEST_URI.spec + i)) == 0,
|
|
|
|
+ i > 0 && i < 9);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Clear remaining items and check that all pages have been removed.
|
|
|
|
+- PlacesUtils.bhistory.removePagesByTimeframe(startDate, startDate + 9000);
|
|
|
|
++ PlacesUtils.history.removePagesByTimeframe(startDate, startDate + 9000);
|
|
|
|
+ Assert.equal(0, PlacesUtils.history.hasHistoryEntries);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ add_task(async function test_removePagesFromHost() {
|
|
|
|
+ await PlacesTestUtils.addVisits(TEST_URI);
|
|
|
|
+- PlacesUtils.bhistory.removePagesFromHost("mozilla.com", true);
|
|
|
|
++ PlacesUtils.history.removePagesFromHost("mozilla.com", true);
|
|
|
|
+ Assert.equal(0, PlacesUtils.history.hasHistoryEntries);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ add_task(async function test_removePagesFromHost_keepSubdomains() {
|
|
|
|
+ await PlacesTestUtils.addVisits([{ uri: TEST_URI }, { uri: TEST_SUBDOMAIN_URI }]);
|
|
|
|
+- PlacesUtils.bhistory.removePagesFromHost("mozilla.com", false);
|
|
|
|
++ PlacesUtils.history.removePagesFromHost("mozilla.com", false);
|
|
|
|
+ Assert.equal(1, PlacesUtils.history.hasHistoryEntries);
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ add_task(async function test_history_clear() {
|
|
|
|
+ await PlacesTestUtils.clearHistory();
|
|
|
|
+ Assert.equal(0, PlacesUtils.history.hasHistoryEntries);
|
|
|
|
+ });
|
|
|
|
+
|