mirror of
https://github.com/zen-browser/pdf.js.git
synced 2025-07-08 09:20:06 +02:00
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."
This commit is contained in:
parent
26b9205c7e
commit
1e3078d6c4
1 changed files with 4 additions and 0 deletions
|
@ -1504,6 +1504,10 @@ function MessageHandler(name, comObj) {
|
||||||
data: result
|
data: result
|
||||||
});
|
});
|
||||||
}, function (reason) {
|
}, function (reason) {
|
||||||
|
if (reason instanceof Error) {
|
||||||
|
// Serialize error to avoid "DataCloneError"
|
||||||
|
reason = reason + '';
|
||||||
|
}
|
||||||
comObj.postMessage({
|
comObj.postMessage({
|
||||||
isReply: true,
|
isReply: true,
|
||||||
callbackId: data.callbackId,
|
callbackId: data.callbackId,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue