Fix regression with discard behavior for new window creation#23
Open
echuber2 wants to merge 1 commit intoJman:masterfrom
Open
Fix regression with discard behavior for new window creation#23echuber2 wants to merge 1 commit intoJman:masterfrom
echuber2 wants to merge 1 commit intoJman:masterfrom
Conversation
- For the windows.onCreated handler, discard only the specific
window that was created.
- This is more efficient because it does not loop over all windows
each time a new window is created.
- Opening a new window or tearing off a tab will no longer discard
the tabs in all other windows.
- Put a 7-second delay on startup discard of all tabs in all windows.
- This helps to ensure that all inactive tabs are discarded soon
after startup, because sometimes the browser tries to reawaken
some of the previously-discarded tabs after the browser loads.
- When a session is restored at startup after a crash, Chrome
replaces the tabs in the current window (while it might also
create new windows if multiple windows were previously open), so
this delayed discard of all tabs can handle the existing window.
The session restore option must be clicked within 7 seconds of
opening the browser.
Author
|
I'll note that you can test the session restore behavior by forcing Chrome to crash. Put this special URL in the location bar: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #22
Fixes #19
There was a regression with #20 because tearing off a tab fires the window creation event, which would cause all tabs to be discarded. This would also happen if a new window was opened with a hotkey or from the menu.
The PR attempts a different solution for #19 although in that case, the user needs to click Chrome's popup button to restore within the 7-second delay period (before the extension discards all tabs with the startup action).
These are the notes I wrote in the commit message: