Bug 329521: check image url before viewing image, patch by Martijn Wargers <martijn.martijn@gmail.com>, r=mconnor

This commit is contained in:
gavin%gavinsharp.com 2006-05-03 00:26:44 +00:00
Родитель c602d7baaa
Коммит e0d5540578
1 изменённых файлов: 20 добавлений и 2 удалений

Просмотреть файл

@ -4599,12 +4599,30 @@ nsContextMenu.prototype = {
// Change current window to the URL of the image.
viewImage : function (e) {
urlSecurityCheck( this.imageURL, this.docURL );
openUILink( this.imageURL, e );
try {
if (this.docURL != gBrowser.currentURI) {
const secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
.getService(Components.interfaces.nsIScriptSecurityManager);
const nsIScriptSecMan = Components.interfaces.nsIScriptSecurityManager;
secMan.checkLoadURI(gBrowser.currentURI, makeURI(this.imageURL),
nsIScriptSecMan.DISALLOW_SCRIPT);
}
openUILink( this.imageURL, e );
} catch(e) {}
},
// Change current window to the URL of the background image.
viewBGImage : function (e) {
urlSecurityCheck( this.bgImageURL, this.docURL );
openUILink( this.bgImageURL, e );
try {
if (this.docURL != gBrowser.currentURI) {
const secMan = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
.getService(Components.interfaces.nsIScriptSecurityManager);
const nsIScriptSecMan = Components.interfaces.nsIScriptSecurityManager;
secMan.checkLoadURI(gBrowser.currentURI, makeURI(this.bgImageURL),
nsIScriptSecMan.DISALLOW_SCRIPT);
}
openUILink( this.bgImageURL, e );
} catch(e) {}
},
disableSetDesktopBackground: function() {
// Disable the Set as Desktop Background menu item if we're still trying