Reviewers: Yang,

Message:
yangguo, wdyt?

An alternative solution would be fix all callers, but I think this is more
correct.

Description:
Allow flags strings in quotes.

If the user wants to run Chromium and pass several js flags to V8, the command
line would be:
chrome --js-flags="--foo --bar"

In this case, the value of the flag is "--foo --bar" (including quotes; this is
conceptually correct), but V8 doesn't parse this properly.

This CL fixes SetFlagsFromString to handle quotes.

R=yang...@chromium.org
BUG=

Please review this at https://codereview.chromium.org/221913004/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+6, -0 lines):
  M src/flags.cc


Index: src/flags.cc
diff --git a/src/flags.cc b/src/flags.cc
index 8e42206c59922ddad20c4422d7b7b718f20a833d..717bf55b7c9a1a8b386c0a66ab33900774a020a8 100644
--- a/src/flags.cc
+++ b/src/flags.cc
@@ -499,6 +499,12 @@ static char* SkipBlackSpace(char* p) {

 // static
 int FlagList::SetFlagsFromString(const char* str, int len) {
+  // The string might be in quotes. Skip the quotes.
+ if (len >= 2 && (str[0] == '\'' || str[0] == '"') && str[0] == str[len - 1]) {
+    ++str;
+    len -= 2;
+  }
+
   // make a 0-terminated copy of str
   ScopedVector<char> copy0(len + 1);
   OS::MemCopy(copy0.start(), str, len);


--
--
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to v8-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to