Skip to content

PROD-1184 fixed pdf loading issue in textbook - #22920

Merged
AhtishamShahid merged 1 commit into
masterfrom
ahtisham/PROD-1184
Jan 29, 2020
Merged

PROD-1184 fixed pdf loading issue in textbook#22920
AhtishamShahid merged 1 commit into
masterfrom
ahtisham/PROD-1184

Conversation

@AhtishamShahid

@AhtishamShahid AhtishamShahid commented Jan 23, 2020

Copy link
Copy Markdown
Contributor

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
Copy Markdown

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

@DawoudSheraz

Copy link
Copy Markdown
Contributor

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

@AhtishamShahid

Copy link
Copy Markdown
Contributor Author

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

The link is added in the description.

@DawoudSheraz

Copy link
Copy Markdown
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?

<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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

5 participants