-
Notifications
You must be signed in to change notification settings - Fork 10.1k
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
Uses document.currentScript for pdf.worker.js path. #6595
Conversation
d1e4f30
to
2e194cd
Compare
@@ -42,10 +42,8 @@ if (!PDFJS.workerSrc && typeof document !== 'undefined') { | |||
// workerSrc is not set -- using last script url to define default location |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps it would be a good idea to also add a deprecated
warning here for PRODUCTION
mode, saying that the workerSrc
should always be set to avoid issues?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This script runs on pdf.js inclusion, means user will not have ability to run his scripts before this one. Logic has to be more complicated to provide this warning and rather at worker construction.
You might also want to update the docs, https://github.com/mozilla/pdf.js/blob/master/src/display/api.js#L75-L80, to say that the |
de4451c
to
74b4560
Compare
} | ||
Object.defineProperty(document, 'currentScript', { | ||
get: function () { | ||
var scriptTagContainer = document.body || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is flawed as it might not give a <script>
tag (for async scripts). Try the following instead:
var scripts = document.getElementsByTagName('script');
return scripts[scripts.length - 1];
74b4560
to
601d29b
Compare
/botio-linux preview |
From: Bot.io (Linux)ReceivedCommand cmd_preview from @yurydelendik received. Current queue size: 0 Live output at: http://107.21.233.14:8877/d61f05d5bae62a6/output.txt |
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/d61f05d5bae62a6/output.txt Total script time: 0.74 mins Published |
/botio test |
From: Bot.io (Linux)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.21.233.14:8877/9dfbf45b11a3fcc/output.txt |
From: Bot.io (Windows)ReceivedCommand cmd_test from @Snuffleupagus received. Current queue size: 0 Live output at: http://107.22.172.223:8877/677491ca2b46715/output.txt |
From: Bot.io (Windows)SuccessFull output at http://107.22.172.223:8877/677491ca2b46715/output.txt Total script time: 18.81 mins
|
From: Bot.io (Linux)SuccessFull output at http://107.21.233.14:8877/9dfbf45b11a3fcc/output.txt Total script time: 20.50 mins
|
Uses document.currentScript for pdf.worker.js path.
Thanks for the patch! |
Addresses #6593 concern
by printing a warning in case when workerSrc is not set.