summaryrefslogtreecommitdiffstats
path: root/browser/components/places
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/places')
-rw-r--r--browser/components/places/Interactions.sys.mjs15
-rw-r--r--browser/components/places/PlacesUIUtils.sys.mjs8
-rw-r--r--browser/components/places/content/browserPlacesViews.js12
-rw-r--r--browser/components/places/content/controller.js10
-rw-r--r--browser/components/places/content/places-menupopup.js2
-rw-r--r--browser/components/places/content/places-tree.js8
-rw-r--r--browser/components/places/content/places.js8
-rw-r--r--browser/components/places/content/treeView.js26
-rw-r--r--browser/components/places/docs/Bookmarks.rst6
-rw-r--r--browser/components/places/docs/History.rst6
-rw-r--r--browser/components/places/docs/architecture-overview.rst2
-rw-r--r--browser/components/places/tests/browser/browser.toml9
-rw-r--r--browser/components/places/tests/browser/browser_autoshow_bookmarks_toolbar.js6
-rw-r--r--browser/components/places/tests/browser/browser_bookmarkProperties_no_user_actions.js4
-rw-r--r--browser/components/places/tests/browser/browser_bookmark_all_tabs.js46
-rw-r--r--browser/components/places/tests/browser/browser_bookmark_backup_export_import.js2
-rw-r--r--browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js14
-rw-r--r--browser/components/places/tests/browser/browser_bookmark_current_tabs.js71
-rw-r--r--browser/components/places/tests/browser/browser_bookmark_popup.js14
-rw-r--r--browser/components/places/tests/browser/browser_bookmarksProperties.js6
-rw-r--r--browser/components/places/tests/browser/browser_click_bookmarks_on_toolbar.js4
-rw-r--r--browser/components/places/tests/browser/browser_controller_onDrop.js4
-rw-r--r--browser/components/places/tests/browser/browser_controller_onDrop_query.js4
-rw-r--r--browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js8
-rw-r--r--browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js4
-rw-r--r--browser/components/places/tests/browser/browser_library_delete.js42
-rw-r--r--browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js2
-rw-r--r--browser/components/places/tests/browser/browser_panelview_bookmarks_delete.js2
-rw-r--r--browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js2
-rw-r--r--browser/components/places/tests/browser/browser_sidebarpanels_click.js4
-rw-r--r--browser/components/places/tests/browser/browser_toolbar_overflow.js2
-rw-r--r--browser/components/places/tests/browser/head.js4
-rw-r--r--browser/components/places/tests/browser/interactions/browser_interactions_typing.js2
-rw-r--r--browser/components/places/tests/browser/interactions/browser_interactions_view_time.js4
-rw-r--r--browser/components/places/tests/unit/test_clearHistory_shutdown.js2
35 files changed, 207 insertions, 158 deletions
diff --git a/browser/components/places/Interactions.sys.mjs b/browser/components/places/Interactions.sys.mjs
index b8a6b44805..36c629eb82 100644
--- a/browser/components/places/Interactions.sys.mjs
+++ b/browser/components/places/Interactions.sys.mjs
@@ -448,11 +448,8 @@ class _Interactions {
/**
* Handles a window going inactive.
- *
- * @param {DOMWindow} win
- * The window that is going inactive.
*/
- #onDeactivateWindow(win) {
+ #onDeactivateWindow() {
lazy.logConsole.debug("Window deactivate");
this.#updateInteraction();
@@ -504,10 +501,8 @@ class _Interactions {
* The subject of the notification.
* @param {string} topic
* The topic of the notification.
- * @param {string} data
- * The data attached to the notification.
*/
- observe(subject, topic, data) {
+ observe(subject, topic) {
switch (topic) {
case DOMWINDOW_OPENED_TOPIC:
this.#onWindowOpen(subject);
@@ -617,7 +612,7 @@ class InteractionsStore {
// Block async shutdown to ensure the last write goes through.
this.progress = {};
lazy.PlacesUtils.history.shutdownClient.jsclient.addBlocker(
- "Interactions.jsm:: store",
+ "Interactions.sys.mjs:: store",
async () => this.flush(),
{ fetchState: () => this.progress }
);
@@ -645,7 +640,7 @@ class InteractionsStore {
*/
async reset() {
await lazy.PlacesUtils.withConnectionWrapper(
- "Interactions.jsm::reset",
+ "Interactions.sys.mjs::reset",
async db => {
await db.executeCached(`DELETE FROM moz_places_metadata`);
}
@@ -740,7 +735,7 @@ class InteractionsStore {
this.progress.pendingUpdates = i;
await lazy.PlacesUtils.withConnectionWrapper(
- "Interactions.jsm::updateDatabase",
+ "Interactions.sys.mjs::updateDatabase",
async db => {
await db.executeCached(
`
diff --git a/browser/components/places/PlacesUIUtils.sys.mjs b/browser/components/places/PlacesUIUtils.sys.mjs
index 415a97ec6c..b9e9efe70e 100644
--- a/browser/components/places/PlacesUIUtils.sys.mjs
+++ b/browser/components/places/PlacesUIUtils.sys.mjs
@@ -41,8 +41,6 @@ let InternalFaviconLoader = {
* The options object containing:
* @param {object} options.uri
* The URI of the favicon to cancel.
- * @param {number} options.innerWindowID
- * The inner window ID of the window. Unused.
* @param {number} options.timerID
* The timer ID of the timeout to be cancelled
* @param {*} options.callback
@@ -50,7 +48,7 @@ let InternalFaviconLoader = {
* @param {string} reason
* The reason for cancelling the request.
*/
- _cancelRequest({ uri, innerWindowID, timerID, callback }, reason) {
+ _cancelRequest({ uri, timerID, callback }, reason) {
// Break cycle
let request = callback.request;
delete callback.request;
@@ -1232,8 +1230,8 @@ export var PlacesUIUtils = {
* Helpers for consumers of editBookmarkOverlay which don't have a node as their input.
*
* Given a bookmark object for either a url bookmark or a folder, returned by
- * Bookmarks.fetch (see Bookmark.jsm), this creates a node-like object suitable for
- * initialising the edit overlay with it.
+ * Bookmarks.fetch (see Bookmark.sys.mjs), this creates a node-like object
+ * suitable for initialising the edit overlay with it.
*
* @param {object} aFetchInfo
* a bookmark object returned by Bookmarks.fetch.
diff --git a/browser/components/places/content/browserPlacesViews.js b/browser/components/places/content/browserPlacesViews.js
index 35cdd2b9d5..1d849e3297 100644
--- a/browser/components/places/content/browserPlacesViews.js
+++ b/browser/components/places/content/browserPlacesViews.js
@@ -277,7 +277,7 @@ class PlacesViewBase {
return this.controller.buildContextMenu(aPopup);
}
- destroyContextMenu(aPopup) {
+ destroyContextMenu() {
this._contextMenuShown = null;
}
@@ -458,7 +458,7 @@ class PlacesViewBase {
}
}
- nodeURIChanged(aPlacesNode, aURIString) {
+ nodeURIChanged(aPlacesNode) {
let elt = this._getDOMNodeForPlacesNode(aPlacesNode, true);
// There's no DOM node, thus there's nothing to be done when the URI changes.
@@ -519,7 +519,7 @@ class PlacesViewBase {
}
}
- nodeRemoved(aParentPlacesNode, aPlacesNode, aIndex) {
+ nodeRemoved(aParentPlacesNode, aPlacesNode) {
let parentElt = this._getDOMNodeForPlacesNode(aParentPlacesNode);
let elt = this._getDOMNodeForPlacesNode(aPlacesNode);
@@ -1689,7 +1689,7 @@ class PlacesToolbar extends PlacesViewBase {
}
}
- _onMouseOut(aEvent) {
+ _onMouseOut() {
window.XULBrowserWindow.setOverLink("");
}
@@ -1852,7 +1852,7 @@ class PlacesToolbar extends PlacesViewBase {
aEvent.stopPropagation();
}
- _onDragLeave(aEvent) {
+ _onDragLeave() {
PlacesControllerDragHelper.currentDropTarget = null;
this._dropIndicator.collapsed = true;
@@ -1863,7 +1863,7 @@ class PlacesToolbar extends PlacesViewBase {
}
}
- _onDragEnd(aEvent) {
+ _onDragEnd() {
this._cleanupDragDetails();
}
diff --git a/browser/components/places/content/controller.js b/browser/components/places/content/controller.js
index 3c113137df..6eaa129961 100644
--- a/browser/components/places/content/controller.js
+++ b/browser/components/places/content/controller.js
@@ -102,7 +102,7 @@ PlacesController.prototype = {
QueryInterface: ChromeUtils.generateQI(["nsIClipboardOwner"]),
// nsIClipboardOwner
- LosingOwnership: function PC_LosingOwnership(aXferable) {
+ LosingOwnership: function PC_LosingOwnership() {
this.cutNodes = [];
},
@@ -333,7 +333,7 @@ PlacesController.prototype = {
}
},
- onEvent: function PC_onEvent(eventName) {},
+ onEvent: function PC_onEvent() {},
/**
* Determine whether or not the selection can be removed, either by the
@@ -378,8 +378,12 @@ PlacesController.prototype = {
*/
_isRepeatedRemoveOperation() {
let lastRemoveOperationFingerprint = this._lastRemoveOperationFingerprint;
+ // .bookmarkGuid and .pageGuid may either be null or an empty string. While
+ // that should probably change, it's safer to use || here.
this._lastRemoveOperationFingerprint = PlacesUtils.sha256(
- this._view.selectedNodes.map(n => n.guid ?? n.uri).join()
+ this._view.selectedNodes
+ .map(n => n.bookmarkGuid || (n.pageGuid || n.uri) + n.time)
+ .join()
);
return (
lastRemoveOperationFingerprint == this._lastRemoveOperationFingerprint
diff --git a/browser/components/places/content/places-menupopup.js b/browser/components/places/content/places-menupopup.js
index 1d7615aa27..df00268563 100644
--- a/browser/components/places/content/places-menupopup.js
+++ b/browser/components/places/content/places-menupopup.js
@@ -583,7 +583,7 @@ function closingPopupEndsDrag(popup) {
event.stopPropagation();
}
- on_dragend(event) {
+ on_dragend() {
this._cleanupDragDetails();
}
}
diff --git a/browser/components/places/content/places-tree.js b/browser/components/places/content/places-tree.js
index 08437b5e08..9e43558732 100644
--- a/browser/components/places/content/places-tree.js
+++ b/browser/components/places/content/places-tree.js
@@ -15,14 +15,14 @@
constructor() {
super();
- this.addEventListener("focus", event => {
+ this.addEventListener("focus", () => {
this._cachedInsertionPoint = undefined;
// See select handler. We need the sidebar's places commandset to be
// updated as well
document.commandDispatcher.updateCommands("focus");
});
- this.addEventListener("select", event => {
+ this.addEventListener("select", () => {
this._cachedInsertionPoint = undefined;
// This additional complexity is here for the sidebars
@@ -125,7 +125,7 @@
event.stopPropagation();
});
- this.addEventListener("dragend", event => {
+ this.addEventListener("dragend", () => {
this._isDragSource = false;
PlacesControllerDragHelper.currentDropTarget = null;
});
@@ -841,7 +841,7 @@
return this.controller.buildContextMenu(aPopup);
}
- destroyContextMenu(aPopup) {}
+ destroyContextMenu() {}
disconnectedCallback() {
window.removeEventListener("unload", this.disconnectedCallback);
diff --git a/browser/components/places/content/places.js b/browser/components/places/content/places.js
index b58cee70d5..685fa12b51 100644
--- a/browser/components/places/content/places.js
+++ b/browser/components/places/content/places.js
@@ -500,7 +500,7 @@ var PlacesOrganizer = {
};
fp.init(
- window,
+ window.browsingContext,
PlacesUIUtils.promptLocalization.formatValueSync(
"places-bookmarks-import"
),
@@ -525,7 +525,7 @@ var PlacesOrganizer = {
};
fp.init(
- window,
+ window.browsingContext,
PlacesUIUtils.promptLocalization.formatValueSync(
"places-bookmarks-export"
),
@@ -638,7 +638,7 @@ var PlacesOrganizer = {
"places-bookmarks-restore-title",
"places-bookmarks-restore-filter-name",
]);
- fp.init(window, title, Ci.nsIFilePicker.modeOpen);
+ fp.init(window.browsingContext, title, Ci.nsIFilePicker.modeOpen);
fp.appendFilter(filterName, RESTORE_FILEPICKER_FILTER_EXT);
fp.appendFilters(Ci.nsIFilePicker.filterAll);
fp.displayDirectory = backupsDir;
@@ -711,7 +711,7 @@ var PlacesOrganizer = {
"places-bookmarks-backup-title",
"places-bookmarks-restore-filter-name",
]);
- fp.init(window, title, Ci.nsIFilePicker.modeSave);
+ fp.init(window.browsingContext, title, Ci.nsIFilePicker.modeSave);
fp.appendFilter(filterName, RESTORE_FILEPICKER_FILTER_EXT);
fp.defaultString = PlacesBackups.getFilenameForDate();
fp.defaultExtension = "json";
diff --git a/browser/components/places/content/treeView.js b/browser/components/places/content/treeView.js
index f9b6eb6f9a..2a9c483113 100644
--- a/browser/components/places/content/treeView.js
+++ b/browser/components/places/content/treeView.js
@@ -927,7 +927,7 @@ PlacesTreeView.prototype = {
}
},
- nodeTitleChanged: function PTV_nodeTitleChanged(aNode, aNewTitle) {
+ nodeTitleChanged: function PTV_nodeTitleChanged(aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TITLE);
},
@@ -949,8 +949,7 @@ PlacesTreeView.prototype = {
nodeHistoryDetailsChanged: function PTV_nodeHistoryDetailsChanged(
aNode,
- aOldVisitDate,
- aOldVisitCount
+ aOldVisitDate
) {
this._nodeDetails.delete(
makeNodeDetailsKey({
@@ -969,24 +968,17 @@ PlacesTreeView.prototype = {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_TAGS);
},
- nodeKeywordChanged(aNode, aNewKeyword) {},
+ nodeKeywordChanged() {},
- nodeDateAddedChanged: function PTV_nodeDateAddedChanged(aNode, aNewValue) {
+ nodeDateAddedChanged: function PTV_nodeDateAddedChanged(aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_DATEADDED);
},
- nodeLastModifiedChanged: function PTV_nodeLastModifiedChanged(
- aNode,
- aNewValue
- ) {
+ nodeLastModifiedChanged: function PTV_nodeLastModifiedChanged(aNode) {
this._invalidateCellValue(aNode, this.COLUMN_TYPE_LASTMODIFIED);
},
- containerStateChanged: function PTV_containerStateChanged(
- aNode,
- aOldState,
- aNewState
- ) {
+ containerStateChanged: function PTV_containerStateChanged(aNode) {
this.invalidateContainer(aNode);
},
@@ -1340,7 +1332,7 @@ PlacesTreeView.prototype = {
return props + " " + properties;
},
- getColumnProperties(aColumn) {
+ getColumnProperties() {
return "";
},
@@ -1576,7 +1568,7 @@ PlacesTreeView.prototype = {
return node.icon;
},
- getCellValue(aRow, aColumn) {},
+ getCellValue() {},
getCellText: function PTV_getCellText(aRow, aColumn) {
let node = this._getNodeForRow(aRow);
@@ -1858,5 +1850,5 @@ PlacesTreeView.prototype = {
},
selectionChanged() {},
- cycleCell(aRow, aColumn) {},
+ cycleCell() {},
};
diff --git a/browser/components/places/docs/Bookmarks.rst b/browser/components/places/docs/Bookmarks.rst
index 1c830c74ef..a7db0004f3 100644
--- a/browser/components/places/docs/Bookmarks.rst
+++ b/browser/components/places/docs/Bookmarks.rst
@@ -1,5 +1,5 @@
-Bookmarks.jsm
-=============
+Bookmarks.sys.mjs
+=================
Asynchronous API for managing bookmarks.
Bookmarks are organized in a tree structure, and include URLs, folders and separators. Multiple bookmarks for the same URL are allowed.
@@ -47,4 +47,4 @@ Main functions
Each successful operation is notified through the PlacesObservers :doc:`notifyObservers` interface.
-Full file with actual javadoc and description of each method - `Bookmarks.jsm`_
+Full file with actual javadoc and description of each method - `Bookmarks.sys.mjs`_
diff --git a/browser/components/places/docs/History.rst b/browser/components/places/docs/History.rst
index 5dbf3704dc..6eba0164e3 100644
--- a/browser/components/places/docs/History.rst
+++ b/browser/components/places/docs/History.rst
@@ -1,5 +1,5 @@
-History.jsm
-===========
+History.sys.mjs
+===============
Asynchronous API for managing history.
@@ -40,4 +40,4 @@ Main functions
Each successful operation is notified through the PlacesObservers :doc:`notifyObservers` interface.
-Full file with actual javadoc and description of each method - `History.jsm`_
+Full file with actual javadoc and description of each method - `History.sys.mjs`_
diff --git a/browser/components/places/docs/architecture-overview.rst b/browser/components/places/docs/architecture-overview.rst
index 76c93aa8b3..a7b0ac9a22 100644
--- a/browser/components/places/docs/architecture-overview.rst
+++ b/browser/components/places/docs/architecture-overview.rst
@@ -86,7 +86,7 @@ Most part of backend code is located in : `Toolkit/Components/Places`_:
- :doc:`PlacesTransactions` - This module serves as the transactions manager for Places
.. _Toolkit/Components/Places: https://searchfox.org/mozilla-central/source/toolkit/components/places
- .. _PlacesUtils: https://searchfox.org/mozilla-central/source/toolkit/components/places/PlacesUtils.jsm
+ .. _PlacesUtils: https://searchfox.org/mozilla-central/source/toolkit/components/places/PlacesUtils.sys.mjs
Storage
-------
diff --git a/browser/components/places/tests/browser/browser.toml b/browser/components/places/tests/browser/browser.toml
index 1b0e2571d4..8a971684f8 100644
--- a/browser/components/places/tests/browser/browser.toml
+++ b/browser/components/places/tests/browser/browser.toml
@@ -48,13 +48,6 @@ skip-if = ["os != 'mac'"] # Mac-only functionality
["browser_bookmark_add_tags.js"]
https_first_disabled = true
-["browser_bookmark_all_tabs.js"]
-https_first_disabled = true
-support-files = [
- "bookmark_dummy_1.html",
- "bookmark_dummy_2.html",
-]
-
["browser_bookmark_backup_export_import.js"]
["browser_bookmark_change_location.js"]
@@ -63,6 +56,8 @@ support-files = [
["browser_bookmark_copy_folder_tree.js"]
+["browser_bookmark_current_tabs.js"]
+
["browser_bookmark_folder_moveability.js"]
["browser_bookmark_menu_ctrl_click.js"]
diff --git a/browser/components/places/tests/browser/browser_autoshow_bookmarks_toolbar.js b/browser/components/places/tests/browser/browser_autoshow_bookmarks_toolbar.js
index c841eb276b..0dccc88d23 100644
--- a/browser/components/places/tests/browser/browser_autoshow_bookmarks_toolbar.js
+++ b/browser/components/places/tests/browser/browser_autoshow_bookmarks_toolbar.js
@@ -77,7 +77,7 @@ async function checkResponse({ showToolbar, expectedFolder, reason }) {
add_task(async function test_new_on_toolbar() {
await BrowserTestUtils.withNewTab(
{ gBrowser: win.gBrowser, url: "https://example.com/1" },
- async browser => {
+ async () => {
let toolbar = win.document.getElementById("PersonalToolbar");
Assert.equal(
toolbar.collapsed,
@@ -111,7 +111,7 @@ add_task(async function test_new_on_toolbar_never_show_toolbar() {
await BrowserTestUtils.withNewTab(
{ gBrowser: win.gBrowser, url: "https://example.com/1" },
- async browser => {
+ async () => {
let toolbar = win.document.getElementById("PersonalToolbar");
Assert.equal(
toolbar.collapsed,
@@ -144,7 +144,7 @@ add_task(async function test_existing_on_toolbar() {
});
await BrowserTestUtils.withNewTab(
{ gBrowser: win.gBrowser, url: "https://example.com/editing-test" },
- async browser => {
+ async () => {
await TestUtils.waitForCondition(
() => win.BookmarkingUI.status == BookmarkingUI.STATUS_STARRED,
"Page should be starred."
diff --git a/browser/components/places/tests/browser/browser_bookmarkProperties_no_user_actions.js b/browser/components/places/tests/browser/browser_bookmarkProperties_no_user_actions.js
index 67d1406bc1..09dc0c7e45 100644
--- a/browser/components/places/tests/browser/browser_bookmarkProperties_no_user_actions.js
+++ b/browser/components/places/tests/browser/browser_bookmarkProperties_no_user_actions.js
@@ -50,10 +50,10 @@ add_task(async function test_change_title_from_BookmarkStar() {
mozCursor: "auto",
mozItemCount: 1,
types: [PlacesUtils.TYPE_X_MOZ_PLACE],
- mozTypesAt(i) {
+ mozTypesAt() {
return this.types;
},
- mozGetDataAt(i) {
+ mozGetDataAt() {
return bookmarkWithId;
},
};
diff --git a/browser/components/places/tests/browser/browser_bookmark_all_tabs.js b/browser/components/places/tests/browser/browser_bookmark_all_tabs.js
deleted file mode 100644
index 2852bf4019..0000000000
--- a/browser/components/places/tests/browser/browser_bookmark_all_tabs.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Test for Bug 446171 - Name field of bookmarks saved via 'Bookmark All Tabs'
- * has '(null)' value if history is disabled or just in private browsing mode
- */
-"use strict";
-
-add_task(async function () {
- const BASE_URL =
- "http://example.org/browser/browser/components/places/tests/browser/";
- const TEST_PAGES = [
- BASE_URL + "bookmark_dummy_1.html",
- BASE_URL + "bookmark_dummy_2.html",
- BASE_URL + "bookmark_dummy_1.html",
- ];
-
- function promiseAddTab(url) {
- return BrowserTestUtils.openNewForegroundTab(gBrowser, url);
- }
-
- let tabs = await Promise.all(TEST_PAGES.map(promiseAddTab));
-
- let URIs = PlacesCommandHook.uniqueCurrentPages;
- is(URIs.length, 3, "Only unique pages are returned");
-
- Assert.deepEqual(
- URIs.map(URI => URI.uri.spec),
- [
- "about:blank",
- BASE_URL + "bookmark_dummy_1.html",
- BASE_URL + "bookmark_dummy_2.html",
- ],
- "Correct URIs are returned"
- );
-
- Assert.deepEqual(
- URIs.map(URI => URI.title),
- ["New Tab", "Bookmark Dummy 1", "Bookmark Dummy 2"],
- "Correct titles are returned"
- );
-
- registerCleanupFunction(async function () {
- for (let tab of tabs) {
- BrowserTestUtils.removeTab(tab);
- }
- });
-});
diff --git a/browser/components/places/tests/browser/browser_bookmark_backup_export_import.js b/browser/components/places/tests/browser/browser_bookmark_backup_export_import.js
index 8b954a8469..356e9e8d78 100644
--- a/browser/components/places/tests/browser/browser_bookmark_backup_export_import.js
+++ b/browser/components/places/tests/browser/browser_bookmark_backup_export_import.js
@@ -94,7 +94,7 @@ async function validateImportedBookmarks(fromPlaces) {
}
}
-async function promiseImportExport(aWindow) {
+async function promiseImportExport() {
saveDir = Services.dirsvc.get("TmpD", Ci.nsIFile);
saveDir.append("temp-bookmarks-export");
if (!saveDir.exists()) {
diff --git a/browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js b/browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js
index ac9120d3d6..16aeb08ad8 100644
--- a/browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js
+++ b/browser/components/places/tests/browser/browser_bookmark_context_menu_contents.js
@@ -377,7 +377,7 @@ add_task(async function test_sidebar_folder_contextmenu_contents() {
await withSidebarTree("bookmarks", async tree => {
await checkContextMenu(
- async bookmark => {
+ async () => {
let folder = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "folder",
@@ -416,7 +416,7 @@ add_task(async function test_sidebar_multiple_folders_contextmenu_contents() {
await withSidebarTree("bookmarks", async tree => {
await checkContextMenu(
- async bookmark => {
+ async () => {
let folder1 = await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.toolbarGuid,
title: "folder 1",
@@ -556,7 +556,7 @@ add_task(async function test_library_bookmark_contextmenu_contents() {
);
}
- await withLibraryWindow("BookmarksToolbar", async ({ left, right }) => {
+ await withLibraryWindow("BookmarksToolbar", async ({ right }) => {
await checkContextMenu(
async bookmark => {
let contextMenu = right.ownerDocument.getElementById("placesContext");
@@ -594,7 +594,7 @@ add_task(async function test_library_bookmark_search_contextmenu_contents() {
);
}
- await withLibraryWindow("BookmarksToolbar", async ({ left, right }) => {
+ await withLibraryWindow("BookmarksToolbar", async ({ right }) => {
await checkContextMenu(
async bookmark => {
info("Checking bookmark library menu contents in search context");
@@ -704,7 +704,7 @@ add_task(async function test_sidebar_multiple_links_contextmenu_contents() {
await withSidebarTree("history", async tree => {
await checkContextMenu(
- async bookmark => {
+ async () => {
await PlacesTestUtils.addVisits([
"http://example-1.com/",
"http://example-2.com/",
@@ -774,9 +774,9 @@ add_task(async function test_library_noselection_contextmenu_contents() {
"placesContext_paste",
];
- await withLibraryWindow("BookmarksToolbar", async ({ left, right }) => {
+ await withLibraryWindow("BookmarksToolbar", async ({ right }) => {
await checkContextMenu(
- async bookmark => {
+ async () => {
let contextMenu = right.ownerDocument.getElementById("placesContext");
let popupShownPromise = BrowserTestUtils.waitForEvent(
contextMenu,
diff --git a/browser/components/places/tests/browser/browser_bookmark_current_tabs.js b/browser/components/places/tests/browser/browser_bookmark_current_tabs.js
new file mode 100644
index 0000000000..a6dd77d4c5
--- /dev/null
+++ b/browser/components/places/tests/browser/browser_bookmark_current_tabs.js
@@ -0,0 +1,71 @@
+/* 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/. */
+
+const { MockRegistrar } = ChromeUtils.importESModule(
+ "resource://testing-common/MockRegistrar.sys.mjs"
+);
+
+add_setup(() => {
+ let mockPromptService = {
+ confirmExBC() {
+ return 0;
+ },
+ QueryInterface: ChromeUtils.generateQI(["nsIPromptService"]),
+ };
+ let mockPromptServiceCID = MockRegistrar.register(
+ "@mozilla.org/prompter;1",
+ mockPromptService
+ );
+ registerCleanupFunction(() => {
+ MockRegistrar.unregister(mockPromptServiceCID);
+ });
+});
+
+add_task(async function bookmarkPage() {
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "https://user:pass@example.com/"
+ );
+
+ let promiseBookmark = PlacesTestUtils.waitForNotification(
+ "bookmark-added",
+ () => true
+ );
+ PlacesCommandHook.bookmarkPage();
+ await promiseBookmark;
+
+ let bookmark = await PlacesUtils.bookmarks.fetch({
+ url: "https://example.com/",
+ });
+ Assert.ok(bookmark, "Found the expected bookmark");
+
+ BrowserTestUtils.removeTab(tab);
+ await PlacesUtils.bookmarks.eraseEverything();
+});
+
+add_task(async function bookmarkTabs() {
+ let tab = await BrowserTestUtils.openNewForegroundTab(
+ gBrowser,
+ "https://user:pass@example.com/"
+ );
+
+ await withBookmarksDialog(
+ false,
+ PlacesCommandHook.bookmarkTabs,
+ async dialog => {
+ dialog.document
+ .getElementById("bookmarkpropertiesdialog")
+ .getButton("accept")
+ .click();
+ }
+ );
+
+ let bookmark = await PlacesUtils.bookmarks.fetch({
+ url: "https://example.com/",
+ });
+ Assert.ok(bookmark, "Found the expected bookmark");
+
+ BrowserTestUtils.removeTab(tab);
+ await PlacesUtils.bookmarks.eraseEverything();
+});
diff --git a/browser/components/places/tests/browser/browser_bookmark_popup.js b/browser/components/places/tests/browser/browser_bookmark_popup.js
index 616755b7e1..3f9e85b683 100644
--- a/browser/components/places/tests/browser/browser_bookmark_popup.js
+++ b/browser/components/places/tests/browser/browser_bookmark_popup.js
@@ -345,7 +345,7 @@ add_task(async function bookmark_with_invalid_default_folder() {
await test_bookmarks_popup({
isNewBookmark: true,
shouldAutoClose: true,
- async popupShowFn(browser) {
+ async popupShowFn() {
EventUtils.synthesizeKey("d", { accelKey: true }, win);
},
});
@@ -510,7 +510,7 @@ add_task(async function contextmenu_new_bookmark_keypress_no_autoclose() {
add_task(async function bookmarks_menu_new_bookmark_remove_bookmark() {
await test_bookmarks_popup({
isNewBookmark: true,
- popupShowFn(browser) {
+ popupShowFn() {
win.document.getElementById("menu_bookmarkThisPage").doCommand();
},
shouldAutoClose: true,
@@ -524,7 +524,7 @@ add_task(async function bookmarks_menu_new_bookmark_remove_bookmark() {
add_task(async function ctrl_d_edit_bookmark_remove_bookmark() {
await test_bookmarks_popup({
isNewBookmark: false,
- popupShowFn(browser) {
+ popupShowFn() {
EventUtils.synthesizeKey("D", { accelKey: true }, win);
},
shouldAutoClose: true,
@@ -544,7 +544,7 @@ add_task(async function enter_on_remove_bookmark_should_remove_bookmark() {
await test_bookmarks_popup({
isNewBookmark: true,
- popupShowFn(browser) {
+ popupShowFn() {
EventUtils.synthesizeKey("D", { accelKey: true }, win);
},
shouldAutoClose: true,
@@ -589,7 +589,7 @@ add_task(async function mouse_hovering_panel_should_prevent_autoclose() {
add_task(async function ctrl_d_new_bookmark_mousedown_mouseout_no_autoclose() {
await test_bookmarks_popup({
isNewBookmark: true,
- popupShowFn(browser) {
+ popupShowFn() {
EventUtils.synthesizeKey("D", { accelKey: true }, win);
},
async popupEditFn() {
@@ -635,7 +635,7 @@ add_task(async function ctrl_d_new_bookmark_mousedown_mouseout_no_autoclose() {
add_task(async function enter_during_autocomplete_should_prevent_autoclose() {
await test_bookmarks_popup({
isNewBookmark: false,
- async popupShowFn(browser) {
+ async popupShowFn() {
PlacesUtils.tagging.tagURI(makeURI(TEST_URL), ["Abc"]);
EventUtils.synthesizeKey("d", { accelKey: true }, win);
},
@@ -673,7 +673,7 @@ add_task(async function enter_during_autocomplete_should_prevent_autoclose() {
add_task(async function escape_during_autocomplete_should_prevent_autoclose() {
await test_bookmarks_popup({
isNewBookmark: false,
- async popupShowFn(browser) {
+ async popupShowFn() {
PlacesUtils.tagging.tagURI(makeURI(TEST_URL), ["Abc"]);
EventUtils.synthesizeKey("d", { accelKey: true }, win);
},
diff --git a/browser/components/places/tests/browser/browser_bookmarksProperties.js b/browser/components/places/tests/browser/browser_bookmarksProperties.js
index 8f1d783a49..cfa9e6c581 100644
--- a/browser/components/places/tests/browser/browser_bookmarksProperties.js
+++ b/browser/components/places/tests/browser/browser_bookmarksProperties.js
@@ -88,7 +88,7 @@ gTests.push({
let unloadPromise = new Promise(resolve => {
this.window.addEventListener(
"unload",
- function (event) {
+ function () {
tagsField.popup.removeEventListener(
"popuphidden",
popupListener,
@@ -216,7 +216,7 @@ gTests.push({
let hiddenPromise = new Promise(resolve => {
this.window.addEventListener(
"unload",
- function (event) {
+ function () {
tagsField.popup.removeEventListener(
"popuphidden",
popupListener,
@@ -340,7 +340,7 @@ gTests.push({
let unloadPromise = new Promise(resolve => {
this.window.addEventListener(
"unload",
- event => {
+ () => {
Assert.ok(
self._cleanShutdown,
"Dialog window should not be closed by pressing ESC in folder name textbox"
diff --git a/browser/components/places/tests/browser/browser_click_bookmarks_on_toolbar.js b/browser/components/places/tests/browser/browser_click_bookmarks_on_toolbar.js
index 5ecf95d94e..b1fb763fb7 100644
--- a/browser/components/places/tests/browser/browser_click_bookmarks_on_toolbar.js
+++ b/browser/components/places/tests/browser/browser_click_bookmarks_on_toolbar.js
@@ -19,7 +19,7 @@ function waitForBookmarkElements(expectedCount) {
}
return new Promise(resolve => {
info("Waiting for bookmarks");
- let mut = new MutationObserver(mutations => {
+ let mut = new MutationObserver(() => {
info("Elements appeared");
if (container.childElementCount == expectedCount) {
resolve();
@@ -160,7 +160,7 @@ add_task(async function clickWithPrefSet() {
// With loadBookmarksInTabs, reuse current tab if blank
for (let button of [0, 1]) {
- await BrowserTestUtils.withNewTab({ gBrowser }, async tab => {
+ await BrowserTestUtils.withNewTab({ gBrowser }, async () => {
promise = waitForLoad(gBrowser.selectedBrowser, TEST_PAGES[1]);
EventUtils.synthesizeMouseAtCenter(gBookmarkElements[1], {
button,
diff --git a/browser/components/places/tests/browser/browser_controller_onDrop.js b/browser/components/places/tests/browser/browser_controller_onDrop.js
index cbda2612cf..c2edf4164f 100644
--- a/browser/components/places/tests/browser/browser_controller_onDrop.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop.js
@@ -53,10 +53,10 @@ async function run_drag_test(startBookmarkIndex, insertionIndex) {
mozCursor: "auto",
mozItemCount: 1,
types: [PlacesUtils.TYPE_X_MOZ_PLACE],
- mozTypesAt(i) {
+ mozTypesAt() {
return [this._data[0].type];
},
- mozGetDataAt(i) {
+ mozGetDataAt() {
return this._data[0].data;
},
mozSetDataAt(type, data, index) {
diff --git a/browser/components/places/tests/browser/browser_controller_onDrop_query.js b/browser/components/places/tests/browser/browser_controller_onDrop_query.js
index 10dd6faa3c..f5004d40d0 100644
--- a/browser/components/places/tests/browser/browser_controller_onDrop_query.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop_query.js
@@ -37,10 +37,10 @@ async function simulateDrop(
mozCursor: "auto",
mozItemCount: 1,
types: [PlacesUtils.TYPE_X_MOZ_PLACE],
- mozTypesAt(i) {
+ mozTypesAt() {
return [this._data[0].type];
},
- mozGetDataAt(i) {
+ mozGetDataAt() {
return this._data[0].data;
},
mozSetDataAt(type, data, index) {
diff --git a/browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js b/browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js
index 2637d4d724..2281e0777e 100644
--- a/browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop_sidebar.js
@@ -48,10 +48,10 @@ async function simulateDrop(
mozCursor: "auto",
mozItemCount: 1,
types: [PlacesUtils.TYPE_X_MOZ_PLACE],
- mozTypesAt(i) {
+ mozTypesAt() {
return [this._data[0].type];
},
- mozGetDataAt(i) {
+ mozGetDataAt() {
return this._data[0].data;
},
mozSetDataAt(type, data, index) {
@@ -247,10 +247,10 @@ add_task(async function test_move_within_itself() {
mozCursor: "auto",
mozItemCount: bookmarks.length,
types: [PlacesUtils.TYPE_X_MOZ_PLACE],
- mozTypesAt(i) {
+ mozTypesAt() {
return [this._data[0].type];
},
- mozGetDataAt(i) {
+ mozGetDataAt() {
return this._data[0].data;
},
mozSetDataAt(type, data, index) {
diff --git a/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js b/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
index 64c448ec3f..297219d06c 100644
--- a/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
+++ b/browser/components/places/tests/browser/browser_controller_onDrop_tagFolder.js
@@ -81,10 +81,10 @@ async function run_drag_test(startBookmarkIndex, newParentGuid) {
mozCursor: "auto",
mozItemCount: 1,
types: [PlacesUtils.TYPE_X_MOZ_PLACE],
- mozTypesAt(i) {
+ mozTypesAt() {
return this.types;
},
- mozGetDataAt(i) {
+ mozGetDataAt() {
return bookmarkWithId;
},
};
diff --git a/browser/components/places/tests/browser/browser_library_delete.js b/browser/components/places/tests/browser/browser_library_delete.js
index fe95be0604..c11a4bc8b2 100644
--- a/browser/components/places/tests/browser/browser_library_delete.js
+++ b/browser/components/places/tests/browser/browser_library_delete.js
@@ -120,7 +120,6 @@ add_task(async function test_ensure_correct_selection_and_functionality() {
});
add_task(async function test_repeated_remove_bookmark() {
- // Select and open the left pane "History" query.
let PO = gLibrary.PlacesOrganizer;
PO.selectLeftPaneBuiltIn("UnfiledBookmarks");
@@ -154,4 +153,45 @@ add_task(async function test_repeated_remove_bookmark() {
PO._places.controller.doCommand("cmd_delete");
Assert.equal(spy.callCount, 4, "Should have been invoked again");
Assert.equal(stub.callCount, 2, "Should have been invoked again");
+
+ sinon.restore();
+});
+
+add_task(async function test_repeated_remove_separator() {
+ await PlacesUtils.bookmarks.eraseEverything();
+
+ const NUM_SEPARATORS = 2;
+ for (let i = 0; i < NUM_SEPARATORS; ++i) {
+ await PlacesUtils.bookmarks.insert({
+ parentGuid: PlacesUtils.bookmarks.unfiledGuid,
+ type: PlacesUtils.bookmarks.TYPE_SEPARATOR,
+ index: 0,
+ });
+ }
+
+ gLibrary.PlacesOrganizer.selectLeftPaneBuiltIn("UnfiledBookmarks");
+ let view = gLibrary.ContentTree.view;
+ view.focus();
+ let unsortedNode = PlacesUtils.asContainer(view.result.root);
+ Assert.equal(2, unsortedNode.childCount, "Unsorted node has 2 children");
+
+ for (let i = NUM_SEPARATORS - 1; i >= 0; --i) {
+ let node = unsortedNode.getChild(i);
+ Assert.equal(
+ node.type,
+ Ci.nsINavHistoryResultNode.RESULT_TYPE_SEPARATOR,
+ "Separator found in unsorted bookmarks"
+ );
+ view.selectNode(node);
+ Assert.ok(
+ view.controller.isCommandEnabled("cmd_delete"),
+ "Delete command is enabled"
+ );
+ view.controller.doCommand("cmd_delete");
+ await PlacesTestUtils.waitForNotification("bookmark-removed", events =>
+ events.some(({ guid }) => guid == node.bookmarkGuid)
+ );
+ }
+
+ Assert.equal(unsortedNode.childCount, 0, "Unsorted node has no children");
});
diff --git a/browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js b/browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js
index ed124a047a..f1228ba775 100644
--- a/browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js
+++ b/browser/components/places/tests/browser/browser_library_delete_bookmarks_in_tags.js
@@ -20,7 +20,7 @@ add_task(async function test_tags() {
Services.io.newURI("http://example.com/3"),
];
- let children = uris.map((uri, index, arr) => {
+ let children = uris.map((uri, index) => {
return {
title: `bm${index}`,
url: uri,
diff --git a/browser/components/places/tests/browser/browser_panelview_bookmarks_delete.js b/browser/components/places/tests/browser/browser_panelview_bookmarks_delete.js
index 3a5527a689..c00c5973fd 100644
--- a/browser/components/places/tests/browser/browser_panelview_bookmarks_delete.js
+++ b/browser/components/places/tests/browser/browser_panelview_bookmarks_delete.js
@@ -39,7 +39,7 @@ add_task(async function test_panelview_bookmarks_delete() {
await promise;
promise = new Promise(resolve => {
- let observer = new MutationObserver(mutations => {
+ let observer = new MutationObserver(() => {
if (listItem.parentNode == null) {
Assert.ok(true, "The bookmarks list item was removed.");
observer.disconnect();
diff --git a/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js b/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js
index 92f98b898c..10f7d45d39 100644
--- a/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js
+++ b/browser/components/places/tests/browser/browser_sidebar_open_bookmarks.js
@@ -79,7 +79,7 @@ add_task(async function test_open_bookmark_in_tab_from_sidebar() {
set: [[PREF_LOAD_BOOKMARKS_IN_TABS, true]],
});
- await BrowserTestUtils.withNewTab({ gBrowser }, async initialTab => {
+ await BrowserTestUtils.withNewTab({ gBrowser }, async () => {
await withSidebarTree("bookmarks", async tree => {
tree.selectItems([gBms[0].guid]);
let loadedPromise = BrowserTestUtils.browserLoaded(
diff --git a/browser/components/places/tests/browser/browser_sidebarpanels_click.js b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
index 4b231c92b0..3e5b1c6ec6 100644
--- a/browser/components/places/tests/browser/browser_sidebarpanels_click.js
+++ b/browser/components/places/tests/browser/browser_sidebarpanels_click.js
@@ -54,7 +54,7 @@ add_task(async function test_sidebarpanels_click() {
async selectNode(tree) {
tree.selectItems([this._bookmark.guid]);
},
- cleanup(aCallback) {
+ cleanup() {
return PlacesUtils.bookmarks.remove(this._bookmark);
},
sidebarName: BOOKMARKS_SIDEBAR_ID,
@@ -84,7 +84,7 @@ add_task(async function test_sidebarpanels_click() {
);
is(tree.selectedNode.itemId, -1, "The selected node is not bookmarked");
},
- cleanup(aCallback) {
+ cleanup() {
return PlacesUtils.history.clear();
},
sidebarName: HISTORY_SIDEBAR_ID,
diff --git a/browser/components/places/tests/browser/browser_toolbar_overflow.js b/browser/components/places/tests/browser/browser_toolbar_overflow.js
index 3f16c2a126..216ad56700 100644
--- a/browser/components/places/tests/browser/browser_toolbar_overflow.js
+++ b/browser/components/places/tests/browser/browser_toolbar_overflow.js
@@ -419,7 +419,7 @@ async function toggleToolbar(show, expectedMinChildCount = 0) {
if (getPlacesChildren().length < expectedMinChildCount) {
await new Promise(resolve => {
info("Waiting for bookmark elements to appear");
- let mut = new MutationObserver(mutations => {
+ let mut = new MutationObserver(() => {
let children = getPlacesChildren();
info(`${children.length} bookmark elements appeared`);
if (children.length >= expectedMinChildCount) {
diff --git a/browser/components/places/tests/browser/head.js b/browser/components/places/tests/browser/head.js
index 21790d54aa..bcd89bce15 100644
--- a/browser/components/places/tests/browser/head.js
+++ b/browser/components/places/tests/browser/head.js
@@ -456,7 +456,7 @@ function promisePopupShown(popup) {
if (popup.state == "open") {
resolve();
} else {
- let onPopupShown = event => {
+ let onPopupShown = () => {
popup.removeEventListener("popupshown", onPopupShown);
resolve();
};
@@ -468,7 +468,7 @@ function promisePopupShown(popup) {
// Function copied from browser/base/content/test/general/head.js.
function promisePopupHidden(popup) {
return new Promise(resolve => {
- let onPopupHidden = event => {
+ let onPopupHidden = () => {
popup.removeEventListener("popuphidden", onPopupHidden);
resolve();
};
diff --git a/browser/components/places/tests/browser/interactions/browser_interactions_typing.js b/browser/components/places/tests/browser/interactions/browser_interactions_typing.js
index 99269c3265..cccc3a5ce9 100644
--- a/browser/components/places/tests/browser/interactions/browser_interactions_typing.js
+++ b/browser/components/places/tests/browser/interactions/browser_interactions_typing.js
@@ -118,7 +118,7 @@ add_task(async function test_load_type_and_navigate_away() {
add_task(async function test_no_typing_close_tab() {
await Interactions.reset();
- await BrowserTestUtils.withNewTab(TEST_URL, async browser => {});
+ await BrowserTestUtils.withNewTab(TEST_URL, async () => {});
await assertDatabaseValues([
{
diff --git a/browser/components/places/tests/browser/interactions/browser_interactions_view_time.js b/browser/components/places/tests/browser/interactions/browser_interactions_view_time.js
index 278ae10228..bf74bdb2f8 100644
--- a/browser/components/places/tests/browser/interactions/browser_interactions_view_time.js
+++ b/browser/components/places/tests/browser/interactions/browser_interactions_view_time.js
@@ -62,7 +62,7 @@ add_task(async function test_interactions_simple_load_and_change_to_non_http() {
add_task(async function test_interactions_close_tab() {
await Interactions.reset();
- await BrowserTestUtils.withNewTab(TEST_URL, async browser => {
+ await BrowserTestUtils.withNewTab(TEST_URL, async () => {
Interactions._pageViewStartTime = Cu.now() - 20000;
});
@@ -373,7 +373,7 @@ add_task(async function test_interactions_idle() {
await Interactions.reset();
let lastViewTime;
- await BrowserTestUtils.withNewTab(TEST_URL, async browser => {
+ await BrowserTestUtils.withNewTab(TEST_URL, async () => {
Interactions._pageViewStartTime = Cu.now() - 10000;
Interactions.observe(null, "idle", "");
diff --git a/browser/components/places/tests/unit/test_clearHistory_shutdown.js b/browser/components/places/tests/unit/test_clearHistory_shutdown.js
index 27b432e569..e86b511a25 100644
--- a/browser/components/places/tests/unit/test_clearHistory_shutdown.js
+++ b/browser/components/places/tests/unit/test_clearHistory_shutdown.js
@@ -124,7 +124,7 @@ function storeCache(aURL, aContent) {
return new Promise(resolve => {
let storeCacheListener = {
- onCacheEntryCheck(entry) {
+ onCacheEntryCheck() {
return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED;
},