Skip to content

[browser] Pass configured config name to loadBootResource #113210

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 1 commit into from
Mar 6, 2025
Merged
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
13 changes: 7 additions & 6 deletions src/mono/browser/runtime/loader/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export async function mono_wasm_load_config (module: DotnetModuleInternal): Prom
// Temporal way for tests to opt-in for using boot.js
module.configSrc = (globalThis as any)["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"]
?? globalThis.window?.document?.documentElement?.getAttribute("data-dotnet_internal_boot_config_src")
?? "./blazor.boot.json";
?? "blazor.boot.json";
}

configFilePath = module.configSrc;
Expand Down Expand Up @@ -290,21 +290,22 @@ export function isDebuggingSupported (): boolean {
}

async function loadBootConfig (module: DotnetModuleInternal): Promise<void> {
const defaultConfigSrc = loaderHelpers.locateFile(module.configSrc!);
const defaultConfigSrc = module.configSrc!;
const defaultConfigUrl = loaderHelpers.locateFile(defaultConfigSrc);

let loaderResponse = null;
if (loaderHelpers.loadBootResource !== undefined) {
loaderResponse = loaderHelpers.loadBootResource("manifest", "blazor.boot.json", defaultConfigSrc, "", "manifest");
loaderResponse = loaderHelpers.loadBootResource("manifest", defaultConfigSrc, defaultConfigUrl, "", "manifest");
}

let loadedConfigResponse: Response | null = null;
let loadedConfig: MonoConfig;
if (!loaderResponse) {
if (defaultConfigSrc.includes(".json")) {
loadedConfigResponse = await fetchBootConfig(appendUniqueQuery(defaultConfigSrc, "manifest"));
if (defaultConfigUrl.includes(".json")) {
loadedConfigResponse = await fetchBootConfig(appendUniqueQuery(defaultConfigUrl, "manifest"));
loadedConfig = await readBootConfigResponse(loadedConfigResponse);
} else {
loadedConfig = (await import(appendUniqueQuery(defaultConfigSrc, "manifest"))).config;
loadedConfig = (await import(appendUniqueQuery(defaultConfigUrl, "manifest"))).config;
}
} else if (typeof loaderResponse === "string") {
if (loaderResponse.includes(".json")) {
Expand Down
Loading