Fix the GURL change [compile error, two small changes to make things safe while 
the rest of the changes aren't in yet].

Review = http://codereview.chromium.org/8974033/
Patch by ericu@chromium.org


git-svn-id: http://google-url.googlecode.com/svn/trunk@167 8873c55e-713a-0410-88f8-23d9c3d90b1b
diff --git a/src/gurl.cc b/src/gurl.cc
index b889cbb..9a2f57e 100644
--- a/src/gurl.cc
+++ b/src/gurl.cc
@@ -456,7 +456,7 @@
     return false;
 
   // FileSystem URLs have empty parsed_.host, so check this first.
-  if (SchemeIsFileSystem())
+  if (SchemeIsFileSystem() && inner_url_)
     return inner_url_->DomainIs(lower_ascii_domain, domain_len);
 
   if (!parsed_.host.is_nonempty())
diff --git a/src/url_canon_unittest.cc b/src/url_canon_unittest.cc
index beec810..5cd5f2c 100644
--- a/src/url_canon_unittest.cc
+++ b/src/url_canon_unittest.cc
@@ -2032,6 +2032,7 @@
       // Filesystem URL tests; filesystem URLs are only valid and relative if
       // they have no scheme, e.g. "./index.html".  There's no valid equivalent
       // to http:index.html.
+#ifdef FULL_FILESYSTEM_URL_SUPPORT
     {"filesystem:http://host/t/path", true, false, "filesystem:http://host/t/path2", true, false, false, NULL},
     {"filesystem:http://host/t/path", true, false, "filesystem:https://host/t/path2", true, false, false, NULL},
     {"filesystem:http://host/t/path", true, false, "http://host/t/path2", true, false, false, NULL},
@@ -2039,6 +2040,7 @@
     {"filesystem:http://host/t/path", true, false, "./path2", true, true, true, "filesystem:http://host/t/path2"},
     {"filesystem:http://host/t/path/", true, false, "path2", true, true, true, "filesystem:http://host/t/path/path2"},
     {"filesystem:http://host/t/path", true, false, "filesystem:http:path2", true, false, false, NULL},
+#endif
   };
 
   for (size_t i = 0; i < ARRAYSIZE(rel_cases); i++) {
diff --git a/src/url_parse.cc b/src/url_parse.cc
index 3dc1dd5..dfef123 100644
--- a/src/url_parse.cc
+++ b/src/url_parse.cc
@@ -312,6 +312,29 @@
   ParsePath(spec, full_path, &parsed->path, &parsed->query, &parsed->ref);
 }
 
+// The main parsing function for standard URLs. Standard URLs have a scheme,
+// host, path, etc.
+template<typename CHAR>
+void DoParseStandardURL(const CHAR* spec, int spec_len, Parsed* parsed) {
+  DCHECK(spec_len >= 0);
+
+  // Strip leading & trailing spaces and control characters.
+  int begin = 0;
+  TrimURL(spec, &begin, &spec_len);
+
+  int after_scheme;
+  if (DoExtractScheme(spec, spec_len, &parsed->scheme)) {
+    after_scheme = parsed->scheme.end() + 1;  // Skip past the colon.
+  } else {
+    // Say there's no scheme when there is no colon. We could also say that
+    // everything is the scheme. Both would produce an invalid URL, but this way
+    // seems less wrong in more cases.
+    parsed->scheme.reset();
+    after_scheme = begin;
+  }
+  DoParseAfterScheme(spec, spec_len, after_scheme, parsed);
+}
+
 template<typename CHAR>
 void DoParseFileSystemURL(const CHAR* spec, int spec_len, Parsed* parsed) {
   DCHECK(spec_len >= 0);
@@ -428,29 +451,6 @@
   parsed->inner_parsed()->path.len = new_inner_path_length;
 }
 
-// The main parsing function for standard URLs. Standard URLs have a scheme,
-// host, path, etc.
-template<typename CHAR>
-void DoParseStandardURL(const CHAR* spec, int spec_len, Parsed* parsed) {
-  DCHECK(spec_len >= 0);
-
-  // Strip leading & trailing spaces and control characters.
-  int begin = 0;
-  TrimURL(spec, &begin, &spec_len);
-
-  int after_scheme;
-  if (DoExtractScheme(spec, spec_len, &parsed->scheme)) {
-    after_scheme = parsed->scheme.end() + 1;  // Skip past the colon.
-  } else {
-    // Say there's no scheme when there is no colon. We could also say that
-    // everything is the scheme. Both would produce an invalid URL, but this way
-    // seems less wrong in more cases.
-    parsed->scheme.reset();
-    after_scheme = begin;
-  }
-  DoParseAfterScheme(spec, spec_len, after_scheme, parsed);
-}
-
 // Initializes a path URL which is merely a scheme followed by a path. Examples
 // include "about:foo" and "javascript:alert('bar');"
 template<typename CHAR>