From: Steffen Märcker Date: Wed, 28 Dec 2011 08:10:06 +0000 (+0100) Subject: Added fallback to fake worker if serialization of typed array fails. X-Git-Url: https://git.parisson.com/?a=commitdiff_plain;h=fdcc4ca590d3ec14222c6e61548ea59c52e5c437;p=pdf.js.git Added fallback to fake worker if serialization of typed array fails. This happens e.g. in Opera 11.60. --- diff --git a/src/core.js b/src/core.js index 93cbc72..bf221b4 100644 --- a/src/core.js +++ b/src/core.js @@ -605,7 +605,13 @@ var PDFDoc = (function PDFDocClosure() { }.bind(this)); var testObj = new Uint8Array(1); - messageHandler.send('test', testObj); + // Some versions of Opera throw a DATA_CLONE_ERR on serializing the typed array. + // If such an error occurs, we fallback to a faked worker. + try { + messageHandler.send('test', testObj); + } catch (e) { + this.setupFakeWorker(); + } } else { this.setupFakeWorker(); }