1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-22 16:18:08 +02:00

Prevent browser exceptions from incorrectly triggering the assert in PDFPageProxy._abortOperatorList (PR 11069 follow-up)

For certain canvas-related errors (and probably others), the browser rendering exceptions may be propagated "as-is" to the PDF.js code. In this case, the exceptions are of the somewhat cryptic `NS_ERROR_FAILURE` type.
Unfortunately these aren't actual `Error`s, which thus ends up unintentionally triggering the `assert` in `PDFPageProxy._abortOperatorList`; sorry about that!
This commit is contained in:
Jonas Jenwald 2019-11-07 11:37:48 +01:00
parent 4e0b02025f
commit 98f570c103

View file

@ -1378,7 +1378,8 @@ class PDFPageProxy {
* @private
*/
_abortOperatorList({ intentState, reason, force = false, }) {
assert(reason instanceof Error,
assert(reason instanceof Error ||
(typeof reason === 'object' && reason !== null),
'PDFPageProxy._abortOperatorList: Expected "reason" argument.');
if (!intentState.streamReader) {