Skip to content

[api-minor] Stop exposing the createObjectURL helper function in the API #14551

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

Merged
merged 2 commits into from
Feb 11, 2022

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Feb 10, 2022

  • Update two display_utils unit-tests to use native functionality rather than the createObjectURL helper function

    Given that most of the code-base is already using native functionality, we can update these unit-tests similarily as well.

    • For the blob:-URL test, we simply use URL.createObjectURL(...) and Blob directly instead.
    • For the data:-URL test, we simply use btoa to do the Base64 encoding and then build the final URL-string.
  • [api-minor] Stop exposing the createObjectURL helper function in the API

    With recent changes, specifically PR [api-minor] Remove support for browsers/environments without fully working URL.createObjectURL implementations #14515 and the previous patch, the createObjectURL helper function is now only used with the SVG back-end.
    All other call-sites, throughout the code-base, are now using URL.createObjectURL(...) directly and it no longer seems necessary to keep exposing the helper function in the API.
    Finally, the createObjectURL helper function is moved into the src/display/svg.js file to avoid unnecessarily duplicating this code on both the main- and worker-threads.

…her than the `createObjectURL` helper function

Given that most of the code-base is already using native functionality, we can update these unit-tests similarily as well.
 - For the `blob:`-URL test, we simply use `URL.createObjectURL(...)` and `Blob` directly instead.
 - For the `data:`-URL test, we simply use `btoa` to do the Base64 encoding and then build the final URL-string.
…e API

With recent changes, specifically PR 14515 *and* the previous patch, the `createObjectURL` helper function is now only used with the SVG back-end.
All other call-sites, throughout the code-base, are now using `URL.createObjectURL(...)` directly and it no longer seems necessary to keep exposing the helper function in the API.
Finally, the `createObjectURL` helper function is moved into the `src/display/svg.js` file to avoid unnecessarily duplicating this code on both the main- and worker-threads.
@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.241.84.105:8877/18156cc1ae166ba/output.txt

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

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/18156cc1ae166ba/output.txt

Total script time: 24.06 mins

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

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

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

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

Total script time: 25.47 mins

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

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

@Snuffleupagus
Copy link
Collaborator Author

Snuffleupagus commented Feb 10, 2022

I don't really understand these Windows-only regressions, since testing in e.g. PR #14547 didn't fail.
My best guess, based on a recent mozilla-central pushlog, is that this could be connected to https://bugzilla.mozilla.org/show_bug.cgi?id=1587094 given that the commit message in https://phabricator.services.mozilla.com/D137584 explicitly mentions a new default behaviour on Windows.

@timvandermeij timvandermeij merged commit e9fd67a into mozilla:master Feb 11, 2022
@timvandermeij
Copy link
Contributor

Looks good; thank you for improving this!

@Snuffleupagus Snuffleupagus deleted the mv-createObjectURL branch February 11, 2022 18:51
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