mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-20 22:27:31 +09:00
Fix: DEPRECATION WARNING: saveImageURL should be passed the private state of the in nsContextMenu.js
Issue #121
This commit is contained in:
parent
e7edb2cd31
commit
df7ccbc7b5
1 changed files with 14 additions and 5 deletions
|
|
@ -911,6 +911,9 @@ nsContextMenu.prototype = {
|
||||||
},
|
},
|
||||||
|
|
||||||
saveVideoFrameAsImage: function () {
|
saveVideoFrameAsImage: function () {
|
||||||
|
let referrerURI = document.documentURIObject;
|
||||||
|
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
|
||||||
|
|
||||||
urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal,
|
urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal,
|
||||||
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
|
||||||
let name = "";
|
let name = "";
|
||||||
|
|
@ -928,7 +931,9 @@ nsContextMenu.prototype = {
|
||||||
canvas.height = video.videoHeight;
|
canvas.height = video.videoHeight;
|
||||||
var ctxDraw = canvas.getContext("2d");
|
var ctxDraw = canvas.getContext("2d");
|
||||||
ctxDraw.drawImage(video, 0, 0);
|
ctxDraw.drawImage(video, 0, 0);
|
||||||
saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle", true, false, document.documentURIObject, this.target.ownerDocument);
|
saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle",
|
||||||
|
true, false, referrerURI,
|
||||||
|
null, null, null, isPrivate);
|
||||||
},
|
},
|
||||||
|
|
||||||
fullScreenVideo: function () {
|
fullScreenVideo: function () {
|
||||||
|
|
@ -1179,6 +1184,8 @@ nsContextMenu.prototype = {
|
||||||
// Save URL of the clicked upon image, video, or audio.
|
// Save URL of the clicked upon image, video, or audio.
|
||||||
saveMedia: function() {
|
saveMedia: function() {
|
||||||
var doc = this.target.ownerDocument;
|
var doc = this.target.ownerDocument;
|
||||||
|
let referrerURI = doc.documentURIObject;
|
||||||
|
let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser);
|
||||||
if (this.onCanvas) {
|
if (this.onCanvas) {
|
||||||
// Bypass cache, since it's a blob: URL.
|
// Bypass cache, since it's a blob: URL.
|
||||||
var target = this.target;
|
var target = this.target;
|
||||||
|
|
@ -1194,14 +1201,16 @@ nsContextMenu.prototype = {
|
||||||
resolve(win.URL.createObjectURL(blob));
|
resolve(win.URL.createObjectURL(blob));
|
||||||
})
|
})
|
||||||
}}).then(function (blobURL) {
|
}}).then(function (blobURL) {
|
||||||
saveImageURL(blobURL, "canvas.png", "SaveImageTitle", true,
|
saveImageURL(blobURL, "canvas.png", "SaveImageTitle",
|
||||||
false, doc.documentURIObject, doc);
|
true, false, referrerURI, null, null, null,
|
||||||
|
isPrivate);
|
||||||
}, Components.utils.reportError);
|
}, Components.utils.reportError);
|
||||||
}
|
}
|
||||||
} else if (this.onImage) {
|
} else if (this.onImage) {
|
||||||
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
|
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
|
||||||
saveImageURL(this.mediaURL, null, "SaveImageTitle", false,
|
saveImageURL(this.mediaURL, null, "SaveImageTitle",
|
||||||
false, doc.documentURIObject, doc);
|
false, false, referrerURI, doc, null, null,
|
||||||
|
isPrivate);
|
||||||
} else if (this.onVideo || this.onAudio) {
|
} else if (this.onVideo || this.onAudio) {
|
||||||
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
|
urlSecurityCheck(this.mediaURL, doc.nodePrincipal);
|
||||||
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
|
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue