Skip to content

Commit

Permalink
Add error catching to firefox url query workaround (#6833)
Browse files Browse the repository at this point in the history
It appears this workaround sometimes throws a `NS_ERROR_NOT_AVAILABLE` so we add error handling for it
  • Loading branch information
ijjk authored and timneutkens committed Mar 29, 2019
1 parent 533018f commit 8b5906c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/next-server/lib/router/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ export default class Router implements IRouterInterface {
// TODO: let's remove this once the Firefox bug is resolved
if (navigator.userAgent && navigator.userAgent.match(/firefox/i)) {
window.addEventListener('unload', () => {
if (window.location.search) window.location.replace(window.location.toString())
try {
if (window.location.search) window.location.replace(window.location.toString())
} catch (_) {/* since it's a workaround, ignore */}
})
}
}
Expand Down

0 comments on commit 8b5906c

Please sign in to comment.