From: Eduardo San Martin Morote Date: Tue, 12 May 2020 14:39:58 +0000 (+0200) Subject: fix: prevent error on initial navigation to //invalid X-Git-Tag: v4.0.0-alpha.12~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e72e4ba1cc7b80aa44d3958db259d9e3a351d0fd;p=thirdparty%2Fvuejs%2Frouter.git fix: prevent error on initial navigation to //invalid --- diff --git a/src/history/html5.ts b/src/history/html5.ts index 73189286..4276caaa 100644 --- a/src/history/html5.ts +++ b/src/history/html5.ts @@ -19,6 +19,8 @@ import { stripBase } from '../location' type PopStateListener = (this: Window, ev: PopStateEvent) => any +let createBaseLocation = () => location.protocol + '//' + location.host + interface StateEntry extends HistoryState { back: HistoryLocationNormalized | null current: HistoryLocationNormalized @@ -200,7 +202,7 @@ function useHistoryStateNavigation(base: string) { state: StateEntry, replace: boolean ): void { - const url = base + to.fullPath + const url = createBaseLocation() + base + to.fullPath try { // BROWSER QUIRK // NOTE: Safari throws a SecurityError when calling this function 100 times in 30 seconds