Merge pull request #1744 from brendandahl/diff-ids

Use different id's for moz central and extension.
This commit is contained in:
Yury Delendik 2012-05-24 13:48:26 -07:00
commit f59ae949ba
4 changed files with 21 additions and 42 deletions

View File

@ -1,3 +1,3 @@
resource pdf.js content/
component {6457a96b-2d68-439a-bcfa-44465fbcdbb1} components/PdfStreamConverter.js
contract @mozilla.org/streamconv;1?from=application/pdf&to=*/* {6457a96b-2d68-439a-bcfa-44465fbcdbb1}
component {d0c5195d-e798-49d4-b1d3-9324328b2291} components/PdfStreamConverter.js
contract @mozilla.org/streamconv;1?from=application/pdf&to=*/* {d0c5195d-e798-49d4-b1d3-9324328b2291}

View File

@ -11,7 +11,7 @@ const Cr = Components.results;
const Cu = Components.utils;
const PDFJS_EVENT_ID = 'pdf.js.message';
const PDF_CONTENT_TYPE = 'application/pdf';
const EXT_PREFIX = 'extensions.uriloader@pdf.js';
const PREF_PREFIX = 'PDFJSSCRIPT_PREF_PREFIX';
const MAX_DATABASE_LENGTH = 4096;
const FIREFOX_ID = '{ec8030f7-c20a-464f-9b0e-13a3a9e97384}';
const SEAMONKEY_ID = '{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}';
@ -57,7 +57,7 @@ function getStringPref(pref, def) {
}
function log(aMsg) {
if (!getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false))
if (!getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false))
return;
let msg = 'PdfStreamConverter.js: ' + (aMsg.join ? aMsg.join('') : aMsg);
Services.console.logStringMessage(msg);
@ -136,12 +136,12 @@ ChromeActions.prototype = {
// Protect against something sending tons of data to setDatabase.
if (data.length > MAX_DATABASE_LENGTH)
return;
setStringPref(EXT_PREFIX + '.database', data);
setStringPref(PREF_PREFIX + '.database', data);
},
getDatabase: function() {
if (inPrivateBrowsing)
return '{}';
return getStringPref(EXT_PREFIX + '.database', '{}');
return getStringPref(PREF_PREFIX + '.database', '{}');
},
getLocale: function() {
return getStringPref('general.useragent.locale', 'en-US');
@ -160,7 +160,7 @@ ChromeActions.prototype = {
}
},
pdfBugEnabled: function() {
return getBoolPref(EXT_PREFIX + '.pdfBugEnabled', false);
return getBoolPref(PREF_PREFIX + '.pdfBugEnabled', false);
}
};
@ -190,7 +190,7 @@ function PdfStreamConverter() {
PdfStreamConverter.prototype = {
// properties required for XPCOM registration:
classID: Components.ID('{6457a96b-2d68-439a-bcfa-44465fbcdbb1}'),
classID: Components.ID('{PDFJSSCRIPT_STREAM_CONVERTER_ID}'),
classDescription: 'pdf.js Component',
contractID: '@mozilla.org/streamconv;1?from=application/pdf&to=*/*',

View File

@ -1,27 +0,0 @@
<?xml version="1.0"?>
#filter substitution
<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:em="http://www.mozilla.org/2004/em-rdf#">
<Description about="urn:mozilla:install-manifest">
<em:id>uriloader@pdf.js</em:id>
<!-- PDFJS_LOCALIZED_METADATA -->
<em:name>PDF Viewer</em:name>
<em:version>PDFJSSCRIPT_VERSION</em:version>
<em:targetApplication>
<Description>
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
<em:minVersion>@FIREFOX_VERSION@</em:minVersion>
<em:maxVersion>@FIREFOX_VERSION@</em:maxVersion>
</Description>
</em:targetApplication>
<em:strictCompatibility>true</em:strictCompatibility>
<em:bootstrap>true</em:bootstrap>
<em:creator>Mozilla</em:creator>
<em:description>Uses HTML5 to display PDF files directly in Firefox.</em:description>
<em:homepageURL>https://support.mozilla.org/kb/Opening%20PDF%20files%20within%20Firefox</em:homepageURL>
<em:type>2</em:type>
</Description>
</RDF>

20
make.js
View File

@ -9,7 +9,11 @@ var ROOT_DIR = __dirname + '/', // absolute path to project's root
LOCALE_SRC_DIR = 'l10n/',
GH_PAGES_DIR = BUILD_DIR + 'gh-pages/',
REPO = 'git@github.com:mozilla/pdf.js.git',
PYTHON_BIN = 'python2.7';
PYTHON_BIN = 'python2.7',
MOZCENTRAL_PREF_PREFIX = 'pdfjs',
FIREFOX_PREF_PREFIX = 'extensions.uriloader@pdf.js',
MOZCENTRAL_STREAM_CONVERTER_ID = 'd0c5195d-e798-49d4-b1d3-9324328b2291',
FIREFOX_STREAM_CONVERTER_ID = '6457a96b-2d68-439a-bcfa-44465fbcdbb1';
//
// make all
@ -348,6 +352,9 @@ target.firefox = function() {
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, FIREFOX_BUILD_DIR + '/install.rdf');
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, FIREFOX_BUILD_DIR + '/update.rdf');
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, FIREFOX_STREAM_CONVERTER_ID, FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, FIREFOX_PREF_PREFIX, FIREFOX_BUILD_DIR + 'components/PdfStreamConverter.js');
// Update localized metadata
var localizedMetadata = cat(EXTENSION_SRC_DIR + '/firefox/metadata.inc');
sed('-i', /.*PDFJS_LOCALIZED_METADATA.*\n/, localizedMetadata, FIREFOX_BUILD_DIR + '/install.rdf');
@ -383,20 +390,17 @@ target.mozcentral = function() {
MOZCENTRAL_TEST_DIR = MOZCENTRAL_EXTENSION_DIR + 'test/',
FIREFOX_CONTENT_DIR = EXTENSION_SRC_DIR + '/firefox/content/',
FIREFOX_EXTENSION_FILES_TO_COPY =
['*.js',
['components/*.js',
'*.svg',
'*.png',
'*.manifest',
'install.rdf.in',
'README.mozilla',
'components',
'../../LICENSE'],
DEFAULT_LOCALE_FILES =
[LOCALE_SRC_DIR + 'en-US/viewer.properties'],
FIREFOX_MC_EXTENSION_FILES =
['icon.png',
'icon64.png',
'chrome.manifest',
['chrome.manifest',
'components',
'content',
'LICENSE'];
@ -448,9 +452,11 @@ target.mozcentral = function() {
cp(DEFAULT_LOCALE_FILES, MOZCENTRAL_L10N_DIR);
// Update the build version number
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, MOZCENTRAL_EXTENSION_DIR + 'install.rdf.in');
sed('-i', /PDFJSSCRIPT_VERSION/, EXTENSION_VERSION, MOZCENTRAL_EXTENSION_DIR + 'README.mozilla');
sed('-i', /PDFJSSCRIPT_STREAM_CONVERTER_ID/, MOZCENTRAL_STREAM_CONVERTER_ID, MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
sed('-i', /PDFJSSCRIPT_PREF_PREFIX/, MOZCENTRAL_PREF_PREFIX, MOZCENTRAL_EXTENSION_DIR + 'components/PdfStreamConverter.js');
// List all files for mozilla-central
cd(MOZCENTRAL_EXTENSION_DIR);
var extensionFiles = '';