Commit b870abe3 authored by Raphael Kubo da Costa's avatar Raphael Kubo da Costa Committed by Commit Bot

WebCORS: Use WebString() directly instead of converting from const char*.

When we want to return an empty WebString, just explicitly return a
WebString() instead of going through the

    const char* -> WTF::String::FromUTF8 -> WTF::String -> WebString

path to achieve the same thing.

Bug: 736308
Change-Id: If3c9a45b3cac140a1a2d9d48c2b68558d09f106a
Reviewed-on: https://chromium-review.googlesource.com/726085Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Raphael Kubo da Costa (rakuco) <raphael.kubo.da.costa@intel.com>
Cr-Commit-Position: refs/heads/master@{#510028}
parent f5eebe98
......@@ -392,7 +392,7 @@ WebString AccessControlErrorString(
switch (status) {
case AccessStatus::kAccessAllowed:
NOTREACHED();
return "";
return WebString();
case AccessStatus::kInvalidResponse:
return String::Format("Invalid response. %s",
origin_denied.Utf8().data());
......@@ -469,7 +469,7 @@ WebString AccessControlErrorString(
: ""));
}
NOTREACHED();
return "";
return WebString();
}
WebString PreflightErrorString(const PreflightStatus status,
......@@ -478,7 +478,7 @@ WebString PreflightErrorString(const PreflightStatus status,
switch (status) {
case PreflightStatus::kPreflightSuccess:
NOTREACHED();
return "";
return WebString();
case PreflightStatus::kPreflightInvalidStatus:
return String::Format(
"Response for preflight has invalid HTTP status code %d",
......@@ -500,7 +500,7 @@ WebString PreflightErrorString(const PreflightStatus status,
.data());
}
NOTREACHED();
return "";
return WebString();
}
WebString RedirectErrorString(const RedirectStatus status,
......@@ -508,7 +508,7 @@ WebString RedirectErrorString(const RedirectStatus status,
switch (status) {
case RedirectStatus::kRedirectSuccess:
NOTREACHED();
return "";
return WebString();
case RedirectStatus::kRedirectDisallowedScheme:
return String::Format(
"Redirect location '%s' has a disallowed scheme for cross-origin "
......@@ -521,7 +521,7 @@ WebString RedirectErrorString(const RedirectStatus status,
redirect_url.GetString().Utf8().data());
}
NOTREACHED();
return "";
return WebString();
}
void ExtractCorsExposedHeaderNamesList(const WebURLResponse& response,
......
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