зеркало из https://github.com/mozilla/gecko-dev.git
Bug 263473 - Context menu displays all possible options on image <object>. Also makes "Set Desktop Background" work with <object> elements and fixes bug 305380. r=mconnor.
This commit is contained in:
Родитель
1b5094dc43
Коммит
3d1c571855
|
@ -4445,17 +4445,21 @@ nsContextMenu.prototype = {
|
|||
disableSetDesktopBackground: function() {
|
||||
// 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;
|
||||
if (!(this.target instanceof nsIImageLoadingContent))
|
||||
return true;
|
||||
|
||||
if (("complete" in this.target) && !this.target.complete)
|
||||
return true;
|
||||
else if (makeURI(this.target.src).scheme == "javascript")
|
||||
|
||||
if (this.target.currentURI.schemeIs("javascript"))
|
||||
return true;
|
||||
else if (this.target instanceof nsIImageLoadingContent) {
|
||||
|
||||
var request = this.target.QueryInterface(nsIImageLoadingContent)
|
||||
.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
|
||||
if (!request)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
|
@ -4465,7 +4469,7 @@ nsContextMenu.prototype = {
|
|||
if (this.disableSetDesktopBackground())
|
||||
return;
|
||||
|
||||
urlSecurityCheck(this.target.src, this.docURL);
|
||||
urlSecurityCheck(this.target.currentURI.spec, this.docURL);
|
||||
|
||||
// Confirm since it's annoying if you hit this accidentally.
|
||||
const kDesktopBackgroundURL =
|
||||
|
|
|
@ -197,19 +197,21 @@ 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)
|
||||
if (!(this._image instanceof nsIImageLoadingContent))
|
||||
return false;
|
||||
|
||||
var request = this._image.QueryInterface(nsIImageLoadingContent)
|
||||
.getRequest(nsIImageLoadingContent.CURRENT_REQUEST);
|
||||
if (!request)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (makeURI(window.arguments[0].src).scheme == "javascript")
|
||||
var imgURI = this._image.currentURI;
|
||||
if (imgURI.schemeIs("javascript"))
|
||||
return false;
|
||||
|
||||
img.setAttribute("src", this._image.src);
|
||||
var img = document.createElementNS(kXUL_NS, "image");
|
||||
img.setAttribute("src", imgURI.spec);
|
||||
return img;
|
||||
},
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче