Skip to content
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

PROD-1184 fixed pdf loading issue in textbook #22920

Merged
merged 1 commit into from Jan 29, 2020

Conversation

AhtishamShahid
Copy link
Contributor

@AhtishamShahid AhtishamShahid commented Jan 23, 2020

PROD-1184

Issue

PDF textbook not loading for a course on Firefox only. The same file does load in Chrome. While it may seem a valid workaround to use Chrome, to communicate to learners to use Chrome to read the PDF is not the desired user experience.

Fix

This PR fixes above mentioned issue by removing PDFJS.workerSrc call which was reduandant and replaced it with PDFJS.disableWorker = true

Test

  • Add a textbook in the course.
  • View it in the Firefox file should be visible.

Sandbox : sandbox

Click sand box link above you should be able to view pdf file in firefox browser

@AhtishamShahid AhtishamShahid force-pushed the ahtisham/PROD-1184 branch 2 times, most recently from 6c87e92 to 79ce1bd Compare January 23, 2020 08:37
@edx-status-bot
Copy link

Your PR has finished running tests. There were no failures.

@DawoudSheraz
Copy link
Contributor

@AhtishamShahid Please add a staging link where the issue is reproducible.

@AhtishamShahid
Copy link
Contributor Author

@AhtishamShahid Please add a staging link where the issue is reproducible.

The link is added in the description.

@DawoudSheraz
Copy link
Contributor

@AhtishamShahid Even though code is working but I am not understanding why executing the code in a separate thread is causing the issue. Can you please elaborate on this and/or update the PR description to reflect the decision you made?

@@ -44,12 +44,13 @@
<script type="text/javascript">
PDFJS.imageResourcesPath = "${static.url('css/vendor/pdfjs/images/') | n, js_escaped_string}";
PDFJS.workerSrc = "${static.url('js/vendor/pdfjs/pdf.worker.js') | n, js_escaped_string}";
PDFJS.disableWorker = true;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what this specifically mean? how this resolves the problem for Mozilla Firefox browser?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what this specifically mean? how this resolves the problem for Mozilla Firefox browser?

There is a browser compatibility issue with PDFJS while using it with CDNs there are other ways around, but it seems disabling worker is the simplest way to counter that problem.
@DawoudSheraz @awaisdar001

For more context, you can look into this thread.
mozilla/pdf.js#5490 (comment)

@AhtishamShahid AhtishamShahid marked this pull request as ready for review January 27, 2020 11:06
@AhtishamShahid AhtishamShahid merged commit e81cc7d into master Jan 29, 2020
@AhtishamShahid AhtishamShahid deleted the ahtisham/PROD-1184 branch January 29, 2020 08:36
@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the staging environment in preparation for a release to production.

@edx-pipeline-bot
Copy link
Contributor

EdX Release Notice: This PR has been deployed to the production environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants