File tree Expand file tree Collapse file tree 1 file changed +15
-11
lines changed
pkg/lib/cockpit/_internal Expand file tree Collapse file tree 1 file changed +15
-11
lines changed Original file line number Diff line number Diff line change @@ -164,18 +164,22 @@ export class Location {
164164 return ;
165165 const hash = '#' + this . #href_for_go_or_replace( path , options ) ;
166166
167- // At least Firefox 146 and 147 will (sometimes) trigger a
168- // full force reload of the page when setting
169- // window.location.hash, even if it hasn't actually
170- // changed. If a page accidentally navigates to the current
171- // location on initial render, this can lead to a loop. Even
172- // if that is a bug in that page, let's protect us against
173- // this. Firefox 148 does not do that anymore.
174- //
175- // See https://bugzilla.redhat.com/show_bug.cgi?id=2422331
176- //
177- if ( window . location . hash != hash )
167+ if ( navigator . userAgent . includes ( "Firefox" ) ) {
168+ // At least Firefox 146 and 147 will (sometimes) trigger a
169+ // full force reload of the page when setting
170+ // window.location.hash. We can work around that by
171+ // clicking on a link.
172+ //
173+ // https://bugzilla.mozilla.org/show_bug.cgi?id=2018546
174+
175+ const a = document . createElement ( 'a' ) ;
176+ a . href = hash ;
177+ document . body . appendChild ( a ) ;
178+ a . click ( ) ;
179+ document . body . removeChild ( a ) ;
180+ } else {
178181 window . location . hash = hash ;
182+ }
179183 }
180184
181185 invalidate ( ) {
You can’t perform that action at this time.
0 commit comments