[Pkg-javascript-commits] [pdf.js] 16/174: Upstream the changes from Bug 1165272 - unify Get*CodebasePrincipal with createCodebasePrincipal in nsIScriptSecurityManager
David Prévot
taffit at moszumanska.debian.org
Thu Nov 19 18:44:59 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository pdf.js.
commit 0be1f449ee08ac92d62d5079887a7fcc766fc13c
Author: Jonas Jenwald <jonas.jenwald at gmail.com>
Date: Thu Sep 24 18:25:27 2015 +0200
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.
---
extensions/firefox/content/PdfStreamConverter.jsm | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm
index a5541c9..b331444 100644
--- a/extensions/firefox/content/PdfStreamConverter.jsm
+++ b/extensions/firefox/content/PdfStreamConverter.jsm
@@ -1055,14 +1055,25 @@ PdfStreamConverter.prototype = {
// We can use resource principal when data is fetched by the chrome
// e.g. useful for NoScript
- var securityManager = Cc['@mozilla.org/scriptsecuritymanager;1']
- .getService(Ci.nsIScriptSecurityManager);
+ var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
+ .getService(Ci.nsIScriptSecurityManager);
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
// getNoAppCodebasePrincipal (bug 758258).
- var resourcePrincipal = 'getNoAppCodebasePrincipal' in securityManager ?
- securityManager.getNoAppCodebasePrincipal(uri) :
- securityManager.getCodebasePrincipal(uri);
+ // FF43 then replaced getNoAppCodebasePrincipal with
+ // createCodebasePrincipal (bug 1165272).
+ 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;
channel.asyncOpen(proxy, aContext);
},
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git
More information about the Pkg-javascript-commits
mailing list