Upstream the changes from Bug 1165272 - unify Get*CodebasePrincipal with createCodebasePrincipal in nsIScriptSecurityManager
One of the patches in https://bugzilla.mozilla.org/show_bug.cgi?id=1165272, specifically https://hg.mozilla.org/mozilla-central/rev/5a29e8bc51ca, touches PDF.js code. Unfortunately it was landed upstream without, as far as I can tell, notifying us about it. This patch uplifts the relevant changes, and also adds preprocessor tags to avoid including unnecessary code in mozilla-central.
This commit is contained in:
parent
20b5814249
commit
0be1f449ee
@ -1055,14 +1055,25 @@ PdfStreamConverter.prototype = {
|
|||||||
|
|
||||||
// We can use resource principal when data is fetched by the chrome
|
// We can use resource principal when data is fetched by the chrome
|
||||||
// e.g. useful for NoScript
|
// e.g. useful for NoScript
|
||||||
var securityManager = 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 resourcePrincipal;
|
||||||
|
//#if MOZCENTRAL
|
||||||
|
resourcePrincipal = ssm.createCodebasePrincipal(uri, {});
|
||||||
|
//#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).
|
||||||
var resourcePrincipal = 'getNoAppCodebasePrincipal' in securityManager ?
|
// FF43 then replaced getNoAppCodebasePrincipal with
|
||||||
securityManager.getNoAppCodebasePrincipal(uri) :
|
// createCodebasePrincipal (bug 1165272).
|
||||||
securityManager.getCodebasePrincipal(uri);
|
if ('createCodebasePrincipal' in ssm) {
|
||||||
|
resourcePrincipal = ssm.createCodebasePrincipal(uri, {});
|
||||||
|
} else if ('getNoAppCodebasePrincipal' in ssm) {
|
||||||
|
resourcePrincipal = ssm.getNoAppCodebasePrincipal(uri);
|
||||||
|
} else {
|
||||||
|
resourcePrincipal = ssm.getCodebasePrincipal(uri);
|
||||||
|
}
|
||||||
|
//#endif
|
||||||
aRequest.owner = resourcePrincipal;
|
aRequest.owner = resourcePrincipal;
|
||||||
channel.asyncOpen(proxy, aContext);
|
channel.asyncOpen(proxy, aContext);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user