Commit 9c7193d2 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Add another DCHECK to UserScriptListener.

Convert a condition/early out to a DCHECK. There should always
be a URL pattern, because an extension that has a content
script but no URL pattern ("matches" in the manifest) fails to
load. This conditional has been there since
user_script_listener.cc was added ~10 years ago, but I don't
think it's possible to fail.

That said, this check failing is the only logical way I can see
the other DCHECK (the one causing the bug) might fail, so adding
it might shed light on the cause of the bug.

Bug: 1036028
Change-Id: Id91dcf66cb0d02f134cc2a7de7b2003d20b4e621
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1977240Reviewed-by: default avatarDevlin <rdevlin.cronin@chromium.org>
Commit-Queue: Evan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#727766}
parent eb23b36f
......@@ -228,9 +228,8 @@ void UserScriptListener::OnExtensionLoaded(
URLPatterns new_patterns;
CollectURLPatterns(extension, &new_patterns);
if (!new_patterns.empty()) {
AppendNewURLPatterns(browser_context, new_patterns);
}
DCHECK(!new_patterns.empty());
AppendNewURLPatterns(browser_context, new_patterns);
}
void UserScriptListener::OnExtensionUnloaded(
......
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