Merge pull request #8157 from Snuffleupagus/api-RenderTask-cancel-Error

[api-minor] Reject the `RenderTask` with an actual `Error`, instead of just a `string`, when rendering is cancelled
This commit is contained in:
Yury Delendik 2017-04-04 09:38:47 -05:00 committed by GitHub
commit 31f8875614
12 changed files with 106 additions and 20 deletions

View file

@ -176,6 +176,19 @@ var CustomStyle = (function CustomStyleClosure() {
return CustomStyle;
})();
var RenderingCancelledException = (function RenderingCancelledException() {
function RenderingCancelledException(msg, type) {
this.message = msg;
this.type = type;
}
RenderingCancelledException.prototype = new Error();
RenderingCancelledException.prototype.name = 'RenderingCancelledException';
RenderingCancelledException.constructor = RenderingCancelledException;
return RenderingCancelledException;
})();
var hasCanvasTypedArrays;
if (typeof PDFJSDev === 'undefined' ||
!PDFJSDev.test('FIREFOX || MOZCENTRAL || CHROME')) {
@ -308,6 +321,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);
}
@ -338,6 +353,7 @@ exports.isExternalLinkTargetSet = isExternalLinkTargetSet;
exports.isValidUrl = isValidUrl;
exports.getFilenameFromUrl = getFilenameFromUrl;
exports.LinkTarget = LinkTarget;
exports.RenderingCancelledException = RenderingCancelledException;
exports.hasCanvasTypedArrays = hasCanvasTypedArrays;
exports.getDefaultSetting = getDefaultSetting;
exports.DEFAULT_LINK_REL = DEFAULT_LINK_REL;