Chromium Code Reviews| Index: Source/modules/crypto/CryptoResultImpl.cpp |
| diff --git a/Source/modules/crypto/CryptoResultImpl.cpp b/Source/modules/crypto/CryptoResultImpl.cpp |
| index 9abbd577dfd17a6cd27ee2c64089114ffc58c1d5..9feeb3d57a3017540df6cafe3e0a3cafadf21a46 100644 |
| --- a/Source/modules/crypto/CryptoResultImpl.cpp |
| +++ b/Source/modules/crypto/CryptoResultImpl.cpp |
| @@ -116,6 +116,26 @@ void CryptoResultImpl::completeWithBuffer(const blink::WebArrayBuffer& buffer) |
| m_resolver->resolve(PassRefPtr<ArrayBuffer>(buffer)); |
| } |
| +void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length) |
| +{ |
| + if (m_resolver) { |
| + ScriptState* scriptState = m_resolver->scriptState(); |
| + ScriptState::Scope scope(scriptState); |
| + |
| + v8::Handle<v8::String> jsonString = v8AtomicString(scriptState->isolate(), utf8Data, length); |
|
abarth-chromium
2014/06/17 05:03:05
Why atomic?
eroman
2014/06/17 17:58:02
Thanks for pointing this out!
I had a misundersta
eroman
2014/06/17 18:06:56
Done.
|
| + |
| + v8::TryCatch exceptionCatcher; |
| + v8::Handle<v8::Value> jsonDictionary = v8::JSON::Parse(jsonString); |
| + if (exceptionCatcher.HasCaught() || jsonDictionary.IsEmpty()) { |
| + ASSERT_NOT_REACHED(); |
| + m_resolver->reject(DOMException::create(OperationError, "Failed inflating JWK JSON to object")); |
| + return; |
| + } |
| + |
| + m_resolver->resolve(jsonDictionary); |
| + } |
| +} |
| + |
| void CryptoResultImpl::completeWithBoolean(bool b) |
| { |
| if (m_resolver) |