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

Side by Side Diff: Source/modules/crypto/SubtleCrypto.cpp

Issue 133253002: [webcrypto] Fix TODO regarding asynchronous completion of crypto operations. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Dont use ScriptState - Instead use ContextLifecycleObserver and save the DomWrapperWorld Created 6 years, 11 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 26 matching lines...) Expand all
37 #include "modules/crypto/CryptoResultImpl.h" 37 #include "modules/crypto/CryptoResultImpl.h"
38 #include "modules/crypto/Key.h" 38 #include "modules/crypto/Key.h"
39 #include "modules/crypto/NormalizeAlgorithm.h" 39 #include "modules/crypto/NormalizeAlgorithm.h"
40 #include "public/platform/Platform.h" 40 #include "public/platform/Platform.h"
41 #include "public/platform/WebCrypto.h" 41 #include "public/platform/WebCrypto.h"
42 #include "public/platform/WebCryptoAlgorithm.h" 42 #include "public/platform/WebCryptoAlgorithm.h"
43 #include "wtf/ArrayBufferView.h" 43 #include "wtf/ArrayBufferView.h"
44 44
45 namespace WebCore { 45 namespace WebCore {
46 46
47 // FIXME: asynchronous completion of CryptoResult. Need to re-enter the
48 // v8::Context before trying to fulfill the promise, and enable test.
49
50 namespace { 47 namespace {
51 48
52 ScriptPromise startCryptoOperation(const Dictionary& rawAlgorithm, Key* key, Alg orithmOperation operationType, ArrayBufferView* signature, ArrayBufferView* data Buffer, ExceptionState& exceptionState) 49 ScriptPromise startCryptoOperation(const Dictionary& rawAlgorithm, Key* key, Alg orithmOperation operationType, ArrayBufferView* signature, ArrayBufferView* data Buffer, ExceptionState& exceptionState)
53 { 50 {
54 bool requiresKey = operationType != Digest; 51 bool requiresKey = operationType != Digest;
55 52
56 // Seems like the generated bindings should take care of these however it 53 // Seems like the generated bindings should take care of these however it
57 // currently doesn't. See also http://crbugh.com/264520 54 // currently doesn't. See also http://crbugh.com/264520
58 if (requiresKey && !key) { 55 if (requiresKey && !key) {
59 exceptionState.throwTypeError("Invalid key argument"); 56 exceptionState.throwTypeError("Invalid key argument");
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 unsigned wrappedKeyDataSize = wrappedKey->byteLength(); 270 unsigned wrappedKeyDataSize = wrappedKey->byteLength();
274 271
275 ScriptPromise promise = ScriptPromise::createPending(); 272 ScriptPromise promise = ScriptPromise::createPending();
276 RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(promise); 273 RefPtr<CryptoResultImpl> result = CryptoResultImpl::create(promise);
277 blink::Platform::current()->crypto()->unwrapKey(format, wrappedKeyData, wrap pedKeyDataSize, unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm, ex tractable, keyUsages, result->result()); 274 blink::Platform::current()->crypto()->unwrapKey(format, wrappedKeyData, wrap pedKeyDataSize, unwrappingKey->key(), unwrapAlgorithm, unwrappedKeyAlgorithm, ex tractable, keyUsages, result->result());
278 return promise; 275 return promise;
279 } 276 }
280 277
281 278
282 } // namespace WebCore 279 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698