mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-19 22:58:07 +02:00
[CRX] Remove restoretab.js logic
restoretab.js was added in https://github.com/mozilla/pdf.js/pull/6233 with the purpose of restoring lost tabs when Chrome closes all extension tabs when it reloads the extension. This forced reload can happen when the user toggles the "Allow access to file URLs" option. This logic does not work any more, and since the use of localStorage is a blocker in migrating to MV3, this patch just drops the logic.
This commit is contained in:
parent
23bc46d51a
commit
bc4890d4d4
4 changed files with 0 additions and 90 deletions
|
@ -249,24 +249,6 @@ function requestAccessToLocalFile(fileUrl, overlayManager, callback) {
|
|||
});
|
||||
}
|
||||
|
||||
if (window === top) {
|
||||
// Chrome closes all extension tabs (crbug.com/511670) when the extension
|
||||
// reloads. To counter this, the tab URL and history state is saved to
|
||||
// localStorage and restored by extension-router.js.
|
||||
// Unfortunately, the window and tab index are not restored. And if it was
|
||||
// the only tab in an incognito window, then the tab is not restored either.
|
||||
addEventListener("unload", function () {
|
||||
// If the runtime is still available, the unload is most likely a normal
|
||||
// tab closure. Otherwise it is most likely an extension reload.
|
||||
if (!isRuntimeAvailable()) {
|
||||
localStorage.setItem(
|
||||
"unload-" + Date.now() + "-" + document.hidden + "-" + location.href,
|
||||
JSON.stringify(history.state)
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
let dnrRequestId;
|
||||
// This port is used for several purposes:
|
||||
// 1. When disconnected, the background page knows that the frame has unload.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue