From 269975972b09265af72fb215927fc42b030fe938 Mon Sep 17 00:00:00 2001 From: AchThomas <6598917+AchThomas@users.noreply.github.com> Date: Mon, 24 Oct 2022 23:25:21 +0200 Subject: [PATCH] fixed createURL() for Firefox (#9464) * fixed createURL() for Firefox * Update contributors.yml --- contributors.yml | 1 + packages/router/router.ts | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/contributors.yml b/contributors.yml index bb2cdeef48..8c080886db 100644 --- a/contributors.yml +++ b/contributors.yml @@ -1,5 +1,6 @@ - abdallah-nour - abhi-kr-2100 +- AchThomas - Ajayff4 - alany411 - alexlbr diff --git a/packages/router/router.ts b/packages/router/router.ts index b409ffc38c..df3fcd330f 100644 --- a/packages/router/router.ts +++ b/packages/router/router.ts @@ -3060,8 +3060,13 @@ function getTargetMatch( } function createURL(location: Location | string): URL { + // window.location.origin is "null" (the literal string value) in Firefox under certain conditions + // https://bugzilla.mozilla.org/show_bug.cgi?id=878297 + // this breaks the app when a production build is served from the local file system let base = - typeof window !== "undefined" && typeof window.location !== "undefined" + typeof window !== "undefined" && + typeof window.location !== "undefined" && + window.location.origin !== "null" ? window.location.origin : "unknown://unknown"; let href =