-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Closed
Labels
Pillar: Complete Blazor Webarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-jsinteropThis issue is related to JSInterop in BlazorThis issue is related to JSInterop in Blazorfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssembly
Milestone
Description
Below is list of usages of legacy interop.
- Usage of
BINDING.call_assembly_entry_point
await BINDING.call_assembly_entry_point(assemblyName, emptyArray, 'm'); - this one is most problematic because it uses
eval()
which is CSP blocker
- Usage of
BINDING.js_string_to_mono_string
ininvokeJSFromDotNet
return resultJson === null ? 0 : BINDING.js_string_to_mono_string(resultJson); return BINDING.js_string_to_mono_string(resultJson); - this is potentially just dead code, if the user code doesn't use the obsolete
IJSUnmarshalledRuntime
- but I don't fully understand
jsCallDispatcher
andinvokeJSJson
use-cases
- usage of
BINDING.unbox_mono_obj
andBINDING.conv_string
inreadStringField
which is part ofrenderBatch
const unboxedValue = BINDING.unbox_mono_obj(fieldValue as any as System_Object); decodedString = BINDING.conv_string(fieldValue as any as System_String); decodedString = BINDING.conv_string(fieldValue as any as System_String); - this is problematic from GC safety, for which we do have stop-gap solution.
- this is probably not a problem for CSP as there is no bind/invoke and no
eval()
-
MonoHeapLock.stringCache
is pointer hazardcurrentHeapLock.stringCache.set(fieldValue, decodedString); - because
BINDING.conv_string
is already caching interned strings by their pointer (because they never move on GC) - any other strings do move and could be even collected, so the pointer could be pointing at different object and produce a) invalid value or b) crash even in single threaded app
- this is problematic from MT GC safety, for which we do have stop-gap solution.
All of the uses prevent users trimming legacy interop dead code with <WasmEnableLegacyJsInterop>false</WasmEnableLegacyJsInterop>
veikkoeeva
Metadata
Metadata
Assignees
Labels
Pillar: Complete Blazor Webarea-blazorIncludes: Blazor, Razor ComponentsIncludes: Blazor, Razor ComponentsenhancementThis issue represents an ask for new feature or an enhancement to an existing oneThis issue represents an ask for new feature or an enhancement to an existing onefeature-blazor-jsinteropThis issue is related to JSInterop in BlazorThis issue is related to JSInterop in Blazorfeature-blazor-wasmThis issue is related to and / or impacts Blazor WebAssemblyThis issue is related to and / or impacts Blazor WebAssembly