Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.cpp

Issue 1745963002: CREDENTIAL: Do type checks for credential constructors. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.cpp
diff --git a/third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.cpp b/third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.cpp
index a1d5b008f35771434c3c02ff1c88930d0c16d4cb..0e145464b77105ee96e7da3e2faac1c91e85a9d3 100644
--- a/third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.cpp
+++ b/third_party/WebKit/Source/modules/credentialmanager/FederatedCredential.cpp
@@ -19,6 +19,15 @@ FederatedCredential* FederatedCredential::create(WebFederatedCredential* webFede
FederatedCredential* FederatedCredential::create(const FederatedCredentialData& data, ExceptionState& exceptionState)
{
+ if (data.id().isEmpty()) {
+ exceptionState.throwTypeError("'id' must not be empty.");
+ return nullptr;
+ }
+ if (data.provider().isEmpty()) {
+ exceptionState.throwTypeError("'provider' must not be empty.");
+ return nullptr;
+ }
+
KURL iconURL = parseStringAsURL(data.iconURL(), exceptionState);
KURL providerURL = parseStringAsURL(data.provider(), exceptionState);
if (exceptionState.hadException())

Powered by Google App Engine
This is Rietveld 408576698