From db93eccb6c41bef1e76e9065f299dc02ad6134e1 Mon Sep 17 00:00:00 2001 From: "dolske@mozilla.com" Date: Tue, 3 Jul 2007 14:11:15 -0700 Subject: [PATCH] Bug 386744: "View Image" on throws "Error: uncaught exception: Load of denied." r=mano --- browser/base/content/nsContextMenu.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/browser/base/content/nsContextMenu.js b/browser/base/content/nsContextMenu.js index 40d87987a224..20b324657547 100644 --- a/browser/base/content/nsContextMenu.js +++ b/browser/base/content/nsContextMenu.js @@ -693,11 +693,19 @@ nsContextMenu.prototype = { // Change current window to the URL of the image. viewImage: function(e) { - urlSecurityCheck(this.imageURL, - this.browser.contentPrincipal, - Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + var viewURL; + + if (this.onCanvas) + viewURL = this.target.toDataURL(); + else { + viewURL = this.imageURL; + urlSecurityCheck(viewURL, + this.browser.contentPrincipal, + Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); + } + var doc = this.target.ownerDocument; - openUILink( this.imageURL, e, null, null, null, null, doc.documentURIObject ); + openUILink(viewURL, e, null, null, null, null, doc.documentURIObject ); }, // Change current window to the URL of the background image.