Bug 1094812 - Remove now unused PlacesTransactions.RemoveBookmarksForUrls. r?mak draft
authorMark Banner <standard8@mozilla.com>
Mon, 31 Jul 2017 16:26:21 +0100
changeset 619632 94311c05c44cac14f425bdd3f73269fc8d491572
parent 619631 c34b3b68f0ac2dcfd4609b698f216710e3f139df
child 640463 524d7bcb0f08422849837be83fb047b40039552e
push id71750
push userbmo:standard8@mozilla.com
push dateWed, 02 Aug 2017 10:27:24 +0000
reviewersmak
bugs1094812
milestone57.0a1
Bug 1094812 - Remove now unused PlacesTransactions.RemoveBookmarksForUrls. r?mak MozReview-Commit-ID: HFAQCIbbT5E
toolkit/components/places/PlacesTransactions.jsm
toolkit/components/places/tests/unit/test_async_transactions.js
--- a/toolkit/components/places/PlacesTransactions.jsm
+++ b/toolkit/components/places/PlacesTransactions.jsm
@@ -1472,35 +1472,16 @@ PT.Remove.prototype = {
         await createItemsFromBookmarksTree(info, true);
       }
     };
     this.redo = removeThem;
   }
 };
 
 /**
- * Transactions for removing all bookmarks for one or more urls.
- *
- * Required Input Properties: urls.
- */
-PT.RemoveBookmarksForUrls = DefineTransaction(["urls"]);
-PT.RemoveBookmarksForUrls.prototype = {
-  async execute({ urls }) {
-    let guids = [];
-    for (let url of urls) {
-      await PlacesUtils.bookmarks.fetch({ url }, b => guids.push(b.guid));
-    }
-    let removeTxn = TransactionsHistory.getRawTransaction(PT.Remove(guids));
-    await removeTxn.execute();
-    this.undo = removeTxn.undo.bind(removeTxn);
-    this.redo = removeTxn.redo.bind(removeTxn);
-  }
-};
-
-/**
  * Transaction for tagging urls.
  *
  * Required Input Properties: urls, tags.
  */
 PT.Tag = DefineTransaction(["urls", "tags"]);
 PT.Tag.prototype = {
   async execute({ urls, tags }) {
     let onUndo = [], onRedo = [];
--- a/toolkit/components/places/tests/unit/test_async_transactions.js
+++ b/toolkit/components/places/tests/unit/test_async_transactions.js
@@ -1684,41 +1684,8 @@ add_task(async function test_remove_mult
   // Redo remove.
   await PT.redo();
   await ensureNonExistent(...guids);
 
   // Cleanup
   await PT.clearTransactionsHistory();
   observer.reset();
 });
-
-add_task(async function test_remove_bookmarks_for_urls() {
-  let urls = [new URL("http://test.url.1"), new URL("http://test.url.2")];
-  let guids = [];
-  await PT.batch(async function() {
-    for (let url of urls) {
-      for (let title of ["test title a", "test title b"]) {
-        let txn = PT.NewBookmark({ url, title, parentGuid: rootGuid });
-        guids.push(await txn.transact());
-      }
-    }
-  });
-
-  let originalInfos = [];
-  for (let guid of guids) {
-    originalInfos.push(await PlacesUtils.promiseBookmarksTree(guid));
-  }
-
-  await PT.RemoveBookmarksForUrls(urls).transact();
-  await ensureNonExistent(...guids);
-  await PT.undo();
-  await ensureBookmarksTreeRestoredCorrectly(...originalInfos);
-  await PT.redo();
-  await ensureNonExistent(...guids);
-  await PT.undo();
-  await ensureBookmarksTreeRestoredCorrectly(...originalInfos);
-
-  // Cleanup.
-  await PT.redo();
-  await ensureNonExistent(...guids);
-  await PT.clearTransactionsHistory();
-  observer.reset();
-});