Skip to content

Commit

Permalink
fix(firefox): remove setTimeout from onLocationChange (#511)
Browse files Browse the repository at this point in the history
* fix(firefox): removed settimeout to fix error on firefox

* test(firefox): add scripts

---------

Co-authored-by: gioboa <giorgiob.boa@gmail.com>
  • Loading branch information
emish89 and gioboa authored Dec 29, 2023
1 parent 1ce9abc commit eac85b8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@
"test.atomics": "playwright test tests/integrations tests/platform --config playwright.atomics.config.ts --browser=chromium",
"test.chromium": "playwright test tests/integrations tests/platform --browser=chromium",
"test.webkit": "playwright test tests/integrations tests/platform --browser=webkit",
"test.firefox": "playwright test tests/integrations tests/platform --browser=firefox",
"test.nextjs.chromium": "cd tests/nextjs && npm i && playwright test --config playwright.nextjs.ts --browser=chromium",
"test.nextjs.webkit": "cd tests/nextjs && npm i && playwright test --config playwright.nextjs.ts --browser=webkit",
"test.nextjs.firefox": "cd tests/nextjs && npm i && playwright test --config playwright.nextjs.ts --browser=firefox",
"benchmark": "node tests/benchmarks/run.cjs",
"test.unit": "uvu -r tsm tests/unit",
"tsc.watch": "tsc -w",
Expand Down
24 changes: 11 additions & 13 deletions src/lib/sandbox/main-register-window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,19 +57,17 @@ export const registerWindow = (

const onLocationChange =
(type: LocationUpdateType, state: object, newUrl?: string, oldUrl?: string) => () => {
setTimeout(() => {
worker.postMessage([
WorkerMessageType.LocationUpdate,
{
$winId$,
type,
state,
url: doc.baseURI,
newUrl,
oldUrl,
},
]);
});
worker.postMessage([
WorkerMessageType.LocationUpdate,
{
$winId$,
type,
state,
url: doc.baseURI,
newUrl,
oldUrl,
},
]);
};

history.pushState = (state, _, newUrl) => {
Expand Down

1 comment on commit eac85b8

@vercel
Copy link

@vercel vercel bot commented on eac85b8 Dec 29, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.