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

Unified Diff: third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp

Issue 2838603002: Added [SecureContext] to the subtle attribute (Closed)
Patch Set: Magic test starts doing differnt things out of the blue. Need to handle this properly. Avada Kedavr… Created 3 years, 8 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 | « third_party/WebKit/Source/modules/crypto/Crypto.idl ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp
diff --git a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp
index 88e674fc4526774d16eccf5ecad692404fea8bc4..98fbadd81cfbf73e1063099454cef7f617b19828 100644
--- a/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp
+++ b/third_party/WebKit/Source/modules/crypto/SubtleCrypto.cpp
@@ -58,25 +58,6 @@ static bool ParseAlgorithm(const AlgorithmIdentifier& raw,
return success;
}
-static bool CanAccessWebCrypto(ScriptState* script_state,
- CryptoResult* result) {
- String error_message;
- if (!ExecutionContext::From(script_state)
- ->IsSecureContext(error_message,
- ExecutionContext::kWebCryptoSecureContextCheck)) {
- result->CompleteWithError(kWebCryptoErrorTypeNotSupported, error_message);
- return false;
- }
-
- if (!ExecutionContext::From(script_state)->IsSecureContext()) {
- Deprecation::CountDeprecation(
- ExecutionContext::From(script_state),
- UseCounter::kSubtleCryptoOnlyStrictSecureContextCheckFailed);
- }
-
- return true;
-}
-
static bool CopyStringProperty(const char* property,
const Dictionary& source,
JSONObject* destination) {
@@ -190,9 +171,6 @@ ScriptPromise SubtleCrypto::encrypt(ScriptState* script_state,
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
// 14.3.1.2: Let data be the result of getting a copy of the bytes held by
// the data parameter passed to the encrypt method.
WebVector<uint8_t> data = CopyBytes(raw_data);
@@ -231,9 +209,6 @@ ScriptPromise SubtleCrypto::decrypt(ScriptState* script_state,
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
// 14.3.2.2: Let data be the result of getting a copy of the bytes held by
// the data parameter passed to the decrypt method.
WebVector<uint8_t> data = CopyBytes(raw_data);
@@ -272,9 +247,6 @@ ScriptPromise SubtleCrypto::sign(ScriptState* script_state,
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
// 14.3.3.2: Let data be the result of getting a copy of the bytes held by
// the data parameter passed to the sign method.
WebVector<uint8_t> data = CopyBytes(raw_data);
@@ -315,9 +287,6 @@ ScriptPromise SubtleCrypto::verifySignature(
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
// 14.3.4.2: Let signature be the result of getting a copy of the bytes
// held by the signature parameter passed to the verify method.
WebVector<uint8_t> signature = CopyBytes(raw_signature);
@@ -360,9 +329,6 @@ ScriptPromise SubtleCrypto::digest(ScriptState* script_state,
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
// 14.3.5.2: Let data be the result of getting a copy of the bytes held
// by the data parameter passed to the digest method.
WebVector<uint8_t> data = CopyBytes(raw_data);
@@ -392,9 +358,6 @@ ScriptPromise SubtleCrypto::generateKey(
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
WebCryptoKeyUsageMask key_usages;
if (!CryptoKey::ParseUsageMask(raw_key_usages, key_usages, result))
return promise;
@@ -431,9 +394,6 @@ ScriptPromise SubtleCrypto::importKey(
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
WebCryptoKeyFormat format;
if (!CryptoKey::ParseFormat(raw_format, format, result))
return promise;
@@ -515,9 +475,6 @@ ScriptPromise SubtleCrypto::exportKey(ScriptState* script_state,
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
WebCryptoKeyFormat format;
if (!CryptoKey::ParseFormat(raw_format, format, result))
return promise;
@@ -548,9 +505,6 @@ ScriptPromise SubtleCrypto::wrapKey(
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
WebCryptoKeyFormat format;
if (!CryptoKey::ParseFormat(raw_format, format, result))
return promise;
@@ -613,9 +567,6 @@ ScriptPromise SubtleCrypto::unwrapKey(
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
WebCryptoKeyFormat format;
if (!CryptoKey::ParseFormat(raw_format, format, result))
return promise;
@@ -685,9 +636,6 @@ ScriptPromise SubtleCrypto::deriveBits(ScriptState* script_state,
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
// 14.3.8.2: Let normalizedAlgorithm be the result of normalizing an
// algorithm, with alg set to algorithm and op set to
// "deriveBits".
@@ -726,9 +674,6 @@ ScriptPromise SubtleCrypto::deriveKey(
CryptoResultImpl* result = CryptoResultImpl::Create(script_state);
ScriptPromise promise = result->Promise();
- if (!CanAccessWebCrypto(script_state, result))
- return promise;
-
WebCryptoKeyUsageMask key_usages;
if (!CryptoKey::ParseUsageMask(raw_key_usages, key_usages, result))
return promise;
« no previous file with comments | « third_party/WebKit/Source/modules/crypto/Crypto.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698