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

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

Issue 243853004: [webcrypto] Reject failed operations with a DOMException rather than null. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix compile warning Created 6 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 | « Source/modules/crypto/CryptoResultImpl.cpp ('k') | Source/modules/crypto/NormalizeAlgorithm.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/crypto/Key.cpp
diff --git a/Source/modules/crypto/Key.cpp b/Source/modules/crypto/Key.cpp
index 09b4fd4a6012ad97503f786179ea7cbb33f08b79..f15c557fd5f97d1cd76b128390fcb528c77cafc8 100644
--- a/Source/modules/crypto/Key.cpp
+++ b/Source/modules/crypto/Key.cpp
@@ -171,12 +171,12 @@ Vector<String> Key::usages() const
bool Key::canBeUsedForAlgorithm(const blink::WebCryptoAlgorithm& algorithm, AlgorithmOperation op, CryptoResult* result) const
{
if (!(m_key.usages() & toKeyUsage(op))) {
- result->completeWithError("key.usages does not permit this operation");
+ result->completeWithError(blink::WebCryptoErrorTypeInvalidAccess, "key.usages does not permit this operation");
return false;
}
if (m_key.algorithm().id() != algorithm.id()) {
- result->completeWithError("key.algorithm does not match that of operation");
+ result->completeWithError(blink::WebCryptoErrorTypeInvalidAccess, "key.algorithm does not match that of operation");
return false;
}
@@ -203,7 +203,7 @@ bool Key::parseFormat(const String& formatString, blink::WebCryptoKeyFormat& for
return true;
}
- result->completeWithError("Invalid keyFormat argument");
+ result->completeWithError(blink::WebCryptoErrorTypeSyntax, "Invalid keyFormat argument");
return false;
}
@@ -213,7 +213,7 @@ bool Key::parseUsageMask(const Vector<String>& usages, blink::WebCryptoKeyUsageM
for (size_t i = 0; i < usages.size(); ++i) {
blink::WebCryptoKeyUsageMask usage = keyUsageStringToMask(usages[i]);
if (!usage) {
- result->completeWithError("Invalid keyUsages argument");
+ result->completeWithError(blink::WebCryptoErrorTypeSyntax, "Invalid keyUsages argument");
return false;
}
mask |= usage;
« no previous file with comments | « Source/modules/crypto/CryptoResultImpl.cpp ('k') | Source/modules/crypto/NormalizeAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698