Bug 1516180 - Provide principal when saving content. r=IanN

Port Bug 1469916.
This commit is contained in:
Frank-Rainer Grahl 2019-01-06 23:21:44 +01:00
Родитель 36b9d67521
Коммит 2a9b8b9bf6
3 изменённых файлов: 11 добавлений и 6 удалений

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

@ -967,7 +967,8 @@ nsContextMenu.prototype = {
saveImageURL(canvas.toDataURL("image/jpeg", ""), name, "SaveImageTitle",
true, true,
this.target.ownerDocument.documentURIObject,
null, null, null, (gPrivate ? true : false));
null, null, null, (gPrivate ? true : false),
this.target.ownerDocument.nodePrincipal);
},
// Full screen video playback
@ -1143,12 +1144,14 @@ nsContextMenu.prototype = {
// Bypass cache, since it's a data: URL.
saveImageURL(this.target.toDataURL(), "canvas.png", "SaveImageTitle",
true, false, referrerURI, null, null, null,
(gPrivate ? true : false));
(gPrivate ? true : false),
doc.nodePrincipal /* system, because blob: */);
else if (this.onImage) {
saveImageURL(this.mediaURL, null, "SaveImageTitle", false,
false, referrerURI, null, gContextMenuContentData.contentType,
gContextMenuContentData.contentDisposition,
(gPrivate ? true : false));
(gPrivate ? true : false),
doc.nodePrincipal);
}
else if (this.onVideo || this.onAudio) {
var dialogTitle = this.onVideo ? "SaveVideoTitle" : "SaveAudioTitle";

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

@ -916,7 +916,8 @@ function saveMedia()
titleKey = "SaveAudioTitle";
saveURL(url, null, titleKey, false, false, makeURI(item.baseURI),
null, (opener.gPrivate ? true : false));
null, (opener.gPrivate ? true : false),
gDocument.nodePrincipal);
}
} else {
selectSaveFolder(function(aDirectory) {
@ -925,7 +926,8 @@ function saveMedia()
uniqueFile(aChosenData.file);
internalSave(aURIString, null, null, null, null, false,
"SaveImageTitle", aChosenData, aBaseURI, null, false,
null, (opener.gPrivate ? true : false));
null, (opener.gPrivate ? true : false),
gDocument.nodePrincipal);
};
for (var i = 0; i < rowArray.length; i++) {

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

@ -173,7 +173,7 @@ nsMacShellService::SetDesktopBackground(Element* aElement,
loadContext = do_QueryInterface(docShell);
}
return wbp->SaveURI(imageURI, 0,
return wbp->SaveURI(imageURI, aElement->NodePrincipal(), 0,
docURI, aElement->OwnerDoc()->GetReferrerPolicy(),
nullptr, nullptr,
mBackgroundFile, loadContext);