Commit 8a2db814 authored by Adam Rice's avatar Adam Rice Committed by Commit Bot

QuicTransport: Remove URL https scheme hack

Since quic-transport: is now on the list of "special" urls, it is no
longer necessary to convert it to https to perform checks.

BUG=1011392

Change-Id: I357a5a74cb596da473805534c432e25c404c1434
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1923873
Commit-Queue: Adam Rice <ricea@chromium.org>
Reviewed-by: default avatarYutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719501}
parent 6175c60b
...@@ -19,15 +19,6 @@ ...@@ -19,15 +19,6 @@
namespace blink { namespace blink {
namespace {
KURL ReparseURLAsHTTPS(KURL url) {
url.SetProtocol("https");
return url;
}
} // namespace
QuicTransport* QuicTransport::Create(ScriptState* script_state, QuicTransport* QuicTransport::Create(ScriptState* script_state,
const String& url, const String& url,
ExceptionState& exception_state) { ExceptionState& exception_state) {
...@@ -108,22 +99,11 @@ void QuicTransport::Init(const String& url, ExceptionState& exception_state) { ...@@ -108,22 +99,11 @@ void QuicTransport::Init(const String& url, ExceptionState& exception_state) {
return; return;
} }
// TODO(ricea): Use the URL as-is once "quic-transport" it has been added to if (url_.HasFragmentIdentifier()) {
// the "special" schemes list.
KURL url_as_https = ReparseURLAsHTTPS(url_);
if (!url_as_https.IsValid()) {
exception_state.ThrowDOMException(
DOMExceptionCode::kSyntaxError,
"The URL '" + url_.ElidedString() + "' is invalid.");
return;
}
if (url_as_https.HasFragmentIdentifier()) {
exception_state.ThrowDOMException( exception_state.ThrowDOMException(
DOMExceptionCode::kSyntaxError, DOMExceptionCode::kSyntaxError,
"The URL contains a fragment identifier ('#" + "The URL contains a fragment identifier ('#" +
url_as_https.FragmentIdentifier() + url_.FragmentIdentifier() +
"'). Fragment identifiers are not allowed in QuicTransport URLs."); "'). Fragment identifiers are not allowed in QuicTransport URLs.");
return; return;
} }
...@@ -131,7 +111,7 @@ void QuicTransport::Init(const String& url, ExceptionState& exception_state) { ...@@ -131,7 +111,7 @@ void QuicTransport::Init(const String& url, ExceptionState& exception_state) {
auto* execution_context = GetExecutionContext(); auto* execution_context = GetExecutionContext();
if (!execution_context->GetContentSecurityPolicyForWorld() if (!execution_context->GetContentSecurityPolicyForWorld()
->AllowConnectToSource(url_as_https)) { ->AllowConnectToSource(url_)) {
// TODO(ricea): This error should probably be asynchronous like it is for // TODO(ricea): This error should probably be asynchronous like it is for
// WebSockets and fetch. // WebSockets and fetch.
exception_state.ThrowSecurityError( exception_state.ThrowSecurityError(
......
...@@ -233,11 +233,10 @@ TEST_F(QuicTransportTest, PassCSP) { ...@@ -233,11 +233,10 @@ TEST_F(QuicTransportTest, PassCSP) {
// This doesn't work without the https:// prefix, even thought it should // This doesn't work without the https:// prefix, even thought it should
// according to // according to
// https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src. // https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/connect-src.
// TODO(ricea): Make it work with the quic-transport: scheme.
auto& exception_state = scope.GetExceptionState(); auto& exception_state = scope.GetExceptionState();
scope.GetExecutionContext() scope.GetExecutionContext()
->GetContentSecurityPolicyForWorld() ->GetContentSecurityPolicyForWorld()
->DidReceiveHeader("connect-src https://example.com:443", ->DidReceiveHeader("connect-src quic-transport://example.com",
kContentSecurityPolicyHeaderTypeEnforce, kContentSecurityPolicyHeaderTypeEnforce,
kContentSecurityPolicyHeaderSourceHTTP); kContentSecurityPolicyHeaderSourceHTTP);
QuicTransport::Create(scope.GetScriptState(), QuicTransport::Create(scope.GetScriptState(),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment