Add suborigin logic to url::Origin
In order for the browser to correctly reason about suborigins, this adds
support to url::Origin to parse and understand suborigins. It separates
requests for hosts and schemes from the embedded suborigin
serialization, while keeping the same-origin policy checks intact so a
suborigin is a different origin from other suborigins at the same
physical origin.
This updates url/origin.* so that given a suborigin encoded in a GURL,
will correctly deserialize the suborigin and store it accordingly, while
the scheme/host/port tuple is left with the real scheme/host/port.
Additionally, removes the content/public/common/origin_util.h functions
for using suborigins since url::Origin should now be used in their
stead.
BUG=336894,649893
Review-Url: https://codereview.chromium.org/2403713002
Cr-Commit-Position: refs/heads/master@{#427254}
diff --git a/url/url_util.cc b/url/url_util.cc
index 7a0a1f8..0a84d5e 100644
--- a/url/url_util.cc
+++ b/url/url_util.cc
@@ -19,25 +19,29 @@
namespace {
-const int kNumStandardURLSchemes = 8;
+const int kNumStandardURLSchemes = 10;
const SchemeWithType kStandardURLSchemes[kNumStandardURLSchemes] = {
- {kHttpScheme, SCHEME_WITH_PORT},
- {kHttpsScheme, SCHEME_WITH_PORT},
- // Yes, file URLs can have a hostname, so file URLs should be handled as
- // "standard". File URLs never have a port as specified by the SchemeType
- // field.
- {kFileScheme, SCHEME_WITHOUT_PORT},
- {kFtpScheme, SCHEME_WITH_PORT},
- {kGopherScheme, SCHEME_WITH_PORT},
- {kWsScheme, SCHEME_WITH_PORT}, // WebSocket.
- {kWssScheme, SCHEME_WITH_PORT}, // WebSocket secure.
- {kFileSystemScheme, SCHEME_WITHOUT_AUTHORITY},
+ {kHttpScheme, SCHEME_WITH_PORT},
+ {kHttpsScheme, SCHEME_WITH_PORT},
+ // Yes, file URLs can have a hostname, so file URLs should be handled as
+ // "standard". File URLs never have a port as specified by the SchemeType
+ // field.
+ {kFileScheme, SCHEME_WITHOUT_PORT},
+ {kFtpScheme, SCHEME_WITH_PORT},
+ {kGopherScheme, SCHEME_WITH_PORT},
+ {kWsScheme, SCHEME_WITH_PORT}, // WebSocket.
+ {kWssScheme, SCHEME_WITH_PORT}, // WebSocket secure.
+ {kFileSystemScheme, SCHEME_WITHOUT_AUTHORITY},
+ {kHttpSuboriginScheme, SCHEME_WITH_PORT},
+ {kHttpsSuboriginScheme, SCHEME_WITH_PORT},
};
-const int kNumReferrerURLSchemes = 2;
+const int kNumReferrerURLSchemes = 4;
const SchemeWithType kReferrerURLSchemes[kNumReferrerURLSchemes] = {
- {kHttpScheme, SCHEME_WITH_PORT},
- {kHttpsScheme, SCHEME_WITH_PORT},
+ {kHttpScheme, SCHEME_WITH_PORT},
+ {kHttpsScheme, SCHEME_WITH_PORT},
+ {kHttpSuboriginScheme, SCHEME_WITH_PORT},
+ {kHttpsSuboriginScheme, SCHEME_WITH_PORT},
};
// Lists of the currently installed standard and referrer schemes. These lists