Bug 1877001 - Allow view-image to open a data: URI by setting a flag on the loadinfo. r=frg

This commit is contained in:
Ian Neal 2024-01-28 15:29:48 +00:00
Родитель 6237f9b65d
Коммит 9b102c5cce
2 изменённых файлов: 5 добавлений и 0 удалений

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

@ -1086,6 +1086,7 @@ nsContextMenu.prototype = {
Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT);
openUILinkIn(this.mediaURL, where,
{ referrerURI: doc.documentURIObject,
forceAllowDataURI: true,
triggeringPrincipal: this.target.nodePrincipal,
});
}

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

@ -1478,6 +1478,7 @@ function openLinkIn(url, where, params)
params.referrerPolicy : Ci.nsIHttpChannel.REFERRER_POLICY_UNSET);
var aRelatedToCurrent = params.relatedToCurrent;
var aAllowMixedContent = params.allowMixedContent;
var aForceAllowDataURI = params.forceAllowDataURI;
var aInBackground = params.inBackground;
var aAvoidBrowserFocus = params.avoidBrowserFocus;
var aDisallowInheritPrincipal = params.disallowInheritPrincipal;
@ -1607,6 +1608,9 @@ function openLinkIn(url, where, params)
if (aDisallowInheritPrincipal) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_DISALLOW_INHERIT_OWNER;
}
if (aForceAllowDataURI) {
flags |= Ci.nsIWebNavigation.LOAD_FLAGS_FORCE_ALLOW_DATA_URI;
}
if (aForceAboutBlankViewerInCurrent) {
w.gBrowser.selectedBrowser.createAboutBlankContentViewer(aPrincipal);