Skip to content

馃悶 Restore web and local PDF tabs after extension reloads - #202

Open
JFWooten4 wants to merge 1 commit into
mainfrom
restore-pdf-tabs-on-reload
Open

JFWooten4 wants to merge 1 commit into
mainfrom
restore-pdf-tabs-on-reload

Conversation

@JFWooten4

Copy link
Copy Markdown
Member

Summary

Preserve open PDF tabs across unpacked-extension reloads, including local file:// PDFs and web PDFs.

  • Register each PDF's original source URL and current physical page without storing document bytes.
  • Track tab window, index, pinned state, and active state; reopen Chrome-closed tabs or refresh surviving tabs in place.
  • Support both the direct MIME-handler path and the older extension-page redirect fallback, without depending on temporary stream/blob URLs.
  • Skip local-file reopening when Chrome's Allow access to file URLs permission is disabled, and never overwrite unrelated tabs.
  • Remove intentionally closed tabs from the recovery registry, avoid duplicate tab recreation during the second recovery pass, and skip incognito persistence.
  • Add six regression tests and document the file-permission requirement.

Verification

  • Verified all six committed file changes and that the branch's Git tree differs from main.
  • Confirmed the recovery worker script parses successfully and the package manifest remains valid JSON.
  • Added tests/pdf-tab-recovery.test.mjs to npm test. Automated Node tests have not been executed in this environment.

Limitations

  • The first reload after installing this feature cannot recover tabs that an earlier viewer version never registered.
  • Local PDFs need file-scheme access permission and must still exist at the saved path.
  • Reloading a surviving tab may re-fetch the PDF; recovery does not cache PDF bytes.

Preserve the original web or local PDF URL, page position, and tab placement across unpacked extension reloads. Reopen missing viewer tabs, refresh surviving tabs, respect local file access permissions, and cover recovery with regression tests.

Co-authored-by: Codex Web <noreply@openai.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant