[api-minor] Add a pdfjsNext
parameter, and PDFJS_NEXT
build flag, to allow backwards incompatible API changes
This commit is contained in:
parent
2b17188998
commit
6d672c4ba6
@ -67,7 +67,8 @@ var DEFINES = {
|
||||
CHROME: false,
|
||||
MINIFIED: false,
|
||||
SINGLE_FILE: false,
|
||||
COMPONENTS: false
|
||||
COMPONENTS: false,
|
||||
PDFJS_NEXT: false,
|
||||
};
|
||||
|
||||
function createStringSource(filename, content) {
|
||||
@ -669,7 +670,7 @@ gulp.task('minified', ['minified-pre'], function (done) {
|
||||
gulp.task('firefox-pre', ['buildnumber', 'locale'], function () {
|
||||
console.log();
|
||||
console.log('### Building Firefox extension');
|
||||
var defines = builder.merge(DEFINES, {FIREFOX: true});
|
||||
var defines = builder.merge(DEFINES, { FIREFOX: true, PDFJS_NEXT: true, });
|
||||
|
||||
var FIREFOX_BUILD_CONTENT_DIR = FIREFOX_BUILD_DIR + '/content/',
|
||||
FIREFOX_EXTENSION_DIR = 'extensions/firefox/',
|
||||
@ -780,7 +781,7 @@ gulp.task('firefox', ['firefox-pre'], function (done) {
|
||||
gulp.task('mozcentral-pre', ['buildnumber', 'locale'], function () {
|
||||
console.log();
|
||||
console.log('### Building mozilla-central extension');
|
||||
var defines = builder.merge(DEFINES, {MOZCENTRAL: true});
|
||||
var defines = builder.merge(DEFINES, { MOZCENTRAL: true, PDFJS_NEXT: true, });
|
||||
|
||||
var MOZCENTRAL_DIR = BUILD_DIR + 'mozcentral/',
|
||||
MOZCENTRAL_EXTENSION_DIR = MOZCENTRAL_DIR + 'browser/extensions/pdfjs/',
|
||||
@ -851,7 +852,7 @@ gulp.task('mozcentral', ['mozcentral-pre']);
|
||||
gulp.task('chromium-pre', ['buildnumber', 'locale'], function () {
|
||||
console.log();
|
||||
console.log('### Building Chromium extension');
|
||||
var defines = builder.merge(DEFINES, {CHROME: true});
|
||||
var defines = builder.merge(DEFINES, { CHROME: true, PDFJS_NEXT: true, });
|
||||
|
||||
var CHROME_BUILD_DIR = BUILD_DIR + '/chromium/',
|
||||
CHROME_BUILD_CONTENT_DIR = CHROME_BUILD_DIR + '/content/';
|
||||
|
@ -2065,7 +2065,7 @@ var RenderTask = (function RenderTaskClosure() {
|
||||
/**
|
||||
* Cancels the rendering task. If the task is currently rendering it will
|
||||
* not be cancelled until graphics pauses with a timeout. The promise that
|
||||
* this object extends will resolved when cancelled.
|
||||
* this object extends will be rejected when cancelled.
|
||||
*/
|
||||
cancel: function RenderTask_cancel() {
|
||||
this._internalRenderTask.cancel();
|
||||
|
@ -305,6 +305,8 @@ function getDefaultSetting(id) {
|
||||
return globalSettings ? globalSettings.externalLinkRel : DEFAULT_LINK_REL;
|
||||
case 'enableStats':
|
||||
return !!(globalSettings && globalSettings.enableStats);
|
||||
case 'pdfjsNext':
|
||||
return !!(globalSettings && globalSettings.pdfjsNext);
|
||||
default:
|
||||
throw new Error('Unknown default setting: ' + id);
|
||||
}
|
||||
|
@ -251,6 +251,13 @@
|
||||
PDFJS.isEvalSupported = (PDFJS.isEvalSupported === undefined ?
|
||||
true : PDFJS.isEvalSupported);
|
||||
|
||||
/**
|
||||
* Opt-in to backwards incompatible API changes. NOTE:
|
||||
* If the `PDFJS_NEXT` build flag is set, it will override this setting.
|
||||
* @var {boolean}
|
||||
*/
|
||||
PDFJS.pdfjsNext = (PDFJS.pdfjsNext === undefined) ? false : PDFJS.pdfjsNext;
|
||||
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('MOZCENTRAL')) {
|
||||
var savedOpenExternalLinksInNewWindow = PDFJS.openExternalLinksInNewWindow;
|
||||
delete PDFJS.openExternalLinksInNewWindow;
|
||||
|
@ -263,6 +263,8 @@ var Driver = (function DriverClosure() { // eslint-disable-line no-unused-vars
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
PDFJS.enableStats = true;
|
||||
PDFJS.imageResourcesPath = '/web/images/';
|
||||
// Opt-in to using the latest API.
|
||||
PDFJS.pdfjsNext = true;
|
||||
|
||||
// Set the passed options
|
||||
this.inflight = options.inflight;
|
||||
|
@ -60,6 +60,8 @@ function initializePDFJS(callback) {
|
||||
|
||||
// Configure the worker.
|
||||
displayGlobal.PDFJS.workerSrc = '../../src/worker_loader.js';
|
||||
// Opt-in to using the latest API.
|
||||
displayGlobal.PDFJS.pdfjsNext = true;
|
||||
|
||||
callback();
|
||||
});
|
||||
|
@ -117,6 +117,7 @@ function configure(PDFJS) {
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
PDFJS.cMapPacked = true;
|
||||
PDFJS.workerSrc = '../src/worker_loader.js';
|
||||
PDFJS.pdfjsNext = true;
|
||||
} else {
|
||||
PDFJS.cMapUrl = '../web/cmaps/';
|
||||
PDFJS.cMapPacked = true;
|
||||
|
Loading…
Reference in New Issue
Block a user