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

[browser] Fix fingerprinting and loadAllSatelliteResources=true #108190

Merged
merged 2 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/mono/browser/runtime/loader/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -375,12 +375,12 @@ export function prepareAssets () {
if (config.loadAllSatelliteResources && resources.satelliteResources) {
for (const culture in resources.satelliteResources) {
for (const name in resources.satelliteResources[culture]) {
assetsToLoad.push({
addAsset({
name,
hash: resources.satelliteResources[culture][name],
behavior: "resource",
culture
});
}, !resources.coreAssembly);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,19 @@ public SatelliteLoadingTests(ITestOutputHelper output, SharedBuildPerTestClassFi
{
}

[Fact, TestCategory("no-fingerprinting")]
public async Task LoadSatelliteAssembly()
[Theory, TestCategory("no-fingerprinting")]
[InlineData(false)]
[InlineData(true)]
public async Task LoadSatelliteAssembly(bool loadAllSatelliteResources)
{
CopyTestAsset("WasmBasicTestApp", "SatelliteLoadingTests", "App");
BuildProject("Debug");

var result = await RunSdkStyleAppForBuild(new(Configuration: "Debug", TestScenario: "SatelliteAssembliesTest"));
var result = await RunSdkStyleAppForBuild(new(
Configuration: "Debug",
TestScenario: "SatelliteAssembliesTest",
BrowserQueryString: new Dictionary<string, string> { ["loadAllSatelliteResources"] = loadAllSatelliteResources.ToString() }
));
Assert.Collection(
result.TestOutput,
m => Assert.Equal("default: hello", m),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,12 @@
public partial class SatelliteAssembliesTest
{
[JSExport]
public static async Task Run()
public static async Task Run(bool loadSatelliteAssemblies)
{
ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, false);

await LoadSatelliteAssemblies(new[] { "es-ES" });
if (loadSatelliteAssemblies)
await LoadSatelliteAssemblies(new[] { "es-ES" });

ResourceLibrary.ResourceAccessor.Read(TestOutput.WriteLine, true);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ dotnet

// Modify runtime start based on test case
switch (testCase) {
case "SatelliteAssembliesTest":
if (params.get("loadAllSatelliteResources") === "true") {
dotnet.withConfig({ loadAllSatelliteResources: true });
}
break;
case "AppSettingsTest":
dotnet.withApplicationEnvironment(params.get("applicationEnvironment"));
break;
Expand Down Expand Up @@ -141,7 +146,7 @@ const assemblyExtension = Object.keys(config.resources.coreAssembly)[0].endsWith
try {
switch (testCase) {
case "SatelliteAssembliesTest":
await exports.SatelliteAssembliesTest.Run();
await exports.SatelliteAssembliesTest.Run(params.get("loadAllSatelliteResources") !== "true");
exit(0);
break;
case "LazyLoadingTest":
Expand Down
Loading