Commit 32dcf91d authored by Mikel Astiz's avatar Mikel Astiz Committed by Commit Bot

Use CHECK for permanent bookmark deletion attempts

Follow up to the recent
https://chromium-review.googlesource.com/c/chromium/src/+/1899374 where
one caller (extensions) was fixed and the DCHECK introduced.

Since there are many direct or indirect callers to
BookmarkModel::Remove() and is difficult to audit them all, this patch
upgrades the DCHECK into a CHECK to enforce the precondition.

Bug: 1021829
Change-Id: I6590650059ddf94b054ad0b6d22224f0ec531654
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1911212
Auto-Submit: Mikel Astiz <mastiz@chromium.org>
Commit-Queue: Scott Violet <sky@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#714584}
parent a0be3874
......@@ -205,7 +205,10 @@ void BookmarkModel::Remove(const BookmarkNode* node) {
DCHECK(parent);
size_t index = size_t{parent->GetIndexOf(node)};
DCHECK_NE(size_t{-1}, index);
DCHECK(!is_permanent_node(node));
// Removing a permanent node is problematic and can cause crashes elsewhere
// that are difficult to trace back.
CHECK(!is_permanent_node(node)) << "for type " << node->type();
for (BookmarkModelObserver& observer : observers_)
observer.OnWillRemoveBookmarks(this, parent, index, node);
......
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