Merge pull request #7437 from Snuffleupagus/addon-seamonkey-compat

[Firefox addon] Feature detect `originAttributes` to make it Seamonkey 2.40 compatible
This commit is contained in:
Yury Delendik 2016-06-24 10:25:49 -05:00 committed by GitHub
commit 546e22397e
2 changed files with 11 additions and 4 deletions

View File

@ -170,7 +170,7 @@ function createNewChannel(uri, node) {
function asyncOpenChannel(channel, listener, context) {
//#if !MOZCENTRAL
if (!channel.asyncOpen2) {
if (!channel.asyncOpen2 || !('originAttributes' in channel.loadInfo)) {
return channel.asyncOpen(listener, context);
}
//#endif
@ -1032,7 +1032,13 @@ PdfStreamConverter.prototype = {
// Keep the URL the same so the browser sees it as the same.
channel.originalURI = aRequest.URI;
channel.loadGroup = aRequest.loadGroup;
//#if MOZCENTRAL
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,
// e.g. useful for NoScript. Make make sure we reuse the origin attributes
@ -1047,7 +1053,8 @@ PdfStreamConverter.prototype = {
//#else
// FF43 replaced `getCodebasePrincipal` with `createCodebasePrincipal`,
// see https://bugzilla.mozilla.org/show_bug.cgi?id=1165272.
if ('createCodebasePrincipal' in ssm) {
if ('createCodebasePrincipal' in ssm &&
'originAttributes' in aRequest.loadInfo) {
resourcePrincipal =
ssm.createCodebasePrincipal(uri, aRequest.loadInfo.originAttributes);
} else {

View File

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