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

Add a DOMMatrix polyfill for Node.js environments (PR 13361 follow-up) #13530

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

Snuffleupagus
Copy link
Collaborator

Given that DOMMatrix is, unsurprisingly, not supported in Node.js the createMatrix helper function in src/display/pattern_helper.js is most likely broken in Node.js environments. It will obviously try to fallback to the DOMSVGFactory, however that isn't intended for Node.js usage and errors will be thrown.

Rather than trying to implement a NodeSVGFactory, this patch takes easier route of just adding a DOMMatrix polyfill using: https://www.npmjs.com/package/dommatrix
This isn't done only for simplicity, but it'll become necessary anyway since the createMatrix helper function is only temporary and will be removed in the future.

gulpfile.js Outdated Show resolved Hide resolved
@Snuffleupagus
Copy link
Collaborator Author

/botio test

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

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

Live output at: http://54.67.70.0:8877/ababe85273871b7/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

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

Live output at: http://3.101.106.178:8877/fa9791958724a1d/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.67.70.0:8877/ababe85273871b7/output.txt

Total script time: 26.27 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://3.101.106.178:8877/fa9791958724a1d/output.txt

Total script time: 30.20 mins

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

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

Copy link
Contributor

@brendandahl brendandahl left a comment

Choose a reason for hiding this comment

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

r+ with the change below

gulpfile.js Outdated Show resolved Hide resolved
Given that `DOMMatrix` is, unsurprisingly, not supported in Node.js the `createMatrix` helper function in `src/display/pattern_helper.js` is most likely broken in Node.js environments. It will obviously try to fallback to the `DOMSVGFactory`, however that isn't intended for Node.js usage and errors will be thrown.

Rather than trying to implement a `NodeSVGFactory`, this patch takes the easier route of just adding a `DOMMatrix` polyfill using: https://www.npmjs.com/package/dommatrix
This isn't done only for simplicity, but it'll become necessary anyway since the `createMatrix` helper function is only temporary and will be removed in the future.
…ory`

This is similar to all of the other factories in this file, since they *directly* throw errors.
@Snuffleupagus Snuffleupagus merged commit 5bcba78 into mozilla:master Jun 10, 2021
@Snuffleupagus Snuffleupagus deleted the DOMMatrix-Node branch June 10, 2021 19:15
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