Commit 37d5fa59 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Avoid setting search chip on non-tab cards in Grid tab switcher

Before this CL, search chip properties might be set on IPH cards in the
Grid tab switcher, and triggers an assertion error.

To make debugging easier, the content dump of the offending model is
added to the error message.

Bug: 1076546
Change-Id: I8bf110050226a8462881fba069632a5e9380672f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363773
Commit-Queue: Xi Han <hanxi@chromium.org>
Reviewed-by: default avatarXi Han <hanxi@chromium.org>
Reviewed-by: default avatarTheresa  <twellington@chromium.org>
Cr-Commit-Position: refs/heads/master@{#803942}
parent 2e98d5f6
...@@ -802,6 +802,7 @@ class TabListMediator { ...@@ -802,6 +802,7 @@ class TabListMediator {
mTemplateUrlObserver = () -> { mTemplateUrlObserver = () -> {
mSearchChipIconDrawableId = getSearchChipIconDrawableId(); mSearchChipIconDrawableId = getSearchChipIconDrawableId();
for (int i = 0; i < mModel.size(); i++) { for (int i = 0; i < mModel.size(); i++) {
if (mModel.get(i).model.get(CARD_TYPE) != TAB) continue;
mModel.get(i).model.set( mModel.get(i).model.set(
TabProperties.SEARCH_CHIP_ICON_DRAWABLE_ID, mSearchChipIconDrawableId); TabProperties.SEARCH_CHIP_ICON_DRAWABLE_ID, mSearchChipIconDrawableId);
} }
......
...@@ -276,7 +276,8 @@ public class PropertyModel extends PropertyObservable<PropertyKey> { ...@@ -276,7 +276,8 @@ public class PropertyModel extends PropertyObservable<PropertyKey> {
@RemovableInRelease @RemovableInRelease
private void validateKey(PropertyKey key) { private void validateKey(PropertyKey key) {
if (!mData.containsKey(key)) { if (!mData.containsKey(key)) {
throw new IllegalArgumentException("Invalid key passed in: " + key); throw new IllegalArgumentException(
"Invalid key passed in: " + key + ". Current data is: " + mData.toString());
} }
} }
......
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