| Index: Source/web/WebCryptoNormalize.cpp
|
| diff --git a/Source/web/WebSelector.cpp b/Source/web/WebCryptoNormalize.cpp
|
| similarity index 64%
|
| copy from Source/web/WebSelector.cpp
|
| copy to Source/web/WebCryptoNormalize.cpp
|
| index 939cb8a7b12e7a14376a7637c1bdcd1753eac7f5..f05f30e318752cf6c75505d2a8927331f5e46fab 100644
|
| --- a/Source/web/WebSelector.cpp
|
| +++ b/Source/web/WebCryptoNormalize.cpp
|
| @@ -29,29 +29,34 @@
|
| */
|
|
|
| #include "config.h"
|
| -#include "public/web/WebSelector.h"
|
| +#include "public/web/WebCryptoNormalize.h"
|
|
|
| -#include "core/css/CSSSelectorList.h"
|
| -#include "core/css/parser/BisonCSSParser.h"
|
| +#include "bindings/v8/Dictionary.h"
|
| +#include "modules/crypto/CryptoResultImpl.h"
|
| +#include "modules/crypto/NormalizeAlgorithm.h"
|
| +#include "platform/CryptoResult.h"
|
| #include "public/platform/WebString.h"
|
| +#include <v8.h>
|
|
|
| using namespace WebCore;
|
|
|
| namespace blink {
|
|
|
| -WebString canonicalizeSelector(WebString webSelector, WebSelectorType restriction)
|
| +
|
| +WebCryptoAlgorithm normalizeCryptoAlgorithm(v8::Handle<v8::Object> algorithmObject, WebCryptoOperation operation, int* exceptionCode, WebString* errorDetails, v8::Isolate* isolate)
|
| {
|
| - BisonCSSParser parser(strictCSSParserContext());
|
| - CSSSelectorList selectorList;
|
| - parser.parseSelector(webSelector, selectorList);
|
| -
|
| - if (restriction == WebSelectorTypeCompound) {
|
| - for (const CSSSelector* selector = selectorList.first(); selector; selector = selectorList.next(*selector)) {
|
| - if (!selector->isCompound())
|
| - return WebString();
|
| - }
|
| + WebCore::Dictionary algorithmDictionary(algorithmObject, isolate);
|
| + if (!algorithmDictionary.isUndefinedOrNull() && !algorithmDictionary.isObject())
|
| + return WebCryptoAlgorithm();
|
| + WebCryptoAlgorithm algorithm;
|
| + WebCore::AlgorithmError error;
|
| + if (!normalizeAlgorithm(algorithmDictionary, operation, algorithm, &error)) {
|
| + *exceptionCode = WebCore::webCryptoErrorToExceptionCode(error.errorType);
|
| + *errorDetails = error.errorDetails;
|
| + return WebCryptoAlgorithm();
|
| }
|
| - return selectorList.selectorsText();
|
| +
|
| + return algorithm;
|
| }
|
|
|
| } // namespace blink
|
|
|