File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
src/native/corehost/browserhost/loader Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 33
44import type { LoaderConfig , DotnetHostBuilder } from "./types" ;
55
6+ import { exceptions , simd } from "wasm-feature-detect" ;
7+
68import { GlobalizationMode } from "./types" ;
79import { ENVIRONMENT_IS_NODE , ENVIRONMENT_IS_SHELL } from "./per-module" ;
810import { nodeFs } from "./polyfills" ;
@@ -14,6 +16,11 @@ const modulesUniqueQuery = queryIndex > 0 ? scriptUrlQuery.substring(queryIndex)
1416const scriptUrl = normalizeFileUrl ( scriptUrlQuery ) ;
1517const scriptDirectory = normalizeDirectoryUrl ( scriptUrl ) ;
1618
19+ export async function validateWasmFeatures ( ) : Promise < void > {
20+ dotnetAssert . check ( await exceptions , "This browser/engine doesn't support WASM exception handling. Please use a modern version. See also https://aka.ms/dotnet-wasm-features" ) ;
21+ dotnetAssert . check ( await simd , "This browser/engine doesn't support WASM SIMD. Please use a modern version. See also https://aka.ms/dotnet-wasm-features" ) ;
22+ }
23+
1724export function locateFile ( path : string , isModule = false ) : string {
1825 let res ;
1926 if ( isPathAbsolute ( path ) ) {
Original file line number Diff line number Diff line change 44import type { DotnetHostBuilder , JsModuleExports , EmscriptenModuleInternal } from "./types" ;
55
66import { dotnetAssert , dotnetGetInternals , dotnetBrowserHostExports , Module } from "./cross-module" ;
7- import { findResources , isNodeHosted , isShellHosted } from "./bootstrap" ;
7+ import { findResources , isNodeHosted , isShellHosted , validateWasmFeatures } from "./bootstrap" ;
88import { exit , runtimeState } from "./exit" ;
99import { createPromiseCompletionSource } from "./promise-completion-source" ;
1010import { getIcuResourceName } from "./icu" ;
@@ -30,11 +30,12 @@ export async function createRuntime(downloadOnly: boolean): Promise<any> {
3030 const config = getLoaderConfig ( ) ;
3131 if ( ! config . resources || ! config . resources . coreAssembly || ! config . resources . coreAssembly . length ) throw new Error ( "Invalid config, resources is not set" ) ;
3232
33-
3433 if ( typeof Module . onConfigLoaded === "function" ) {
3534 await Module . onConfigLoaded ( config ) ;
3635 }
3736
37+ await validateWasmFeatures ( ) ;
38+
3839 if ( config . resources . jsModuleDiagnostics && config . resources . jsModuleDiagnostics . length > 0 ) {
3940 const diagnosticsModule = await loadJSModule ( config . resources . jsModuleDiagnostics [ 0 ] ) ;
4041 diagnosticsModule . dotnetInitializeModule < void > ( dotnetGetInternals ( ) ) ;
You can’t perform that action at this time.
0 commit comments