summaryrefslogtreecommitdiffstats
path: root/browser/components/places/PlacesUIUtils.sys.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/places/PlacesUIUtils.sys.mjs')
-rw-r--r--browser/components/places/PlacesUIUtils.sys.mjs36
1 files changed, 21 insertions, 15 deletions
diff --git a/browser/components/places/PlacesUIUtils.sys.mjs b/browser/components/places/PlacesUIUtils.sys.mjs
index b9e9efe70e..288877b55d 100644
--- a/browser/components/places/PlacesUIUtils.sys.mjs
+++ b/browser/components/places/PlacesUIUtils.sys.mjs
@@ -12,6 +12,7 @@ const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, {
CLIENT_NOT_CONFIGURED: "resource://services-sync/constants.sys.mjs",
+ BrowserUtils: "resource://gre/modules/BrowserUtils.sys.mjs",
BrowserWindowTracker: "resource:///modules/BrowserWindowTracker.sys.mjs",
CustomizableUI: "resource:///modules/CustomizableUI.sys.mjs",
MigrationUtils: "resource:///modules/MigrationUtils.sys.mjs",
@@ -199,22 +200,25 @@ let InternalFaviconLoader = {
win.addEventListener("unload", unloadHandler, true);
}
- // First we do the actual setAndFetch call:
- let loadType = lazy.PrivateBrowsingUtils.isWindowPrivate(win)
- ? lazy.PlacesUtils.favicons.FAVICON_LOAD_PRIVATE
- : lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE;
let callback = this._makeCompletionCallback(win, innerWindowID);
-
- if (iconURI && iconURI.schemeIs("data")) {
- expiration = lazy.PlacesUtils.toPRTime(expiration);
- lazy.PlacesUtils.favicons.replaceFaviconDataFromDataURL(
+ if (iconURI?.schemeIs("data")) {
+ lazy.PlacesUtils.favicons.setFaviconForPage(
+ pageURI,
uri,
- iconURI.spec,
- expiration,
- principal
+ iconURI,
+ lazy.PlacesUtils.toPRTime(expiration),
+ () => {
+ callback.onComplete(uri);
+ }
);
+ return;
}
+ // First we do the actual setAndFetch call:
+ let loadType = lazy.PrivateBrowsingUtils.isWindowPrivate(win)
+ ? lazy.PlacesUtils.favicons.FAVICON_LOAD_PRIVATE
+ : lazy.PlacesUtils.favicons.FAVICON_LOAD_NON_PRIVATE;
+
let request = lazy.PlacesUtils.favicons.setAndFetchFaviconForPage(
pageURI,
uri,
@@ -464,7 +468,7 @@ class BookmarkState {
})
);
break;
- case "tags":
+ case "tags": {
const newTags = value.filter(
tag => !this._originalState.tags.includes(tag)
);
@@ -488,6 +492,7 @@ class BookmarkState {
);
}
break;
+ }
case "keyword":
transactions.push(
lazy.PlacesTransactions.EditKeyword({
@@ -982,7 +987,7 @@ export var PlacesUIUtils = {
// whereToOpenLink doesn't return "window" when there's no browser window
// open (Bug 630255).
var where = browserWindow
- ? browserWindow.whereToOpenLink(aEvent, false, true)
+ ? lazy.BrowserUtils.whereToOpenLink(aEvent, false, true)
: "window";
if (where == "window") {
// There is no browser window open, thus open a new one.
@@ -1073,7 +1078,7 @@ export var PlacesUIUtils = {
openNodeWithEvent: function PUIU_openNodeWithEvent(aNode, aEvent) {
let window = aEvent.target.ownerGlobal;
- let where = window.whereToOpenLink(aEvent, false, true);
+ let where = lazy.BrowserUtils.whereToOpenLink(aEvent, false, true);
if (this.loadBookmarksInTabs && lazy.PlacesUtils.nodeIsBookmark(aNode)) {
if (where == "current" && !aNode.uri.startsWith("javascript:")) {
where = "tab";
@@ -1687,7 +1692,7 @@ export var PlacesUIUtils = {
doCommand(command) {
let window = this.triggerNode.ownerGlobal;
switch (command) {
- case "placesCmd_copy":
+ case "placesCmd_copy": {
// This is a little hacky, but there is a lot of code in Places that handles
// clipboard stuff, so it's easier to reuse.
let node = {};
@@ -1732,6 +1737,7 @@ export var PlacesUIUtils = {
Ci.nsIClipboard.kGlobalClipboard
);
break;
+ }
case "placesCmd_open:privatewindow":
window.openTrustedLinkIn(this.triggerNode.link, "window", {
private: true,