feat: Restore webContents navigation history and page state (#45583)

* feat: Working navigationHistory.restore with just title/url

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* feat: Restore page state, too

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* chore: Docs, lint, tests

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Implement feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* More magic

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Make _awaitNextLoad truly private

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* Implement API group feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

* One more round of feedback

Co-authored-by: Felix Rieseberg <fr@makenotion.com>

---------

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Felix Rieseberg <fr@makenotion.com>
This commit is contained in:
trop[bot] 2025-02-17 11:23:18 +01:00 committed by GitHub
parent b2b59a6c0b
commit 9a7f27d845
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 259 additions and 10 deletions

View file

@ -87,6 +87,7 @@ declare namespace Electron {
}
interface WebContents {
_awaitNextLoad(expectedUrl: string): Promise<void>;
_loadURL(url: string, options: ElectronInternal.LoadURLOptions): void;
getOwnerBrowserWindow(): Electron.BrowserWindow | null;
getLastWebPreferences(): Electron.WebPreferences | null;
@ -115,6 +116,7 @@ declare namespace Electron {
_goToIndex(index: number): void;
_removeNavigationEntryAtIndex(index: number): boolean;
_getHistory(): Electron.NavigationEntry[];
_restoreHistory(index: number, entries: Electron.NavigationEntry[]): void
_clearHistory():void
canGoToIndex(index: number): boolean;
destroy(): void;