OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1045 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 return true; | 1056 return true; |
1057 } | 1057 } |
1058 | 1058 |
1059 bool parseAlgorithmIdentifier(const AlgorithmIdentifier& raw, | 1059 bool parseAlgorithmIdentifier(const AlgorithmIdentifier& raw, |
1060 WebCryptoOperation op, | 1060 WebCryptoOperation op, |
1061 WebCryptoAlgorithm& algorithm, | 1061 WebCryptoAlgorithm& algorithm, |
1062 ErrorContext context, | 1062 ErrorContext context, |
1063 AlgorithmError* error) { | 1063 AlgorithmError* error) { |
1064 context.add("Algorithm"); | 1064 context.add("Algorithm"); |
1065 | 1065 |
1066 // If the AlgorithmIdentifier is a String, treat it the same as a Dictionary w
ith a "name" attribute and nothing else. | 1066 // If the AlgorithmIdentifier is a String, treat it the same as a Dictionary |
| 1067 // with a "name" attribute and nothing else. |
1067 if (raw.isString()) { | 1068 if (raw.isString()) { |
1068 return parseAlgorithmDictionary(raw.getAsString(), Dictionary(), op, | 1069 return parseAlgorithmDictionary(raw.getAsString(), Dictionary(), op, |
1069 algorithm, context, error); | 1070 algorithm, context, error); |
1070 } | 1071 } |
1071 | 1072 |
1072 Dictionary params = raw.getAsDictionary(); | 1073 Dictionary params = raw.getAsDictionary(); |
1073 | 1074 |
1074 // Get the name of the algorithm from the AlgorithmIdentifier. | 1075 // Get the name of the algorithm from the AlgorithmIdentifier. |
1075 if (!params.isObject()) { | 1076 if (!params.isObject()) { |
1076 setTypeError(context.toString("Not an object"), error); | 1077 setTypeError(context.toString("Not an object"), error); |
(...skipping 13 matching lines...) Expand all Loading... |
1090 } // namespace | 1091 } // namespace |
1091 | 1092 |
1092 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, | 1093 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, |
1093 WebCryptoOperation op, | 1094 WebCryptoOperation op, |
1094 WebCryptoAlgorithm& algorithm, | 1095 WebCryptoAlgorithm& algorithm, |
1095 AlgorithmError* error) { | 1096 AlgorithmError* error) { |
1096 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); | 1097 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); |
1097 } | 1098 } |
1098 | 1099 |
1099 } // namespace blink | 1100 } // namespace blink |
OLD | NEW |