Remove comparisons for blob/filesystem schemes in scheme_host_port
These are checked implicitly via the fact that blob schemes are not
standard, and filesystem schemes have type SCHEME_WITHOUT_AUTHORITY.
IsStandard is in critical path of loading many resources, as it is
used for conversions to url::Origin.
BUG=672877
Review-Url: https://codereview.chromium.org/2560923002
Cr-Commit-Position: refs/heads/master@{#442372}
diff --git a/url/scheme_host_port_unittest.cc b/url/scheme_host_port_unittest.cc
index 81d4371..ba97a6a 100644
--- a/url/scheme_host_port_unittest.cc
+++ b/url/scheme_host_port_unittest.cc
@@ -42,11 +42,19 @@
EXPECT_TRUE(invalid.IsInvalid());
EXPECT_TRUE(invalid.Equals(invalid));
- const char* urls[] = {"data:text/html,Hello!",
- "javascript:alert(1)",
- "file://example.com:443/etc/passwd",
- "blob:https://example.com/uuid-goes-here",
- "filesystem:https://example.com/temporary/yay.png"};
+ const char* urls[] = {
+ "data:text/html,Hello!", "javascript:alert(1)",
+ "file://example.com:443/etc/passwd",
+
+ // These schemes do not follow the generic URL syntax, so make sure we
+ // treat them as invalid (scheme, host, port) tuples (even though such
+ // URLs' _Origin_ might have a (scheme, host, port) tuple, they themselves
+ // do not). This is only *implicitly* checked in the code, by means of
+ // blob schemes not being standard, and filesystem schemes having type
+ // SCHEME_WITHOUT_AUTHORITY. If conditions change such that the implicit
+ // checks no longer hold, this policy should be made explicit.
+ "blob:https://example.com/uuid-goes-here",
+ "filesystem:https://example.com/temporary/yay.png"};
for (auto* test : urls) {
SCOPED_TRACE(test);