Skip to content

Commit e88f8d6

Browse files
authored
[Blazor] Opt-in to use dotnet.boot.js (#60751)
1 parent 29f7f32 commit e88f8d6

File tree

18 files changed

+30
-7
lines changed

18 files changed

+30
-7
lines changed

src/Components/WebAssembly/Directory.Build.props

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,8 @@
44
<!-- Avoid source build issues with WebAssembly -->
55
<ExcludeFromSourceOnlyBuild>true</ExcludeFromSourceOnlyBuild>
66
</PropertyGroup>
7+
8+
<PropertyGroup>
9+
<WasmBootConfigFileName>dotnet.boot.js</WasmBootConfigFileName>
10+
</PropertyGroup>
711
</Project>

src/Components/WebAssembly/testassets/CustomBasePathApp/wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
</head>
1010
<body>
1111
<app>Loading...</app>
12+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
1213
<script src="_framework/blazor.webassembly.js"></script>
1314
</body>
1415
</html>

src/Components/WebAssembly/testassets/HostedInAspNet.Client/wwwroot/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<body>
88
<app>Loading...</app>
99
<script src="customJsFileForTests.js"></script>
10+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
1011
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
1112

1213
<!--
@@ -16,7 +17,7 @@
1617
<script>
1718
Blazor.start({
1819
loadBootResource: function (type, name, defaultUri, integrity) {
19-
return type === 'dotnetjs'
20+
return type === 'dotnetjs' || type === 'manifest'
2021
? `${defaultUri}?customizedbootresource=true`
2122
: fetch(defaultUri, { integrity: integrity, cache: 'no-cache', headers: { 'customizedbootresource': 'true' } });
2223
},

src/Components/WebAssembly/testassets/StandaloneApp/wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<a class="dismiss">🗙</a>
2020
</div>
2121

22+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
2223
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
2324
<script>
2425
(function(){

src/Components/WebAssembly/testassets/ThreadingApp.Server/Components/App.razor

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
<a class="dismiss">🗙</a>
2020
</div>
2121

22+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
2223
<script src="@Assets["_framework/blazor.web.js"]"></script>
2324
</body>
2425

src/Components/WebAssembly/testassets/ThreadingApp/wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<a class="dismiss">🗙</a>
1919
</div>
2020

21+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
2122
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
2223
<script>
2324
(function(){

src/Components/WebAssembly/testassets/Wasm.Prerendered.Server/Pages/_Layout.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
<body>
1414
@RenderBody()
1515

16+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
1617
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
1718
<script>
1819
function start() {

src/Components/test/E2ETest/Tests/BootResourceCachingTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public void CachesResourcesAfterFirstLoad()
4343
Navigate("/");
4444
WaitUntilLoaded();
4545
var initialResourcesRequested = GetAndClearRequestedPaths();
46-
Assert.NotEmpty(initialResourcesRequested.Where(path => path.EndsWith("/blazor.boot.json", StringComparison.Ordinal)));
46+
Assert.NotEmpty(initialResourcesRequested.Where(path => path.Contains(".boot.js", StringComparison.Ordinal)));
4747
Assert.NotEmpty(initialResourcesRequested.Where(path =>
4848
path.Contains("/dotnet.native.", StringComparison.Ordinal) &&
4949
path.EndsWith(".wasm", StringComparison.Ordinal)));
@@ -52,14 +52,14 @@ public void CachesResourcesAfterFirstLoad()
5252
!path.Contains("/dotnet.native.", StringComparison.Ordinal) &&
5353
path.EndsWith(".wasm", StringComparison.Ordinal)));
5454

55-
// On subsequent loads, we skip the items referenced from blazor.boot.json
55+
// On subsequent loads, we skip the items referenced from blazor.boot.json or dotnet.boot.js
5656
// which includes .wasm (original .dll) files and dotnet.native.[fingerprint].wasm
5757
Navigate("about:blank");
5858
Browser.Equal(string.Empty, () => Browser.Title);
5959
Navigate("/");
6060
WaitUntilLoaded();
6161
var subsequentResourcesRequested = GetAndClearRequestedPaths();
62-
Assert.NotEmpty(initialResourcesRequested.Where(path => path.EndsWith("/blazor.boot.json", StringComparison.Ordinal)));
62+
Assert.NotEmpty(initialResourcesRequested.Where(path => path.Contains(".boot.js", StringComparison.Ordinal)));
6363
Assert.DoesNotContain(subsequentResourcesRequested, path =>
6464
path.Contains("/dotnet.native.", StringComparison.Ordinal) &&
6565
path.EndsWith(".wasm", StringComparison.Ordinal));

src/Components/test/testassets/BasicTestApp/wwwroot/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
return Blazor.runtime.runtimeBuildInfo.buildConfiguration;
5454
}
5555
</script>
56+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
5657
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
5758

5859
<script>

src/Components/test/testassets/Components.TestServer/Pages/Client/MultipleComponentsLayout.cshtml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
<button id="load-boot-script" onclick="start()">Load boot script</button>
3535

36+
<script>window["__DOTNET_INTERNAL_BOOT_CONFIG_SRC"] = "dotnet.boot.js";</script>
3637
<script src="_framework/blazor.webassembly.js" autostart="false"></script>
3738
<script src="js/jsRootComponentInitializers.js"></script>
3839
<script>

0 commit comments

Comments
 (0)