Commit 59d9c31c authored by David Maunder's avatar David Maunder Committed by Commit Bot

Don't undo grouped Tab after Tab#destroy

We no longer permit acquiring or setting Tab attributes after
Tab#destroy. Undoing a grouped Tab involves setting the root
id so we shouuld not try to ungroup a destroyed Tab.

Bug: 1117396
Change-Id: I082f1f2f4793cc0fdb8d538f58bd1ccfb9550eed
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2410354
Commit-Queue: David Maunder <davidjm@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#808718}
parent 17f0f733
...@@ -436,6 +436,9 @@ public class TabGroupModelFilter extends TabModelFilter { ...@@ -436,6 +436,9 @@ public class TabGroupModelFilter extends TabModelFilter {
* @param originalGroupId The rootId before grouped. * @param originalGroupId The rootId before grouped.
*/ */
public void undoGroupedTab(Tab tab, int originalIndex, int originalGroupId) { public void undoGroupedTab(Tab tab, int originalIndex, int originalGroupId) {
if (!tab.isInitialized()) {
return;
}
int currentIndex = TabModelUtils.getTabIndexById(getTabModel(), tab.getId()); int currentIndex = TabModelUtils.getTabIndexById(getTabModel(), tab.getId());
assert currentIndex != TabModel.INVALID_TAB_INDEX; assert currentIndex != TabModel.INVALID_TAB_INDEX;
......
...@@ -105,6 +105,7 @@ public class TabGroupModelFilterUnitTest { ...@@ -105,6 +105,7 @@ public class TabGroupModelFilterUnitTest {
private TabImpl prepareTab(int tabId, int rootId, int parentTabId) { private TabImpl prepareTab(int tabId, int rootId, int parentTabId) {
TabImpl tab = mock(TabImpl.class); TabImpl tab = mock(TabImpl.class);
doReturn(true).when(tab).isInitialized();
CriticalPersistedTabData criticalPersistedTabData = CriticalPersistedTabData.build(tab); CriticalPersistedTabData criticalPersistedTabData = CriticalPersistedTabData.build(tab);
UserDataHost userDataHost = new UserDataHost(); UserDataHost userDataHost = new UserDataHost();
userDataHost.setUserData(CriticalPersistedTabData.class, criticalPersistedTabData); userDataHost.setUserData(CriticalPersistedTabData.class, criticalPersistedTabData);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment