Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmod committed Nov 22, 2024
1 parent a1a1c93 commit 5d36fdc
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions reporting/src/request/page-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,17 +243,26 @@ export default class PageStore {
#onNavigationErrorOccured = (details) => {
const { frameId, tabId, url, error } = details;

if (frameId !== 0) {
if (frameId !== 0 || !url.startsWith('http')) {
return;
}

// navigation aborted most likely due to redirect
// revert to previous page as soon a new navigation will start
/**
*
On Firefox some navigation can trigger following event sequence:
* onBeforeNavigate
* onErrorOccurred with "error":"Error code 2152398850"
* onBeforeNavigate
* onCommitted
That was causing an extra page object to be created which was messing up the previous page logic.
*/
if (error === 'Error code 2152398850') {
const page = this.#pages.get(tabId);

if (page && page.url === url) {
this.#pages.set(tabId, page.previous);
this.#pages.delete(tabId);
}
}
};
Expand Down

0 comments on commit 5d36fdc

Please sign in to comment.