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

Unified Diff: chrome/browser/extensions/user_script_master.cc

Issue 420001: Ignore UTF-8's BOM when parsing userscript's metadata. (Closed)
Patch Set: Relect the review Created 11 years, 1 month 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 | « base/string_util.cc ('k') | chrome/browser/extensions/user_script_master_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_master.cc
diff --git a/chrome/browser/extensions/user_script_master.cc b/chrome/browser/extensions/user_script_master.cc
index c9228ffc462880d9e97b953ab8eb2182f37410fa..a485a41911d3d13cd984faf895867ee7f1a91bcd 100644
--- a/chrome/browser/extensions/user_script_master.cc
+++ b/chrome/browser/extensions/user_script_master.cc
@@ -46,7 +46,12 @@ bool UserScriptMaster::ScriptReloader::ParseMetadataHeader(
// http://wiki.greasespot.net/Metadata_block
base::StringPiece line;
size_t line_start = 0;
- size_t line_end = 0;
+
+ // Skip UTF-8's BOM.
+ if (script_text.starts_with(kUtf8ByteOrderMark))
+ line_start += strlen(kUtf8ByteOrderMark);
+
+ size_t line_end = line_start;
bool in_metadata = false;
static const base::StringPiece kUserScriptBegin("// ==UserScript==");
« no previous file with comments | « base/string_util.cc ('k') | chrome/browser/extensions/user_script_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698