Skip to content

Commit

Permalink
feat: implement browsingContext.historyUpdated
Browse files Browse the repository at this point in the history
  • Loading branch information
OrKoN committed Oct 2, 2024
1 parent 97dc759 commit 5f6a2b7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 12 deletions.
41 changes: 29 additions & 12 deletions src/bidiMapper/modules/context/BrowsingContextImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,19 +425,36 @@ export class BrowsingContextImpl {
this.#url = params.url;
this.#navigation.withinDocument.resolve();

this.#eventManager.registerEvent(
{
type: 'event',
method: ChromiumBidi.BrowsingContext.EventNames.FragmentNavigated,
params: {
context: this.id,
navigation: this.#navigationId,
timestamp,
url: this.#url,
if (params.navigationType === 'fragment') {
this.#eventManager.registerEvent(
{
type: 'event',
method: ChromiumBidi.BrowsingContext.EventNames.FragmentNavigated,
params: {
context: this.id,
navigation: this.#navigationId,
timestamp,
url: this.#url,
},
},
},
this.id
);
this.id
);
}
if (params.navigationType === 'historyApi') {
this.#eventManager.registerEvent(
{
type: 'event',
// @ts-expect-error missing types
method: "browsingContext.historyUpdated",
// @ts-expect-error missing types
params: {
context: this.id,
url: this.#url,
},
},
this.id
);
}
});

this.#cdpTarget.cdpClient.on('Page.frameStartedLoading', (params) => {
Expand Down
1 change: 1 addition & 0 deletions src/protocol/chromium-bidi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ export const EVENT_NAMES = new Set([
...Object.values(Log.EventNames),
...Object.values(Network.EventNames),
...Object.values(Script.EventNames),
'browsingContext.historyUpdated'
// keep-sorted end
]);

Expand Down

0 comments on commit 5f6a2b7

Please sign in to comment.