Return a mock object in paintOnSvg
when SVG rendering is not supported, to prevent TypeError
s in the addons
Currently if you try to enable SVG rendering in the addons, a `TypeError` is thrown by the browser since we have code that depends on what `paintOnCanvas`/`paintOnSvg` (should) return.
This commit is contained in:
parent
9c3419de94
commit
9872660a95
@ -612,7 +612,13 @@ var PDFPageView = (function PDFPageViewClosure() {
|
||||
paintOnSvg: function PDFPageView_paintOnSvg(wrapper) {
|
||||
if (typeof PDFJSDev !== 'undefined' &&
|
||||
PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
|
||||
return Promise.resolve('SVG rendering is not supported.');
|
||||
// Return a mock object, to prevent errors such as e.g.
|
||||
// "TypeError: paintTask.promise is undefined".
|
||||
return {
|
||||
promise: Promise.reject(new Error('SVG rendering is not supported.')),
|
||||
onRenderContinue: function (cont) { },
|
||||
cancel: function () { },
|
||||
};
|
||||
} else {
|
||||
var cancelled = false;
|
||||
var ensureNotCancelled = function () {
|
||||
|
Loading…
x
Reference in New Issue
Block a user