From 7b70710565b03c0971eb25b07f6881696a65186d Mon Sep 17 00:00:00 2001 From: Yury Delendik Date: Fri, 4 Jan 2013 11:01:31 -0600 Subject: [PATCH] Traces pdf.js version --- l10n/en-US/viewer.properties | 6 +++--- make.js | 14 ++++++++------ src/pdf.js | 13 ++++++------- web/viewer.js | 8 +++++--- 4 files changed, 22 insertions(+), 19 deletions(-) diff --git a/l10n/en-US/viewer.properties b/l10n/en-US/viewer.properties index ff76d5685..8c86eed10 100644 --- a/l10n/en-US/viewer.properties +++ b/l10n/en-US/viewer.properties @@ -86,9 +86,9 @@ find_not_found=Phrase not found error_more_info=More Information error_less_info=Less Information error_close=Close -# LOCALIZATION NOTE (error_build): "{{build}}" will be replaced by the PDF.JS -# build ID. -error_build=PDF.JS Build: {{build}} +# LOCALIZATION NOTE (error_version_info): "{{version}}" and "{{build}}" will be +# replaced by the PDF.JS version and build ID. +error_version_info=PDF.js v{{version}} (build: {{build}}) # LOCALIZATION NOTE (error_message): "{{message}}" will be replaced by an # english string describing the error. error_message=Message: {{message}} diff --git a/make.js b/make.js index b86bdd6b8..9a96f796e 100644 --- a/make.js +++ b/make.js @@ -202,6 +202,8 @@ target.locale = function() { // Bundles all source files into one wrapper 'pdf.js' file, in the given order. // target.bundle = function() { + target.buildnumber(); + cd(ROOT_DIR); echo(); echo('### Bundling files into ' + BUILD_TARGET); @@ -240,7 +242,8 @@ target.bundle = function() { cd('src'); 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', ''); 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 // preprocess everything yet since other build targets use this file. 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.bundle(); - target.buildnumber(); cd(ROOT_DIR); // Clear out everything in the firefox extension build directory @@ -440,7 +444,6 @@ target.mozcentral = function() { 'LICENSE']; target.bundle(); - target.buildnumber(); cd(ROOT_DIR); // Clear out everything in the firefox extension build directory @@ -510,7 +513,7 @@ target.mozcentral = function() { target.b2g = function() { target.locale(); - target.bundle(); + echo(); echo('### Building B2G (Firefox OS App)'); var B2G_BUILD_DIR = BUILD_DIR + '/b2g/', @@ -555,7 +558,6 @@ target.chrome = function() { CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/'; target.bundle(); - target.buildnumber(); cd(ROOT_DIR); // Clear out everything in the chrome extension build directory diff --git a/src/pdf.js b/src/pdf.js index 707296c16..fd113efa8 100644 --- a/src/pdf.js +++ b/src/pdf.js @@ -16,18 +16,17 @@ */ var PDFJS = {}; +//#if BUNDLE_VERSION +//#expand PDFJS.version = '__BUNDLE_VERSION__'; +//#endif +//#if BUNDLE_BUILD +//#expand PDFJS.build = '__BUNDLE_BUILD__'; +//#endif (function pdfjsWrapper() { // Use strict in our context only - users might not want it 'use strict'; - PDFJS.build = -//#if !BUNDLE_VERSION - 'PDFJSSCRIPT_BUNDLE_VER'; -//#else -//#expand '__BUNDLE_VERSION__'; -//#endif - //#expand __BUNDLE__ }).call((typeof window === 'undefined') ? this : window); diff --git a/web/viewer.js b/web/viewer.js index 025b52994..d2e622761 100644 --- a/web/viewer.js +++ b/web/viewer.js @@ -1138,8 +1138,9 @@ var PDFView = { * and optionally a 'stack' property. */ error: function pdfViewError(message, moreInfo) { - var moreInfoText = mozL10n.get('error_build', {build: PDFJS.build}, - 'PDF.JS Build: {{build}}') + '\n'; + var moreInfoText = mozL10n.get('error_version_info', + {version: PDFJS.version || '?', build: PDFJS.build || '?'}, + 'PDF.js v{{version}} (build: {{build}})') + '\n'; if (moreInfo) { moreInfoText += mozL10n.get('error_message', {message: moreInfo.message}, @@ -1309,7 +1310,8 @@ var PDFView = { // Provides some basic debug information console.log('PDF ' + pdfDocument.fingerprint + ' [' + info.PDFFormatVersion + ' ' + (info.Producer || '-') + - ' / ' + (info.Creator || '-') + ']'); + ' / ' + (info.Creator || '-') + ']' + + (PDFJS.version ? ' (PDF.js: ' + PDFJS.version + ')' : '')); var pdfTitle; if (metadata) {