summaryrefslogtreecommitdiffstats
path: root/browser/base/content/nsContextMenu.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-12 05:35:37 +0000
commita90a5cba08fdf6c0ceb95101c275108a152a3aed (patch)
tree532507288f3defd7f4dcf1af49698bcb76034855 /browser/base/content/nsContextMenu.js
parentAdding debian version 126.0.1-1. (diff)
downloadfirefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.tar.xz
firefox-a90a5cba08fdf6c0ceb95101c275108a152a3aed.zip
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'browser/base/content/nsContextMenu.js')
-rw-r--r--browser/base/content/nsContextMenu.js39
1 files changed, 27 insertions, 12 deletions
diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js
index 9769552dce..1811dfcaca 100644
--- a/browser/base/content/nsContextMenu.js
+++ b/browser/base/content/nsContextMenu.js
@@ -1347,8 +1347,6 @@ class nsContextMenu {
!this.onTextInput &&
!this.onLink &&
!this.onPlainTextLink &&
- !this.onImage &&
- !this.onVideo &&
!this.onAudio &&
!this.onEditable &&
!this.onPassword;
@@ -1685,7 +1683,7 @@ class nsContextMenu {
// Change current window to the URL of the image, video, or audio.
viewMedia(e) {
- let where = whereToOpenLink(e, false, false);
+ let where = BrowserUtils.whereToOpenLink(e, false, false);
if (where == "current") {
where = "tab";
}
@@ -2175,7 +2173,10 @@ class nsContextMenu {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
Ci.nsIClipboardHelper
);
- clipboard.copyString(addresses);
+ clipboard.copyString(
+ addresses,
+ this.actor.manager.browsingContext.currentWindowGlobal
+ );
}
// Extract phone and put it on clipboard
@@ -2195,7 +2196,10 @@ class nsContextMenu {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
Ci.nsIClipboardHelper
);
- clipboard.copyString(phone);
+ clipboard.copyString(
+ phone,
+ this.actor.manager.browsingContext.currentWindowGlobal
+ );
}
copyLink() {
@@ -2204,7 +2208,10 @@ class nsContextMenu {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
Ci.nsIClipboardHelper
);
- clipboard.copyString(linkURL);
+ clipboard.copyString(
+ linkURL,
+ this.actor.manager.browsingContext.currentWindowGlobal
+ );
}
/**
@@ -2220,7 +2227,10 @@ class nsContextMenu {
let clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
Ci.nsIClipboardHelper
);
- clipboard.copyString(strippedLinkURL);
+ clipboard.copyString(
+ strippedLinkURL,
+ this.actor.manager.browsingContext.currentWindowGlobal
+ );
}
}
@@ -2324,8 +2334,8 @@ class nsContextMenu {
try {
strippedLinkURI = QueryStringStripper.stripForCopyOrShare(this.linkURI);
} catch (e) {
- console.warn(`isLinkURIStrippable: ${e.message}`);
- return null;
+ console.warn(`stripForCopyOrShare: ${e.message}`);
+ return this.linkURI;
}
// If nothing can be stripped, we return the original URI
@@ -2458,7 +2468,10 @@ class nsContextMenu {
var clipboard = Cc["@mozilla.org/widget/clipboardhelper;1"].getService(
Ci.nsIClipboardHelper
);
- clipboard.copyString(this.originalMediaURL);
+ clipboard.copyString(
+ this.originalMediaURL,
+ this.actor.manager.browsingContext.currentWindowGlobal
+ );
}
getImageText() {
@@ -2484,7 +2497,7 @@ class nsContextMenu {
let drmInfoURL =
Services.urlFormatter.formatURLPref("app.support.baseURL") +
"drm-content";
- let dest = whereToOpenLink(aEvent);
+ let dest = BrowserUtils.whereToOpenLink(aEvent);
// Don't ever want this to open in the same tab as it'll unload the
// DRM'd video, which is going to be a bad idea in most cases.
if (dest == "current") {
@@ -2526,7 +2539,7 @@ class nsContextMenu {
screenY,
this.#getTextToTranslate(),
this.#translationsLangPairPromise
- );
+ ).catch(console.error);
}
/**
@@ -2606,6 +2619,8 @@ class nsContextMenu {
translateSelectionItem.hidden =
// Only show the item if the feature is enabled.
!(translationsEnabled && selectTranslationsEnabled) ||
+ // Only show the item if Translations is supported on this hardware.
+ !TranslationsParent.getIsTranslationsEngineSupported() ||
// If there is no text to translate, we have nothing to do.
textToTranslate.length === 0 ||
// We do not allow translating selections on top of Full Page Translations.