[api-minor] Convert getFieldObjects to return data in a Map - #21671
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #21671 +/- ##
==========================================
- Coverage 90.00% 90.00% -0.01%
==========================================
Files 263 263
Lines 66861 66861
==========================================
- Hits 60177 60176 -1
- Misses 6684 6685 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
07e773e to
b606579
Compare
|
/botio browsertest |
From: Bot.io (Windows)ReceivedCommand cmd_browsertest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.193.163.58:8877/5d841a3b74051e1/output.txt |
From: Bot.io (Linux m4)ReceivedCommand cmd_browsertest from @Snuffleupagus received. Current queue size: 0 Live output at: http://54.241.84.105:8877/b839e6a4d9f7903/output.txt |
From: Bot.io (Linux m4)SuccessFull output at http://54.241.84.105:8877/b839e6a4d9f7903/output.txt Total script time: 17.98 mins
|
From: Bot.io (Windows)SuccessFull output at http://54.193.163.58:8877/5d841a3b74051e1/output.txt Total script time: 23.42 mins
|
5caca2f to
e27566a
Compare
e27566a to
d227b01
Compare
Compared to regular Objects there's a number of advantages to using Maps: - They support proper iteration. - They have a simple way to check for the existence of data. - They have a simple/efficient way to check the number of elements. If this functionality was added today, I cannot imagine that we'd choose an Object for this data. In the Firefox PDF Viewer sending Maps to the scripting-implementation should be fine, since it uses the browser `Cu.cloneInto` functionality; see https://searchfox.org/firefox-main/source/toolkit/components/pdfjs/content/PdfSandbox.sys.mjs However with QuickJS, used by the GENERIC viewer, all data needs to be stringified and Maps are converted into regular Objects (see also PR 21664). Hence the `objects` property, in the scripting-implementation, is converted back into a Map using the (renamed) `createMap` helper function.
See commit ce4ff55
|
Nice work; thanks! |
Compared to regular Objects there's a number of advantages to using Maps:
If this functionality was added today, I cannot imagine that we'd choose an Object for this data.
In the Firefox PDF Viewer sending Maps to the scripting-implementation should be fine, since it uses the browser
Cu.cloneIntofunctionality; see https://searchfox.org/firefox-main/source/toolkit/components/pdfjs/content/PdfSandbox.sys.mjsHowever with QuickJS, used by the GENERIC viewer, all data needs to be stringified and Maps are converted into regular Objects (see also PR #21664). Hence the
objectsproperty, in the scripting-implementation, is converted back into a Map using the (renamed)createMaphelper function.Smaller diff with https://github.com/mozilla/pdf.js/pull/21671/changes?w=1