Merge pull request #1676 from saebekassebil/seamonkey
Support SeaMonkey (without Private Browsing)
This commit is contained in:
commit
1ade0c2de2
@ -13,14 +13,25 @@ const PDFJS_EVENT_ID = 'pdf.js.message';
|
|||||||
const PDF_CONTENT_TYPE = 'application/pdf';
|
const PDF_CONTENT_TYPE = 'application/pdf';
|
||||||
const EXT_PREFIX = 'extensions.uriloader@pdf.js';
|
const EXT_PREFIX = 'extensions.uriloader@pdf.js';
|
||||||
const MAX_DATABASE_LENGTH = 4096;
|
const MAX_DATABASE_LENGTH = 4096;
|
||||||
|
const FIREFOX_ID = '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}';
|
||||||
|
const SEAMONKEY_ID = '{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}';
|
||||||
|
|
||||||
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
|
||||||
Cu.import('resource://gre/modules/Services.jsm');
|
Cu.import('resource://gre/modules/Services.jsm');
|
||||||
Cu.import('resource://gre/modules/NetUtil.jsm');
|
Cu.import('resource://gre/modules/NetUtil.jsm');
|
||||||
|
|
||||||
let privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
let appInfo = Cc['@mozilla.org/xre/app-info;1']
|
||||||
.getService(Ci.nsIPrivateBrowsingService);
|
.getService(Ci.nsIXULAppInfo);
|
||||||
let inPrivateBrowswing = privateBrowsing.privateBrowsingEnabled;
|
let privateBrowsing, inPrivateBrowsing;
|
||||||
|
|
||||||
|
if (appInfo.ID === FIREFOX_ID) {
|
||||||
|
privateBrowsing = Cc['@mozilla.org/privatebrowsing;1']
|
||||||
|
.getService(Ci.nsIPrivateBrowsingService);
|
||||||
|
inPrivateBrowsing = privateBrowsing.privateBrowsingEnabled;
|
||||||
|
} else if (appInfo.ID === SEAMONKEY_ID) {
|
||||||
|
privateBrowsing = null;
|
||||||
|
inPrivateBrowsing = false;
|
||||||
|
}
|
||||||
|
|
||||||
function getBoolPref(pref, def) {
|
function getBoolPref(pref, def) {
|
||||||
try {
|
try {
|
||||||
@ -61,8 +72,8 @@ function getDOMWindow(aChannel) {
|
|||||||
|
|
||||||
// All the priviledged actions.
|
// All the priviledged actions.
|
||||||
function ChromeActions() {
|
function ChromeActions() {
|
||||||
this.inPrivateBrowswing = privateBrowsing.privateBrowsingEnabled;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ChromeActions.prototype = {
|
ChromeActions.prototype = {
|
||||||
download: function(data) {
|
download: function(data) {
|
||||||
let mimeService = Cc['@mozilla.org/mime;1'].getService(Ci.nsIMIMEService);
|
let mimeService = Cc['@mozilla.org/mime;1'].getService(Ci.nsIMIMEService);
|
||||||
@ -98,7 +109,7 @@ ChromeActions.prototype = {
|
|||||||
channel.asyncOpen(listener, null);
|
channel.asyncOpen(listener, null);
|
||||||
},
|
},
|
||||||
setDatabase: function(data) {
|
setDatabase: function(data) {
|
||||||
if (this.inPrivateBrowswing)
|
if (inPrivateBrowsing)
|
||||||
return;
|
return;
|
||||||
// Protect against something sending tons of data to setDatabase.
|
// Protect against something sending tons of data to setDatabase.
|
||||||
if (data.length > MAX_DATABASE_LENGTH)
|
if (data.length > MAX_DATABASE_LENGTH)
|
||||||
@ -106,7 +117,7 @@ ChromeActions.prototype = {
|
|||||||
setStringPref(EXT_PREFIX + '.database', data);
|
setStringPref(EXT_PREFIX + '.database', data);
|
||||||
},
|
},
|
||||||
getDatabase: function() {
|
getDatabase: function() {
|
||||||
if (this.inPrivateBrowswing)
|
if (inPrivateBrowsing)
|
||||||
return '{}';
|
return '{}';
|
||||||
return getStringPref(EXT_PREFIX + '.database', '{}');
|
return getStringPref(EXT_PREFIX + '.database', '{}');
|
||||||
},
|
},
|
||||||
|
@ -8,11 +8,22 @@
|
|||||||
<!-- PDFJS_LOCALIZED_METADATA -->
|
<!-- PDFJS_LOCALIZED_METADATA -->
|
||||||
<em:name>PDF Viewer</em:name>
|
<em:name>PDF Viewer</em:name>
|
||||||
<em:version>PDFJSSCRIPT_VERSION</em:version>
|
<em:version>PDFJSSCRIPT_VERSION</em:version>
|
||||||
|
|
||||||
|
<!-- Firefox -->
|
||||||
<em:targetApplication>
|
<em:targetApplication>
|
||||||
<Description>
|
<Description>
|
||||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||||
<em:minVersion>6.0</em:minVersion>
|
<em:minVersion>6.0</em:minVersion>
|
||||||
<em:maxVersion>14.0a1</em:maxVersion>
|
<em:maxVersion>15.0a1</em:maxVersion>
|
||||||
|
</Description>
|
||||||
|
</em:targetApplication>
|
||||||
|
|
||||||
|
<!-- SeaMonkey -->
|
||||||
|
<em:targetApplication>
|
||||||
|
<Description>
|
||||||
|
<em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
|
||||||
|
<em:minVersion>2.1.*</em:minVersion>
|
||||||
|
<em:maxVersion>2.12a1</em:maxVersion>
|
||||||
</Description>
|
</Description>
|
||||||
</em:targetApplication>
|
</em:targetApplication>
|
||||||
<em:bootstrap>true</em:bootstrap>
|
<em:bootstrap>true</em:bootstrap>
|
||||||
|
Loading…
Reference in New Issue
Block a user