bug 292737 trunk landing, r=dveditz, a=asa
git-svn-id: svn://10.0.0.236/trunk@175073 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -3972,12 +3972,24 @@ nsContextMenu.prototype = {
|
||||
#endif
|
||||
this.showItem( "context-setDesktopBackground", haveSetDesktopBackground && this.onImage );
|
||||
|
||||
if( haveSetDesktopBackground && this.onImage )
|
||||
// Disable the Set as Desktop Background menu item if we're still trying
|
||||
// to load the image
|
||||
this.setItemAttr( "context-setDesktopBackground", "disabled",
|
||||
(("complete" in this.target) && !this.target.complete) ?
|
||||
"true" : null );
|
||||
if ( haveSetDesktopBackground && this.onImage ) {
|
||||
// Disable the Set as Desktop Background menu item if we're still trying
|
||||
// to load the image or the load failed
|
||||
const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
|
||||
var disableDesktopBackground = false;
|
||||
if (("complete" in this.target) && !this.target.complete)
|
||||
disableSetWallpaper = true;
|
||||
else if (this.target instanceof nsIImageLoadingContent) {
|
||||
var request = this.target.QueryInterface(nsIImageLoadingContent)
|
||||
.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
|
||||
if (!request)
|
||||
disableDesktopBackground = true;
|
||||
}
|
||||
else if (makeURI(this.target.src).scheme == "javascript")
|
||||
disableDesktopBackground = true;
|
||||
|
||||
this.setItemAttr( "context-setDesktopBackground", "disabled", disableDesktopBackground);
|
||||
}
|
||||
|
||||
// View Image depends on whether an image was clicked on.
|
||||
this.showItem( "context-viewimage", this.onImage && !this.onStandaloneImage );
|
||||
|
||||
@@ -198,6 +198,17 @@ var gSetBackground = {
|
||||
_createImage: function ()
|
||||
{
|
||||
var img = document.createElementNS(kXUL_NS, "image");
|
||||
const nsIImageLoadingContent = Components.interfaces.nsIImageLoadingContent;
|
||||
if (window.arguments[0] instanceof nsIImageLoadingContent) {
|
||||
var request = window.arguments[0].QueryInterface(nsIImageLoadingContent)
|
||||
.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
|
||||
if (!request)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (makeURI(window.arguments[0].src).scheme == "javascript")
|
||||
return false;
|
||||
|
||||
img.setAttribute("src", this._image.src);
|
||||
return img;
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user