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_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}}

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.
//
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

View File

@ -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);

View File

@ -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) {