[Pkg-javascript-commits] [pdf.js] 12/109: Serialize errors before invoking postMessage

David Prévot taffit at moszumanska.debian.org
Fri Sep 25 03:04:12 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository pdf.js.

commit 1e3078d6c40381f30768d982b681d0851709b86c
Author: Rob Wu <rob at robwu.nl>
Date:   Sat Aug 8 21:41:33 2015 +0200

    Serialize errors before invoking postMessage
    
    Serialize errors to make sure that the callback is still invoked when
    an error is thrown.
    
    Firefox:
    "DataCloneError: The object could not be cloned."
    
    Chrome:
    "DataCloneError: Failed to execute 'postMessage' on 'WorkerGlobalScope': An object could not be cloned."
---
 src/shared/util.js | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/shared/util.js b/src/shared/util.js
index 7edd0c2..b003b4a 100644
--- a/src/shared/util.js
+++ b/src/shared/util.js
@@ -1504,6 +1504,10 @@ function MessageHandler(name, comObj) {
             data: result
           });
         }, function (reason) {
+          if (reason instanceof Error) {
+            // Serialize error to avoid "DataCloneError"
+            reason = reason + '';
+          }
           comObj.postMessage({
             isReply: true,
             callbackId: data.callbackId,

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/pdf.js.git



More information about the Pkg-javascript-commits mailing list