Merge pull request #7114 from dhuseby/Bug_1237908
[Bug 1237908] Make pdf.js use the correct principal origin attributes when loading …
This commit is contained in:
commit
f9a0dc1188
@ -1083,22 +1083,26 @@ PdfStreamConverter.prototype = {
|
|||||||
// Keep the URL the same so the browser sees it as the same.
|
// Keep the URL the same so the browser sees it as the same.
|
||||||
channel.originalURI = aRequest.URI;
|
channel.originalURI = aRequest.URI;
|
||||||
channel.loadGroup = aRequest.loadGroup;
|
channel.loadGroup = aRequest.loadGroup;
|
||||||
|
channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;
|
||||||
|
|
||||||
// We can use resource principal when data is fetched by the chrome
|
// We can use resource principal when data is fetched by the chrome
|
||||||
|
// make sure we reuse the origin attributes from the request channel to keep
|
||||||
|
// isolation consistent.
|
||||||
// e.g. useful for NoScript
|
// e.g. useful for NoScript
|
||||||
var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
|
var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
|
||||||
.getService(Ci.nsIScriptSecurityManager);
|
.getService(Ci.nsIScriptSecurityManager);
|
||||||
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE, null, null);
|
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE, null, null);
|
||||||
|
var attrs = aRequest.loadInfo.originAttributes;
|
||||||
var resourcePrincipal;
|
var resourcePrincipal;
|
||||||
//#if MOZCENTRAL
|
//#if MOZCENTRAL
|
||||||
resourcePrincipal = ssm.createCodebasePrincipal(uri, {});
|
resourcePrincipal = ssm.createCodebasePrincipal(uri, attrs);
|
||||||
//#else
|
//#else
|
||||||
// FF16 and below had getCodebasePrincipal, it was replaced by
|
// FF16 and below had getCodebasePrincipal, it was replaced by
|
||||||
// getNoAppCodebasePrincipal (bug 758258).
|
// getNoAppCodebasePrincipal (bug 758258).
|
||||||
// FF43 then replaced getNoAppCodebasePrincipal with
|
// FF43 then replaced getNoAppCodebasePrincipal with
|
||||||
// createCodebasePrincipal (bug 1165272).
|
// createCodebasePrincipal (bug 1165272).
|
||||||
if ('createCodebasePrincipal' in ssm) {
|
if ('createCodebasePrincipal' in ssm) {
|
||||||
resourcePrincipal = ssm.createCodebasePrincipal(uri, {});
|
resourcePrincipal = ssm.createCodebasePrincipal(uri, attrs);
|
||||||
} else if ('getNoAppCodebasePrincipal' in ssm) {
|
} else if ('getNoAppCodebasePrincipal' in ssm) {
|
||||||
resourcePrincipal = ssm.getNoAppCodebasePrincipal(uri);
|
resourcePrincipal = ssm.getNoAppCodebasePrincipal(uri);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user