Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Check window exists in the withApplicationArgumentsFromQuery.
  • Loading branch information
maraf committed Aug 18, 2022
commit 2d27a335e3ca85934cd904ba9cc574536e28d0a9
16 changes: 10 additions & 6 deletions src/mono/wasm/runtime/run-outer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,17 @@ class HostBuilder implements DotnetHostBuilder {

withApplicationArgumentsFromQuery(): DotnetHostBuilder {
try {
if (typeof globalThis.URLSearchParams != "undefined") {
const params = new URLSearchParams(window.location.search);
const values = params.getAll("arg");
return this.withApplicationArguments(...values);
if (!globalThis.window) {
throw new Error("Missing window to the query parameters from");
}

throw new Error("URLSearchParams is supported");

if (typeof globalThis.URLSearchParams == "undefined") {
throw new Error("URLSearchParams is supported");
}

const params = new URLSearchParams(window.location.search);
const values = params.getAll("arg");
return this.withApplicationArguments(...values);
} catch (err) {
mono_exit(1, err);
throw err;
Expand Down