mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge remote-tracking branch 'mozilla/version-2.0' into v2
This commit is contained in:
commit
b4e25fb2e8
18 changed files with 66 additions and 252 deletions
18
web/app.js
18
web/app.js
|
@ -55,13 +55,11 @@ function configure(PDFJS) {
|
|||
}
|
||||
if (typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PRODUCTION')) {
|
||||
PDFJS.cMapUrl = '../external/bcmaps/';
|
||||
PDFJS.cMapPacked = true;
|
||||
PDFJS.workerSrc = '../src/worker_loader.js';
|
||||
PDFJS.pdfjsNext = true;
|
||||
} else {
|
||||
PDFJS.cMapUrl = '../web/cmaps/';
|
||||
PDFJS.cMapPacked = true;
|
||||
}
|
||||
PDFJS.cMapPacked = true;
|
||||
}
|
||||
|
||||
const DefaultExternalServices = {
|
||||
|
@ -633,11 +631,6 @@ let PDFViewerApplication = {
|
|||
* is opened.
|
||||
*/
|
||||
open(file, args) {
|
||||
if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&
|
||||
(arguments.length > 2 || typeof args === 'number')) {
|
||||
return Promise.reject(
|
||||
new Error('Call of open() with obsolete signature.'));
|
||||
}
|
||||
if (this.pdfLoadingTask) {
|
||||
// We need to destroy already opened document.
|
||||
return this.close().then(() => {
|
||||
|
@ -667,12 +660,7 @@ let PDFViewerApplication = {
|
|||
|
||||
if (args) {
|
||||
for (let prop in args) {
|
||||
if ((typeof PDFJSDev === 'undefined' || !PDFJSDev.test('PDFJS_NEXT')) &&
|
||||
!PDFJS.pdfjsNext && prop === 'scale') {
|
||||
console.error('Call of open() with obsolete "scale" argument, ' +
|
||||
'please use the "defaultZoomValue" preference instead.');
|
||||
continue;
|
||||
} else if (prop === 'length') {
|
||||
if (prop === 'length') {
|
||||
this.pdfDocumentProperties.setFileSize(args[prop]);
|
||||
}
|
||||
parameters[prop] = args[prop];
|
||||
|
@ -1047,7 +1035,7 @@ let PDFViewerApplication = {
|
|||
return;
|
||||
}
|
||||
pdfDocument.getJavaScript().then((javaScript) => {
|
||||
if (javaScript.length === 0) {
|
||||
if (!javaScript) {
|
||||
return;
|
||||
}
|
||||
javaScript.some((js) => {
|
||||
|
|
|
@ -601,11 +601,6 @@ class BaseViewer {
|
|||
* @param {ScrollPageIntoViewParameters} params
|
||||
*/
|
||||
scrollPageIntoView(params) {
|
||||
if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&
|
||||
(arguments.length > 1 || typeof params === 'number')) {
|
||||
console.error('Call of scrollPageIntoView() with obsolete signature.');
|
||||
return;
|
||||
}
|
||||
if (!this.pdfDocument) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -46,22 +46,8 @@ class PDFCursorTools {
|
|||
|
||||
this._addEventListeners();
|
||||
|
||||
Promise.all([
|
||||
preferences.get('cursorToolOnLoad'),
|
||||
preferences.get('enableHandToolOnLoad')
|
||||
]).then(([cursorToolPref, handToolPref]) => {
|
||||
// If the 'cursorToolOnLoad' preference has not been set to a non-default
|
||||
// value, attempt to convert the old 'enableHandToolOnLoad' preference.
|
||||
// TODO: Remove this conversion after a suitable number of releases.
|
||||
if (handToolPref === true) {
|
||||
preferences.set('enableHandToolOnLoad', false);
|
||||
|
||||
if (cursorToolPref === CursorTool.SELECT) {
|
||||
cursorToolPref = CursorTool.HAND;
|
||||
preferences.set('cursorToolOnLoad', cursorToolPref).catch(() => { });
|
||||
}
|
||||
}
|
||||
this.switchTool(cursorToolPref);
|
||||
preferences.get('cursorToolOnLoad').then((value) => {
|
||||
this.switchTool(value);
|
||||
}).catch(() => { });
|
||||
}
|
||||
|
||||
|
|
|
@ -260,14 +260,6 @@ class PDFLinkService {
|
|||
});
|
||||
}
|
||||
} else { // Named (or explicit) destination.
|
||||
if ((typeof PDFJSDev === 'undefined' || PDFJSDev.test('GENERIC')) &&
|
||||
/^\d+$/.test(hash) && hash <= this.pagesCount) {
|
||||
console.warn('PDFLinkService_setHash: specifying a page number ' +
|
||||
'directly after the hash symbol (#) is deprecated, ' +
|
||||
`please use the "#page=${hash}" form instead.`);
|
||||
this.page = hash | 0;
|
||||
}
|
||||
|
||||
dest = unescape(hash);
|
||||
try {
|
||||
dest = JSON.parse(dest);
|
||||
|
|
|
@ -412,9 +412,7 @@ class PDFPageView {
|
|||
this.paintTask = null;
|
||||
}
|
||||
|
||||
if (((typeof PDFJSDev === 'undefined' ||
|
||||
!PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||
|
||||
error instanceof RenderingCancelledException) {
|
||||
if (error instanceof RenderingCancelledException) {
|
||||
this.error = null;
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
@ -594,13 +592,8 @@ class PDFPageView {
|
|||
let cancelled = false;
|
||||
let ensureNotCancelled = () => {
|
||||
if (cancelled) {
|
||||
if ((typeof PDFJSDev !== 'undefined' &&
|
||||
PDFJSDev.test('PDFJS_NEXT')) || PDFJS.pdfjsNext) {
|
||||
throw new RenderingCancelledException(
|
||||
'Rendering cancelled, page ' + this.id, 'svg');
|
||||
} else {
|
||||
throw 'cancelled'; // eslint-disable-line no-throw-literal
|
||||
}
|
||||
throw new RenderingCancelledException(
|
||||
'Rendering cancelled, page ' + this.id, 'svg');
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -303,9 +303,7 @@ class PDFThumbnailView {
|
|||
this.renderTask = null;
|
||||
}
|
||||
|
||||
if (((typeof PDFJSDev === 'undefined' ||
|
||||
!PDFJSDev.test('PDFJS_NEXT')) && error === 'cancelled') ||
|
||||
error instanceof RenderingCancelledException) {
|
||||
if (error instanceof RenderingCancelledException) {
|
||||
renderCapability.resolve(undefined);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue