Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Fix/tabs discard dead tab #504

Merged
merged 1 commit into from
Feb 22, 2018
Merged

Fix/tabs discard dead tab #504

merged 1 commit into from
Feb 22, 2018

Conversation

bridiver
Copy link
Collaborator

@bridiver bridiver commented Feb 22, 2018

Fix #487
Fix #496
Fix #505

@petemill
Copy link
Member

Added that this fixes #487.

petemill
petemill previously approved these changes Feb 22, 2018
Copy link
Member

@petemill petemill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Tested with brave/browser-laptop#13120 which handles the new tab-replaced-at function and it works great. Found an additional issue related to persisting scroll position and some kind of tab storage (not sessionStorage, which is persisted for the tab as expected), and will open a new issue (it should not block this PR IMO.

petemill added a commit to brave/browser-laptop that referenced this pull request Feb 22, 2018
Requires brave/muon#504
Ensure that tab/WebContents objects are added to memory as soon as they are created.
Use muon's new `tab-replaced-at` event (instead of <webview>.tab-id-changed) to ensure state gets updated correctly when a tab is discarded, as well as communicating temporary contents replacement to a window's frame (such as when detaching a tab to a new window, the tab in the old window gets a temporary WebContents that then gets destroyed).

In the case of tabs which get discarded, they are replaced with a fresh, clean WebContents. We were not receiving this new object, so when the renderer asked for this new object's tabId to be made active, the cache did not have that object.
We must also handle updating references to the old TabId to the new TabId in state, in the module which remembers opener tab IDs and the module which handles historical tab 'active' history for a window.

The guestInstanceId for a tab also changes when a discarded tab is reloaded, so make sure we pass that new value in the frame options when a discarded tab is detached to a new window.

Adds more relevant log entries under the `--debug-tab-events` flag.
petemill added a commit to brave/browser-laptop that referenced this pull request Feb 22, 2018
Requires brave/muon#504
Ensure that tab/WebContents objects are added to memory as soon as they are created.
Use muon's new `tab-replaced-at` event (instead of <webview>.tab-id-changed) to ensure state gets updated correctly when a tab is discarded, as well as communicating temporary contents replacement to a window's frame (such as when detaching a tab to a new window, the tab in the old window gets a temporary WebContents that then gets destroyed).

In the case of tabs which get discarded, they are replaced with a fresh, clean WebContents. We were not receiving this new object, so when the renderer asked for this new object's tabId to be made active, the cache did not have that object.
We must also handle updating references to the old TabId to the new TabId in state, in the module which remembers opener tab IDs and the module which handles historical tab 'active' history for a window.

The guestInstanceId for a tab also changes when a discarded tab is reloaded, so make sure we pass that new value in the frame options when a discarded tab is detached to a new window.

Adds more relevant log entries under the `--debug-tab-events` flag.
petemill added a commit to brave/browser-laptop that referenced this pull request Feb 22, 2018
Requires brave/muon#504
Ensure that tab/WebContents objects are added to memory as soon as they are created.
Use muon's new `tab-replaced-at` event (instead of <webview>.tab-id-changed) to ensure state gets updated correctly when a tab is discarded, as well as communicating temporary contents replacement to a window's frame (such as when detaching a tab to a new window, the tab in the old window gets a temporary WebContents that then gets destroyed).

In the case of tabs which get discarded, they are replaced with a fresh, clean WebContents. We were not receiving this new object, so when the renderer asked for this new object's tabId to be made active, the cache did not have that object.
We must also handle updating references to the old TabId to the new TabId in state, in the module which remembers opener tab IDs and the module which handles historical tab 'active' history for a window.

The guestInstanceId for a tab also changes when a discarded tab is reloaded, so make sure we pass that new value in the frame options when a discarded tab is detached to a new window.

Adds more relevant log entries under the `--debug-tab-events` flag.
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approval so we can get build started; Pete reviewed but I think forgot to choose Approve (which happens to me all the time!)

@bridiver bridiver added this to the 5.0.6 milestone Feb 22, 2018
@bridiver bridiver merged commit 82d523c into master Feb 22, 2018
@petemill
Copy link
Member

@bsclifton I approved but new commits were pushed marking it 'stale'. FWIW all 3 issues are resolved as far as I'm concerned, and I've found no new issues.

@bsclifton bsclifton deleted the fix/tabs-discard-dead-tab branch February 22, 2018 22:20
bridiver added a commit that referenced this pull request Feb 22, 2018
bsclifton pushed a commit to brave/browser-laptop that referenced this pull request Feb 23, 2018
Requires brave/muon#504
Ensure that tab/WebContents objects are added to memory as soon as they are created.
Use muon's new `tab-replaced-at` event (instead of <webview>.tab-id-changed) to ensure state gets updated correctly when a tab is discarded, as well as communicating temporary contents replacement to a window's frame (such as when detaching a tab to a new window, the tab in the old window gets a temporary WebContents that then gets destroyed).

In the case of tabs which get discarded, they are replaced with a fresh, clean WebContents. We were not receiving this new object, so when the renderer asked for this new object's tabId to be made active, the cache did not have that object.
We must also handle updating references to the old TabId to the new TabId in state, in the module which remembers opener tab IDs and the module which handles historical tab 'active' history for a window.

The guestInstanceId for a tab also changes when a discarded tab is reloaded, so make sure we pass that new value in the frame options when a discarded tab is detached to a new window.

Adds more relevant log entries under the `--debug-tab-events` flag.
petemill added a commit to brave/browser-laptop that referenced this pull request Feb 23, 2018
Requires brave/muon#504
Ensure that tab/WebContents objects are added to memory as soon as they are created.
Use muon's new `tab-replaced-at` event (instead of <webview>.tab-id-changed) to ensure state gets updated correctly when a tab is discarded, as well as communicating temporary contents replacement to a window's frame (such as when detaching a tab to a new window, the tab in the old window gets a temporary WebContents that then gets destroyed).

In the case of tabs which get discarded, they are replaced with a fresh, clean WebContents. We were not receiving this new object, so when the renderer asked for this new object's tabId to be made active, the cache did not have that object.
We must also handle updating references to the old TabId to the new TabId in state, in the module which remembers opener tab IDs and the module which handles historical tab 'active' history for a window.

The guestInstanceId for a tab also changes when a discarded tab is reloaded, so make sure we pass that new value in the frame options when a discarded tab is detached to a new window.

Adds more relevant log entries under the `--debug-tab-events` flag.
Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

@@ -318,6 +318,11 @@ void TabViewGuest::ApplyAttributes(const base::DictionaryValue& params) {

if (attached() &&
web_contents()->GetController().IsInitialNavigation()) {
// don't reload if we're already loading
if (web_contents()->GetController().GetPendingEntry() &&
web_contents()->GetController().GetPendingEntry()->GetURL() == src_) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lint: >80 chars

ryanml pushed a commit to ryanml/browser-laptop that referenced this pull request Feb 27, 2018
Requires brave/muon#504
Ensure that tab/WebContents objects are added to memory as soon as they are created.
Use muon's new `tab-replaced-at` event (instead of <webview>.tab-id-changed) to ensure state gets updated correctly when a tab is discarded, as well as communicating temporary contents replacement to a window's frame (such as when detaching a tab to a new window, the tab in the old window gets a temporary WebContents that then gets destroyed).

In the case of tabs which get discarded, they are replaced with a fresh, clean WebContents. We were not receiving this new object, so when the renderer asked for this new object's tabId to be made active, the cache did not have that object.
We must also handle updating references to the old TabId to the new TabId in state, in the module which remembers opener tab IDs and the module which handles historical tab 'active' history for a window.

The guestInstanceId for a tab also changes when a discarded tab is reloaded, so make sure we pass that new value in the frame options when a discarded tab is detached to a new window.

Adds more relevant log entries under the `--debug-tab-events` flag.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants