diff --git a/extensions/firefox/content/PdfStreamConverter.jsm b/extensions/firefox/content/PdfStreamConverter.jsm index a5541c939..b331444ca 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); },