-
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
navigator does not contain platform, therefore require('pdfjs-dist/build/pdf') leads to an error #15728
Comments
The global Hence you must have an incomplete |
Hi, My code currently only looked like this: const webex = require('webex'); the Webex API seems to create the navigator object globally. navigator.platform = '' after including the Webex API. |
In that case, please file a bug with that project since it's actually responsible for this bug. (This issue just shows why incomplete polyfills are never a good idea...)
At some point, you have to be able to assume that the environment isn't purposely misrepresenting its actual capabilities.
Maybe not, but we have multiple call-sites using @calixteman Do you think that we should try and fix this, when it's clearly not our "fault" here. |
Maybe we could just replace |
For sure we can't support everything and especially every bug from other project: our main goal is to develop the Firefox pdf viewer, so @Sven3er you should really file a bug on Webex. |
Unfortunately that wouldn't work, since normally in Node.js the global typeof navigator !== "undefined" && typeof navigator?.platform === "string" ? navigator.platform : ""; |
Oh, you're right, so as said I'd say WONTFIX. |
Hi, I am using React Native (0.66.4), and use webview to load pdf. But one of the library
|
Could it be the shim provider doesn't support it because it's deprecated? https://developer.mozilla.org/en-US/docs/Web/API/Navigator/platform Maybe pdfjs shouldn't depend on deprecated props. |
Well, that's currently the only thing that Firefox supports hence it's what we use. (Please keep in mind that the Firefox PDF Viewer is the primary development target here.) As mentioned previously in this thread, we've multiple call-sites that access the Given that this doesn't affect the built-in Firefox PDF Viewer, I cannot really justify spending my spare time trying to fix this (since I'm not getting paid to hack on the PDF.js library). |
Node 21 now has a global
The |
Attach (recommended) or Link to PDF file here:
Configuration:
Node.js 18 .12.1
Microsoft Windows 11 Home 10.0.22621
3.0.279
No
Steps to reproduce the problem:
What is the expected behavior? (add screenshot)
no error should occur
What went wrong? (add screenshot)
In line 3365 of the pdf.js file the object "navigator" does not contain the attribute "platform", therefore the following .include operations cause an error.
I would suggest changing line 3365 to 'const platform = typeof navigator.platform !== "undefined" ? navigator.platform : "";'
since not only the navigator object needs to exist.
The same should be done for legacy.
The text was updated successfully, but these errors were encountered: