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

Break import cycles, in the viewer, for PDFViewerApplication #17646

Merged
merged 3 commits into from
Feb 10, 2024

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Feb 9, 2024

Currently the web/app.js file pulls in various build-specific dependencies, via the use of import maps, and those files in turn import from web/app.js thus creating undesirable import cycles.
To avoid this we instead pass in a PDFViewerApplication-reference, immediately after it's been created, to the relevant code.

Note that we use an ESLint plugin rule, see import/no-cycle, that is normally able to catch import cycles. However, in this case import maps are involved which is why this wasn't caught.

This is very old code, which can (ever so slightly) be simplified now that import maps are available.
With the changes in PR 17588 we're already importing the relevant code via the `web/app.js` file.
@Snuffleupagus
Copy link
Collaborator Author

/botio-linux preview

@moz-tools-bot
Copy link
Collaborator

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/dd6cb06c6d90fa5/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Success

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

Total script time: 1.21 mins

Published

@Snuffleupagus
Copy link
Collaborator Author

/botio test

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Received

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

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

@moz-tools-bot
Copy link
Collaborator

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/d72b2ad9281884e/output.txt

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Linux m4)


Failed

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

Total script time: 24.89 mins

  • Unit tests: Passed
  • Integration Tests: Passed
  • Regression tests: FAILED
  different ref/snapshot: 11
  different first/second rendering: 2

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

@moz-tools-bot
Copy link
Collaborator

From: Bot.io (Windows)


Failed

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

Total script time: 39.86 mins

  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 3

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

@Snuffleupagus Snuffleupagus marked this pull request as ready for review February 9, 2024 15:34
Copy link
Contributor

@timvandermeij timvandermeij left a comment

Choose a reason for hiding this comment

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

Looks good to me, with one question. Thanks!

web/genericcom.js Outdated Show resolved Hide resolved
Currently the `web/app.js` file pulls in various build-specific dependencies, via the use of import maps, and those files in turn import from `web/app.js` thus creating undesirable import cycles.
To avoid this we instead pass in a `PDFViewerApplication`-reference, immediately after it's been created, to the relevant code.

Note that we use an ESLint plugin rule, see `import/no-cycle`, that is normally able to catch import cycles. However, in this case import maps are involved which is why this wasn't caught.
@Snuffleupagus Snuffleupagus removed the request for review from calixteman February 10, 2024 22:17
@Snuffleupagus Snuffleupagus merged commit 485e9ce into mozilla:master Feb 10, 2024
9 checks passed
@Snuffleupagus Snuffleupagus deleted the app-break-import-cycles branch February 10, 2024 22:22
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