Skip to content

feat(web-contents): add bypassCache option to navigationHistory.restore#52152

Draft
panther7 wants to merge 1 commit into
electron:mainfrom
panther7:navigationhistory-restore-bypasscache
Draft

feat(web-contents): add bypassCache option to navigationHistory.restore#52152
panther7 wants to merge 1 commit into
electron:mainfrom
panther7:navigationhistory-restore-bypasscache

Conversation

@panther7

@panther7 panther7 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Description of Change

navigationHistory.restore() currently loads the restored entry via LoadIfNecessary(), which serves the page from the HTTP cache without contacting the server. This means that conditions requiring a live network request — such as an expired or changed TLS certificate — are not re-evaluated and the corresponding events (e.g. certificate-error) are never fired.

This PR adds an optional bypassCache boolean parameter (default false) to navigationHistory.restore(). When set to true, the restored entry is loaded via content::ReloadType::BYPASSING_CACHE instead of LoadIfNecessary(), forcing a fresh network request so that certificate errors and other network failures surface normally.

Before:

await contents.navigationHistory.restore({ entries, index });
// TLS certificate is never re-checked — certificate-error won't fire

After:

await contents.navigationHistory.restore({ entries, index, bypassCache: true });
// Forces a network request — certificate-error fires if cert is invalid/expired

Checklist

Release Notes

Notes: Added bypassCache option to navigationHistory.restore() to force a fresh network request when restoring navigation history, allowing certificate errors and other network failures to surface normally.

@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Jun 26, 2026
@panther7

panther7 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Tested on Windows and 42-x-y branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new-pr 🌱 PR opened recently

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant