Index: Source/modules/credentialmanager/PasswordCredential.cpp |
diff --git a/Source/modules/credentialmanager/PasswordCredential.cpp b/Source/modules/credentialmanager/PasswordCredential.cpp |
index 002d973529b62b1d1cb3247b245837439dadc53b..68bc40a079ca1bf4c45199434bd7955dcddf042a 100644 |
--- a/Source/modules/credentialmanager/PasswordCredential.cpp |
+++ b/Source/modules/credentialmanager/PasswordCredential.cpp |
@@ -5,9 +5,13 @@ |
#include "config.h" |
#include "modules/credentialmanager/PasswordCredential.h" |
+#include "bindings/core/v8/Dictionary.h" |
#include "bindings/core/v8/ExceptionState.h" |
+#include "core/dom/ExecutionContext.h" |
#include "core/html/DOMFormData.h" |
+#include "modules/credentialmanager/FormDataOptions.h" |
#include "platform/credentialmanager/PlatformPasswordCredential.h" |
+#include "platform/weborigin/SecurityOrigin.h" |
#include "public/platform/WebCredential.h" |
#include "public/platform/WebPasswordCredential.h" |
@@ -33,10 +37,21 @@ PasswordCredential::PasswordCredential(WebPasswordCredential* webPasswordCredent |
PasswordCredential::PasswordCredential(const String& id, const String& password, const String& name, const KURL& icon) |
: Credential(PlatformPasswordCredential::create(id, password, name, icon)) |
- , m_formData(DOMFormData::create()) |
{ |
- m_formData->append("username", id); |
- m_formData->append("password", password); |
+} |
+ |
+DOMFormData* PasswordCredential::toFormData(ScriptState* scriptState, const FormDataOptions& options) |
+{ |
+ DOMFormData* fd = DOMFormData::create(); |
+ |
+ String errorMessage; |
+ if (!scriptState->executionContext()->isPrivilegedContext(errorMessage)) |
+ return fd; |
+ |
+ fd->append(options.idName(), id()); |
+ fd->append(options.passwordName(), password()); |
+ fd->makeOpaque(); |
+ return fd; |
} |
const String& PasswordCredential::password() const |
@@ -46,7 +61,6 @@ const String& PasswordCredential::password() const |
DEFINE_TRACE(PasswordCredential) |
{ |
- visitor->trace(m_formData); |
Credential::trace(visitor); |
} |