Closed Bug 1800896 Opened 2 years ago Closed 1 month ago

Move updating the bytecode offset into SaveSRIHash or a dedicated function.

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
126 Branch
Tracking Status
firefox126 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Currently the ScriptLoadRequest::mBytecodeOffset is updated after saving the SRI hash in the mScriptBytecode field.

However, the mBytecodeOffset is here to encode the space taken by the SRI and the bytecode padding. We could move the resize of the buffer to a dedicated function, or into ScriptLoader::SaveSRIHash to simplify reading the code and better understand the relationship between mBytecodeOffset and SRI.

When saving the SRI Hash, we resize the btyecode buffer to the expected size of
the buffer. Previously, after saving the bytecode, the code surrounding
SaveSRIHash introduced the padding necessary for potentially saving bytecode
after.

This patch move the padding into SaveSRIHash, to reduce the overhead of
understanding why the btyecode buffer is being manipulated in what seems to be
out-of-context. Moving it into SaveSRIHash might seems strange but it closer to
other actions to the bytecode buffer which makes it less unexpected.

Assignee: nobody → nicolas.b.pierron
Status: NEW → ASSIGNED

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:nbp, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(nicolas.b.pierron)
Flags: needinfo?(arai.unmht)
Flags: needinfo?(nicolas.b.pierron)
Flags: needinfo?(arai.unmht)
Pushed by smolnar@mozilla.com:
https://hg.mozilla.org/mozilla-central/rev/27aff6b9e920
Move padding of the bytecode vector into SaveSRIHash. r=arai
https://hg.mozilla.org/mozilla-central/rev/615cec132182
1882789, 1882793: apply code formatting via Lando
Status: ASSIGNED → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 126 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: