Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed createURL() for Firefox #9464

Merged
merged 2 commits into from
Oct 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions contributors.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- abdallah-nour
- abhi-kr-2100
- AchThomas
- Ajayff4
- alany411
- alexlbr
Expand Down
7 changes: 6 additions & 1 deletion packages/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2844,8 +2844,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 = typeof location === "string" ? location : createHref(location);
Expand Down