diff options
author | New Tobin Paradigm <email@mattatobin.com> | 2018-04-13 02:33:59 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-13 02:33:59 -0400 |
commit | 5fccd1cabd7b120e19753541cc5e9184e181b536 (patch) | |
tree | 7c6ce5842e10db3727e6df480c55f6968b20127b | |
parent | cf22ff559bc8460d2dfd3c716524925979bb80a7 (diff) | |
parent | c2d77decb2e041430221adf59c14eefa1b22d3c2 (diff) | |
download | UXP-5fccd1cabd7b120e19753541cc5e9184e181b536.tar UXP-5fccd1cabd7b120e19753541cc5e9184e181b536.tar.gz UXP-5fccd1cabd7b120e19753541cc5e9184e181b536.tar.lz UXP-5fccd1cabd7b120e19753541cc5e9184e181b536.tar.xz UXP-5fccd1cabd7b120e19753541cc5e9184e181b536.zip |
Merge pull request #139 from janekptacijarabaci/pm_contentMenu_saveImageURL_1
Fix: "DEPRECATION WARNING: saveImageURL should be passed the private state of the containing window" in nsContextMenu.js
-rw-r--r-- | application/palemoon/base/content/nsContextMenu.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/application/palemoon/base/content/nsContextMenu.js b/application/palemoon/base/content/nsContextMenu.js index f914f5841..17db4d3a9 100644 --- a/application/palemoon/base/content/nsContextMenu.js +++ b/application/palemoon/base/content/nsContextMenu.js @@ -911,6 +911,9 @@ nsContextMenu.prototype = { }, saveVideoFrameAsImage: function () { + let referrerURI = document.documentURIObject; + let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); + urlSecurityCheck(this.mediaURL, this.browser.contentPrincipal, Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); let name = ""; @@ -928,7 +931,9 @@ nsContextMenu.prototype = { canvas.height = video.videoHeight; var ctxDraw = canvas.getContext("2d"); 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 () { @@ -1179,6 +1184,8 @@ nsContextMenu.prototype = { // Save URL of the clicked upon image, video, or audio. saveMedia: function() { var doc = this.target.ownerDocument; + let referrerURI = doc.documentURIObject; + let isPrivate = PrivateBrowsingUtils.isBrowserPrivate(this.browser); if (this.onCanvas) { // Bypass cache, since it's a blob: URL. var target = this.target; @@ -1194,14 +1201,16 @@ nsContextMenu.prototype = { resolve(win.URL.createObjectURL(blob)); }) }}).then(function (blobURL) { - saveImageURL(blobURL, "canvas.png", "SaveImageTitle", true, - false, doc.documentURIObject, doc); + saveImageURL(blobURL, "canvas.png", "SaveImageTitle", + true, false, referrerURI, null, null, null, + isPrivate); }, Components.utils.reportError); } } else if (this.onImage) { urlSecurityCheck(this.mediaURL, doc.nodePrincipal); - saveImageURL(this.mediaURL, null, "SaveImageTitle", false, - false, doc.documentURIObject, doc); + saveImageURL(this.mediaURL, null, "SaveImageTitle", + false, false, referrerURI, doc, null, null, + isPrivate); } else if (this.onVideo || this.onAudio) { urlSecurityCheck(this.mediaURL, doc.nodePrincipal); var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle"; |