[Firefox addon] Feature detect originAttributes to make it Seamonkey 2.40 compatible

Fixes 7245.
This commit is contained in:
Jonas Jenwald 2016-06-24 17:05:53 +02:00
parent 98d9712308
commit 9fbde18880
2 changed files with 11 additions and 4 deletions

View File

@ -170,7 +170,7 @@ function createNewChannel(uri, node) {
function asyncOpenChannel(channel, listener, context) { function asyncOpenChannel(channel, listener, context) {
//#if !MOZCENTRAL //#if !MOZCENTRAL
if (!channel.asyncOpen2) { if (!channel.asyncOpen2 || !('originAttributes' in channel.loadInfo)) {
return channel.asyncOpen(listener, context); return channel.asyncOpen(listener, context);
} }
//#endif //#endif
@ -1032,7 +1032,13 @@ 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;
//#if MOZCENTRAL
channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes; channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;
//#else
if ('originAttributes' in aRequest.loadInfo) {
channel.loadInfo.originAttributes = aRequest.loadInfo.originAttributes;
}
//#endif
// We can use the resource principal when data is fetched by the chrome, // We can use the resource principal when data is fetched by the chrome,
// e.g. useful for NoScript. Make make sure we reuse the origin attributes // e.g. useful for NoScript. Make make sure we reuse the origin attributes
@ -1047,7 +1053,8 @@ PdfStreamConverter.prototype = {
//#else //#else
// FF43 replaced `getCodebasePrincipal` with `createCodebasePrincipal`, // FF43 replaced `getCodebasePrincipal` with `createCodebasePrincipal`,
// see https://bugzilla.mozilla.org/show_bug.cgi?id=1165272. // see https://bugzilla.mozilla.org/show_bug.cgi?id=1165272.
if ('createCodebasePrincipal' in ssm) { if ('createCodebasePrincipal' in ssm &&
'originAttributes' in aRequest.loadInfo) {
resourcePrincipal = resourcePrincipal =
ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes); ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes);
} else { } else {

View File

@ -22,8 +22,8 @@
<em:targetApplication> <em:targetApplication>
<Description> <Description>
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id> <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
<em:minVersion>2.7</em:minVersion> <em:minVersion>2.40</em:minVersion>
<em:maxVersion>2.39</em:maxVersion> <em:maxVersion>2.50</em:maxVersion>
</Description> </Description>
</em:targetApplication> </em:targetApplication>