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

Change how src/shared/compatibility.js is imported #15510

Merged
merged 1 commit into from
Oct 1, 2022

Conversation

Snuffleupagus
Copy link
Collaborator

Currently the compatibility-file is loaded using a standard import-statement and while its code is enclosed in a pre-processor block, and thus is excluded in e.g. the MOZCENTRAL build-target, it still results in the built pdf.js/pdf.worker.js files having an effectively empty closure as a result. By moving the checks from src/shared/compatibility.js and into src/shared/util.js instead, we can load the file using a build-time require-statement and thus avoid that closure.

Note that with these changes the compatibility-file will no longer be loaded in development mode, i.e. when gulp server is used. However, this shouldn't be a big issue given that none of its included polyfills could be loaded then anyway (since require-statements are being used) and that it's really only intended for the legacy-builds of the library.

@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_preview from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/7d5a4415229546b/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/7d5a4415229546b/output.txt

Total script time: 2.13 mins

Published

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/e5559316970ad4e/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/bfb56dda5990f52/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/bfb56dda5990f52/output.txt

Total script time: 26.98 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 10
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/bfb56dda5990f52/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/e5559316970ad4e/output.txt

Total script time: 29.36 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: Passed

@Snuffleupagus Snuffleupagus changed the title Change how the src/shared/compatibility.js is imported Change how src/shared/compatibility.js is imported Sep 26, 2022
@timvandermeij
Copy link
Contributor

Looks good once the conflict is resolved; thank you!

Currently the compatibility-file is loaded using a standard `import`-statement and while its code is enclosed in a pre-processor block, and thus is excluded in e.g. the MOZCENTRAL build-target, it still results in the *built* `pdf.js`/`pdf.worker.js` files having an effectively empty closure as a result.
By moving the checks from `src/shared/compatibility.js` and into `src/shared/util.js` instead, we can load the file using a build-time `require`-statement and thus avoid that closure.

Note that with these changes the compatibility-file will no longer be loaded in development mode, i.e. when `gulp server` is used. However, this shouldn't be a big issue given that none of its included polyfills could be loaded then anyway (since `require`-statements are being used) and that it's really only intended for the `legacy`-builds of the library.
@Snuffleupagus
Copy link
Collaborator Author

/botio unittest

@pdfjsbot
Copy link

pdfjsbot commented Oct 1, 2022

From: Bot.io (Linux m4)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/45a97f6e51f9233/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 1, 2022

From: Bot.io (Windows)


Received

Command cmd_unittest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/75e515e6aad475d/output.txt

@pdfjsbot
Copy link

pdfjsbot commented Oct 1, 2022

From: Bot.io (Linux m4)


Success

Full output at http://54.241.84.105:8877/45a97f6e51f9233/output.txt

Total script time: 3.05 mins

  • Unit Tests: Passed

@pdfjsbot
Copy link

pdfjsbot commented Oct 1, 2022

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/75e515e6aad475d/output.txt

Total script time: 8.37 mins

  • Unit Tests: Passed

@Snuffleupagus Snuffleupagus merged commit a93c01a into mozilla:master Oct 1, 2022
@Snuffleupagus Snuffleupagus deleted the compatibility-loading branch October 1, 2022 11:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants