| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |