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

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

Issue 373423002: Split Dictionary's get and convert into DictionaryHelper. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
Index: Source/modules/crypto/NormalizeAlgorithm.cpp
diff --git a/Source/modules/crypto/NormalizeAlgorithm.cpp b/Source/modules/crypto/NormalizeAlgorithm.cpp
index 3db62ea2a69ca7d27cca4f8a0110efcf0d3ce351..77baea232552b35d07d16ad76fad0620f47e2fa5 100644
--- a/Source/modules/crypto/NormalizeAlgorithm.cpp
+++ b/Source/modules/crypto/NormalizeAlgorithm.cpp
@@ -32,6 +32,7 @@
#include "modules/crypto/NormalizeAlgorithm.h"
#include "bindings/core/v8/Dictionary.h"
+#include "bindings/core/v8/DictionaryHelper.h"
#include "platform/NotImplemented.h"
#include "public/platform/WebCryptoAlgorithmParams.h"
#include "public/platform/WebString.h"
@@ -269,7 +270,7 @@ private:
// FIXME: Currently only supports ArrayBufferView.
bool getOptionalCryptoOperationData(const Dictionary& raw, const char* propertyName, bool& hasProperty, RefPtr<ArrayBufferView>& buffer, const ErrorContext& context, AlgorithmError* error)
{
- if (!raw.get(propertyName, buffer)) {
+ if (!DictionaryHelper::get(raw, propertyName, buffer)) {
hasProperty = false;
return true;
}
@@ -302,7 +303,7 @@ bool getCryptoOperationData(const Dictionary& raw, const char* propertyName, Ref
bool getUint8Array(const Dictionary& raw, const char* propertyName, RefPtr<Uint8Array>& array, const ErrorContext& context, AlgorithmError* error)
{
- if (!raw.get(propertyName, array) || !array) {
+ if (!DictionaryHelper::get(raw, propertyName, array) || !array) {
setSyntaxError(context.toString(propertyName, "Missing or not a Uint8Array"), error);
return false;
}
@@ -322,7 +323,7 @@ bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<Uint8
return false;
}
- if (!raw.get(propertyName, array) || !array) {
+ if (!DictionaryHelper::get(raw, propertyName, array) || !array) {
setSyntaxError(context.toString(propertyName, "Missing or not a Uint8Array"), error);
return false;
}
@@ -333,7 +334,7 @@ bool getBigInteger(const Dictionary& raw, const char* propertyName, RefPtr<Uint8
bool getOptionalInteger(const Dictionary& raw, const char* propertyName, bool& hasProperty, double& value, double minValue, double maxValue, const ErrorContext& context, AlgorithmError* error)
{
double number;
- bool ok = raw.get(propertyName, number, hasProperty);
+ bool ok = DictionaryHelper::get(raw, propertyName, number, hasProperty);
if (!hasProperty)
return true;
@@ -445,7 +446,7 @@ bool parseAlgorithm(const Dictionary&, blink::WebCryptoOperation, blink::WebCryp
bool parseHash(const Dictionary& raw, blink::WebCryptoAlgorithm& hash, ErrorContext context, AlgorithmError* error)
{
Dictionary rawHash;
- if (!raw.get("hash", rawHash)) {
+ if (!DictionaryHelper::get(raw, "hash", rawHash)) {
setSyntaxError(context.toString("hash", "Missing or not a dictionary"), error);
return false;
}
@@ -685,7 +686,7 @@ bool parseAlgorithm(const Dictionary& raw, blink::WebCryptoOperation op, blink::
}
String algorithmName;
- if (!raw.get("name", algorithmName)) {
+ if (!DictionaryHelper::get(raw, "name", algorithmName)) {
setSyntaxError(context.toString("name", "Missing or not a string"), error);
return false;
}

Powered by Google App Engine
This is Rietveld 408576698