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:
mconnor%steelgryphon.com
2005-06-24 01:41:01 +00:00
parent 70266125fd
commit eb378e0077
2 changed files with 29 additions and 6 deletions

View File

@@ -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 );

View File

@@ -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;
},