зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1140859 - Pass the outerWindowID into nsContextMenu.saveHelper() and use that to get the window, rather than unsafely accessing doc.defaultView. r=gabor
--HG-- extra : transplant_source : %05%1C%0C%25%17%E5o%C9%06%13R%92%20u%BB%F0z%86%1A%B6
This commit is contained in:
Родитель
876b457646
Коммит
276e43ea5c
|
@ -1181,7 +1181,7 @@ nsContextMenu.prototype = {
|
||||||
// Helper function to wait for appropriate MIME-type headers and
|
// Helper function to wait for appropriate MIME-type headers and
|
||||||
// then prompt the user with a file picker
|
// then prompt the user with a file picker
|
||||||
saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc, docURI,
|
saveHelper: function(linkURL, linkText, dialogTitle, bypassCache, doc, docURI,
|
||||||
linkDownload) {
|
windowID, linkDownload) {
|
||||||
// canonical def in nsURILoader.h
|
// canonical def in nsURILoader.h
|
||||||
const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020;
|
const NS_ERROR_SAVE_LINK_AS_TIMEOUT = 0x805d0020;
|
||||||
|
|
||||||
|
@ -1216,7 +1216,10 @@ nsContextMenu.prototype = {
|
||||||
|
|
||||||
const promptSvc = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
const promptSvc = Cc["@mozilla.org/embedcomp/prompt-service;1"].
|
||||||
getService(Ci.nsIPromptService);
|
getService(Ci.nsIPromptService);
|
||||||
promptSvc.alert(doc.defaultView, title, msg);
|
const wm = Cc["@mozilla.org/appshell/window-mediator;1"].
|
||||||
|
getService(Ci.nsIWindowMediator);
|
||||||
|
let window = wm.getOuterWindowWithId(windowID);
|
||||||
|
promptSvc.alert(window, title, msg);
|
||||||
} catch (ex) {}
|
} catch (ex) {}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1327,6 +1330,7 @@ nsContextMenu.prototype = {
|
||||||
urlSecurityCheck(this.linkURL, this.principal);
|
urlSecurityCheck(this.linkURL, this.principal);
|
||||||
this.saveHelper(this.linkURL, this.linkText, null, true, this.ownerDoc,
|
this.saveHelper(this.linkURL, this.linkText, null, true, this.ownerDoc,
|
||||||
gContextMenuContentData.documentURIObject,
|
gContextMenuContentData.documentURIObject,
|
||||||
|
gContextMenuContentData.frameOuterWindowID,
|
||||||
this.linkDownload);
|
this.linkDownload);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -1354,7 +1358,8 @@ nsContextMenu.prototype = {
|
||||||
else if (this.onVideo || this.onAudio) {
|
else if (this.onVideo || this.onAudio) {
|
||||||
urlSecurityCheck(this.mediaURL, this.principal);
|
urlSecurityCheck(this.mediaURL, this.principal);
|
||||||
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
|
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";
|
||||||
this.saveHelper(this.mediaURL, null, dialogTitle, false, doc, referrerURI, "");
|
this.saveHelper(this.mediaURL, null, dialogTitle, false, doc, referrerURI,
|
||||||
|
gContextMenuContentData.frameOuterWindowID, "");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче