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

Unified Diff: Source/modules/crypto/CryptoResultImpl.cpp

Issue 1031783003: Add V8ObjectBuilder helper and use in modules/crypto/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use "const String&" Created 5 years, 9 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
« no previous file with comments | « Source/modules/crypto/CryptoKey.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/CryptoResultImpl.cpp
diff --git a/Source/modules/crypto/CryptoResultImpl.cpp b/Source/modules/crypto/CryptoResultImpl.cpp
index b06c814acee8c8b1e16c21c2c3554565823d15d5..8e8799bfe70dc0c199b4b544010ed5cca1aadca6 100644
--- a/Source/modules/crypto/CryptoResultImpl.cpp
+++ b/Source/modules/crypto/CryptoResultImpl.cpp
@@ -36,6 +36,7 @@
#include "bindings/core/v8/ScriptState.h"
#include "bindings/core/v8/V8ArrayBuffer.h"
#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8ObjectBuilder.h"
#include "bindings/modules/v8/V8CryptoKey.h"
#include "core/dom/ContextLifecycleObserver.h"
#include "core/dom/DOMArrayBuffer.h"
@@ -182,13 +183,10 @@ void CryptoResultImpl::completeWithKeyPair(const WebCryptoKey& publicKey, const
ScriptState* scriptState = m_resolver->scriptState();
ScriptState::Scope scope(scriptState);
- Dictionary keyPair = Dictionary::createEmpty(scriptState->isolate());
+ V8ObjectBuilder keyPair(scriptState);
- v8::Handle<v8::Value> publicKeyValue = toV8(CryptoKey::create(publicKey), scriptState->context()->Global(), scriptState->isolate());
- v8::Handle<v8::Value> privateKeyValue = toV8(CryptoKey::create(privateKey), scriptState->context()->Global(), scriptState->isolate());
-
- keyPair.set("publicKey", publicKeyValue);
- keyPair.set("privateKey", privateKeyValue);
+ keyPair.add("publicKey", ScriptValue::from(scriptState, CryptoKey::create(publicKey)));
+ keyPair.add("privateKey", ScriptValue::from(scriptState, CryptoKey::create(privateKey)));
m_resolver->resolve(keyPair.v8Value());
}
« no previous file with comments | « Source/modules/crypto/CryptoKey.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698