Merge pull request #2525 from yurydelendik/version-info

Traces pdf.js version
This commit is contained in:
Brendan Dahl 2013-01-08 11:17:42 -08:00
commit 9635612034
4 changed files with 22 additions and 19 deletions

View File

@ -86,9 +86,9 @@ find_not_found=Phrase not found
error_more_info=More Information error_more_info=More Information
error_less_info=Less Information error_less_info=Less Information
error_close=Close error_close=Close
# LOCALIZATION NOTE (error_build): "{{build}}" will be replaced by the PDF.JS # LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be
# build ID. # replaced by the PDF.JS version and build ID.
error_build=PDF.JS Build: {{build}} error_version_info=PDF.js v{{version}} (build: {{build}})
# LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an # LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an
# english string describing the error. # english string describing the error.
error_message=Message: {{message}} error_message=Message: {{message}}

14
make.js
View File

@ -202,6 +202,8 @@ target.locale = function() {
// Bundles all source files into one wrapper 'pdf.js' file, in the given order. // Bundles all source files into one wrapper 'pdf.js' file, in the given order.
// //
target.bundle = function() { target.bundle = function() {
target.buildnumber();
cd(ROOT_DIR); cd(ROOT_DIR);
echo(); echo();
echo('### Bundling files into ' + BUILD_TARGET); echo('### Bundling files into ' + BUILD_TARGET);
@ -240,7 +242,8 @@ target.bundle = function() {
cd('src'); cd('src');
var bundle = cat(SRC_FILES), var bundle = cat(SRC_FILES),
bundleVersion = exec('git log --format="%h" -n 1', bundleVersion = EXTENSION_VERSION,
bundleBuild = exec('git log --format="%h" -n 1',
{silent: true}).output.replace('\n', ''); {silent: true}).output.replace('\n', '');
crlfchecker.checkIfCrlfIsPresent(SRC_FILES); crlfchecker.checkIfCrlfIsPresent(SRC_FILES);
@ -255,7 +258,9 @@ target.bundle = function() {
// This just preprocesses the empty pdf.js file, we don't actually want to // This just preprocesses the empty pdf.js file, we don't actually want to
// preprocess everything yet since other build targets use this file. // preprocess everything yet since other build targets use this file.
builder.preprocess('pdf.js', ROOT_DIR + BUILD_TARGET, builder.preprocess('pdf.js', ROOT_DIR + BUILD_TARGET,
{BUNDLE: bundle, BUNDLE_VERSION: bundleVersion}); {BUNDLE: bundle,
BUNDLE_VERSION: bundleVersion,
BUNDLE_BUILD: bundleBuild});
}; };
@ -334,7 +339,6 @@ target.firefox = function() {
target.locale(); target.locale();
target.bundle(); target.bundle();
target.buildnumber();
cd(ROOT_DIR); cd(ROOT_DIR);
// Clear out everything in the firefox extension build directory // Clear out everything in the firefox extension build directory
@ -440,7 +444,6 @@ target.mozcentral = function() {
'LICENSE']; 'LICENSE'];
target.bundle(); target.bundle();
target.buildnumber();
cd(ROOT_DIR); cd(ROOT_DIR);
// Clear out everything in the firefox extension build directory // Clear out everything in the firefox extension build directory
@ -510,7 +513,7 @@ target.mozcentral = function() {
target.b2g = function() { target.b2g = function() {
target.locale(); target.locale();
target.bundle();
echo(); echo();
echo('### Building B2G (Firefox OS App)'); echo('### Building B2G (Firefox OS App)');
var B2G_BUILD_DIR = BUILD_DIR + '/b2g/', var B2G_BUILD_DIR = BUILD_DIR + '/b2g/',
@ -555,7 +558,6 @@ target.chrome = function() {
CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/'; CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/';
target.bundle(); target.bundle();
target.buildnumber();
cd(ROOT_DIR); cd(ROOT_DIR);
// Clear out everything in the chrome extension build directory // Clear out everything in the chrome extension build directory

View File

@ -16,18 +16,17 @@
*/ */
var PDFJS = {}; var PDFJS = {};
//#if BUNDLE_VERSION
//#expand PDFJS.version = '__BUNDLE_VERSION__';
//#endif
//#if BUNDLE_BUILD
//#expand PDFJS.build = '__BUNDLE_BUILD__';
//#endif
(function pdfjsWrapper() { (function pdfjsWrapper() {
// Use strict in our context only - users might not want it // Use strict in our context only - users might not want it
'use strict'; 'use strict';
PDFJS.build =
//#if !BUNDLE_VERSION
'PDFJSSCRIPT_BUNDLE_VER';
//#else
//#expand '__BUNDLE_VERSION__';
//#endif
//#expand __BUNDLE__ //#expand __BUNDLE__
}).call((typeof window === 'undefined') ? this : window); }).call((typeof window === 'undefined') ? this : window);

View File

@ -1138,8 +1138,9 @@ var PDFView = {
* and optionally a 'stack' property. * and optionally a 'stack' property.
*/ */
error: function pdfViewError(message, moreInfo) { error: function pdfViewError(message, moreInfo) {
var moreInfoText = mozL10n.get('error_build', {build: PDFJS.build}, var moreInfoText = mozL10n.get('error_version_info',
'PDF.JS Build: {{build}}') + '\n'; {version: PDFJS.version || '?', build: PDFJS.build || '?'},
'PDF.js v{{version}} (build: {{build}})') + '\n';
if (moreInfo) { if (moreInfo) {
moreInfoText += moreInfoText +=
mozL10n.get('error_message', {message: moreInfo.message}, mozL10n.get('error_message', {message: moreInfo.message},
@ -1309,7 +1310,8 @@ var PDFView = {
// Provides some basic debug information // Provides some basic debug information
console.log('PDF ' + pdfDocument.fingerprint + ' [' + console.log('PDF ' + pdfDocument.fingerprint + ' [' +
info.PDFFormatVersion + ' ' + (info.Producer || '-') + info.PDFFormatVersion + ' ' + (info.Producer || '-') +
' / ' + (info.Creator || '-') + ']'); ' / ' + (info.Creator || '-') + ']' +
(PDFJS.version ? ' (PDF.js: ' + PDFJS.version + ')' : ''));
var pdfTitle; var pdfTitle;
if (metadata) { if (metadata) {