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

Unified Diff: Source/modules/crypto/NormalizeAlgorithm.h

Issue 141413003: [webcrypto] Match the error handling defined by the spec. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/crypto/Key.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/NormalizeAlgorithm.h
diff --git a/Source/modules/crypto/NormalizeAlgorithm.h b/Source/modules/crypto/NormalizeAlgorithm.h
index 9565eb72b349f9c4c357a45abf603102b233fd5d..a02e36259e6748ecb6194f3de8051775888e3cf1 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.h
+++ b/Source/modules/crypto/NormalizeAlgorithm.h
@@ -33,6 +33,7 @@
#include "public/platform/WebCryptoAlgorithm.h"
#include "wtf/Assertions.h"
+#include "wtf/Forward.h"
namespace blink { class WebCryptoAlgorithm; }
@@ -56,9 +57,20 @@ enum AlgorithmOperation {
LastAlgorithmOperation = UnwrapKey,
};
-// Normalizes an algorithm identifier (dictionary) into a WebCryptoAlgorithm. If
-// normalization fails then returns false and sets the ExceptionState.
-bool normalizeAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgorithm&, ExceptionState&) WARN_UNUSED_RETURN;
+// Converts a javascript Dictionary to a WebCryptoAlgorithm object.
+//
+// This corresponds with "normalizing" [1] the algorithm, and then validating
+// the expected parameters for the algorithm/operation combination.
+//
+// On success returns true and sets the WebCryptoAlgorithm.
+//
+// On failure parseAlgorithm returns false. errorDetails will be filled
+// with a (non-localized) debug string. Additionally the ExceptionState *may*
+// be set (the web crypto spec only defines a handeful of errors as resulting
+// in exceptions).
+//
+// [1] http://www.w3.org/TR/WebCryptoAPI/#algorithm-normalizing-rules
+bool parseAlgorithm(const Dictionary&, AlgorithmOperation, blink::WebCryptoAlgorithm&, String& errorDetails, ExceptionState&) WARN_UNUSED_RETURN;
// Returns a null-terminated C-string literal. Caller can assume the pointer
// will be valid for the program's entire runtime.
« no previous file with comments | « Source/modules/crypto/Key.cpp ('k') | Source/modules/crypto/NormalizeAlgorithm.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698