-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DataCloneError: Failed to execute 'postMessage' on 'Worker' #9840
Comments
This looks like a duplicate of issue #9166, which was caused by a bug in Angular (rather than PDF.js); please refer to angular/zone.js#980. |
This issue is related to non-existent PDF - I have an existing PDF, and the error only occurs in electron app. In Google Chrome everything works fine in my case. |
I don't think we can do anything on the PDF.js side without more information, most notably a running demo that shows the issue. Moreover, make sure |
Closing since no information shows that this is caused by PDF.js itself. All signs point to the Angular issue mentioned above, and there have been more reports of it there. |
The issue is not what the error message says, it's actually something else. Since error handling faced another exception while reporting, things got messed up. The reason for the issue is, Http module misses "require" method to be precise both Http and Https modules are empty. When using pdf.js in Chrome browser, it uses PDFFetchStream to read data whereas when using pdf.js in Electron it uses PDFNodeStream. When in Electron, to resolve Http request PDFNodeStream uses Node's Http module ( require('http') ), somehow the http variable got overwritten. Moving Http import inside PDFNodeStreamFullReader and PDFNodeStreamRangeReader solves the issue that we face. I don't know why http variable got overwritten or who is responsible for this issue as am very new to frontend development but it would be helpful if someone helps us out to resolve this problem. |
@giridharkannan I have same issue but I don't know how to move Http report to both PDFNodeStreamFullReader and PDFNodeStreamRangeReader. |
@Farbod29 if(isElectronBuild()) {
pdfjsDisplayAPI.setPDFNetworkStreamFactory((params) => {
return new PDFFetchStream(params);
});
task = getDocument(pdfUrl);
} else {
task = getDocument(pdfUrl);
}
` |
@giridharkannan thanks for prompt response,I just added task = getDocument(pdfUrl); here but I don't really know how PDF.js working didn't fix yet. |
@Farbod29 If it's not a overkill, please do share your code snippet to my mail id. And the code snippet that I gave is not be added on pdf.js's code base, rather on your code. |
Attach (recommended) or Link to PDF file here:
Configuration:
Steps to reproduce the problem:
Create Ellectron app with angular 6 + pdfjs
What is the expected behavior? (add screenshot)
PDF gets displayed
What went wrong? (add screenshot)
In Google Chrome everything works fine.
VadimDez/ng2-pdf-viewer#326
The text was updated successfully, but these errors were encountered: