Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Unified Diff: extensions/browser/web_ui_user_script_loader.cc

Issue 2096433002: Convert prefix search in UserScript code to use base::StartsWith() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/browser/extension_user_script_loader.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/web_ui_user_script_loader.cc
diff --git a/extensions/browser/web_ui_user_script_loader.cc b/extensions/browser/web_ui_user_script_loader.cc
index a16c7f70a8993ed6eefc9407245c725f38dbd18b..2b018793e92bb5f3e2352f7ff6477f31b7e68055 100644
--- a/extensions/browser/web_ui_user_script_loader.cc
+++ b/extensions/browser/web_ui_user_script_loader.cc
@@ -128,12 +128,13 @@ void WebUIUserScriptLoader::OnSingleWebUIURLFetchComplete(
bool success,
const std::string& data) {
if (success) {
- // Remove BOM from the content.
- std::string::size_type index = data.find(base::kUtf8ByteOrderMark);
- if (index == 0)
+ // Remove BOM from |data|.
+ if (base::StartsWith(data, base::kUtf8ByteOrderMark,
+ base::CompareCase::SENSITIVE)) {
script_file->set_content(data.substr(strlen(base::kUtf8ByteOrderMark)));
- else
+ } else {
script_file->set_content(data);
+ }
}
++complete_fetchers_;
« no previous file with comments | « extensions/browser/extension_user_script_loader.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698