Skip to content

Conversation

@maraf
Copy link
Member

@maraf maraf commented Dec 9, 2025

JavaScript part of .NET expects assets to have field hash. This PR unifies it between internal structure and boot config generated during build. It is a regression from boot config structure change from #116300.

This PR will cause failure of some tests once it flows to dotnet/sdk.
This PR will be a candidate for backport to 10.0.

Fixes #121876

@maraf maraf added this to the 11.0.0 milestone Dec 9, 2025
@maraf maraf self-assigned this Dec 9, 2025
@maraf maraf added arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm labels Dec 9, 2025
@maraf maraf changed the title [browser] Generate boot config with hash expected by javascript instead of integrity [browser] Generate boot config with hash field instead of integrity Dec 9, 2025
@maraf maraf requested a review from pavelsavara December 9, 2025 18:38
@maraf maraf marked this pull request as ready for review December 10, 2025 08:53
@maraf maraf requested a review from ilonatommy as a code owner December 10, 2025 08:53
Copilot AI review requested due to automatic review settings December 10, 2025 08:53
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a regression from #116300 by renaming the integrity field to hash in the boot configuration classes and their usage. The JavaScript runtime expects assets to have a hash field, which was incorrectly changed to integrity in the previous PR.

Key Changes:

  • Renamed property from integrity to hash in three asset classes: WasmAsset, GeneralAsset, and VfsAsset
  • Updated all property assignments in BootJsonBuilderHelper.cs to use the hash field name
  • Added test case to verify that assets have integrity/hash values

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonData.cs Renamed integrity property to hash in WasmAsset, GeneralAsset, and VfsAsset classes
src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs Updated all property assignments from integrity to hash when creating asset instances
src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js Added new test case "AssetIntegrity" to log integrity values for all assets via resource loader
src/mono/wasm/Wasm.Build.Tests/ModuleConfigTests.cs Added test method to verify that non-JS/non-JSON assets have integrity hash values

@maraf maraf enabled auto-merge (squash) December 10, 2025 16:01
@maraf maraf merged commit 3bb51ca into dotnet:main Dec 10, 2025
33 checks passed
@maraf maraf deleted the BrowserAssetIntegrity2 branch December 10, 2025 16:26
@maraf
Copy link
Member Author

maraf commented Dec 10, 2025

/backport to release/10.0

@github-actions
Copy link
Contributor

Started backporting to release/10.0 (link to workflow run)

@github-actions
Copy link
Contributor

@maraf backporting to release/10.0 failed, the patch most likely resulted in conflicts. Please backport manually!

git am output
$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Generate boot config with hash expected by javascript instead of integrity
Using index info to reconstruct a base tree...
M	src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js
M	src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs
Falling back to patching base and 3-way merge...
Auto-merging src/mono/wasm/testassets/WasmBasicTestApp/App/wwwroot/main.js
Auto-merging src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs
CONFLICT (content): Merge conflict in src/tasks/Microsoft.NET.Sdk.WebAssembly.Pack.Tasks/BootJsonBuilderHelper.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
Patch failed at 0001 Generate boot config with hash expected by javascript instead of integrity
Error: The process '/usr/bin/git' failed with exit code 128

Link to workflow output

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

arch-wasm WebAssembly architecture area-Build-mono os-browser Browser variant of arch-wasm

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[browser] Integrity passed to withResourceLoader is always empty

2 participants