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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 error->errorType = WebCryptoErrorTypeNotSupported; | 210 error->errorType = WebCryptoErrorTypeNotSupported; |
211 error->errorDetails = message; | 211 error->errorDetails = message; |
212 } | 212 } |
213 | 213 |
214 // ErrorContext holds a stack of string literals which describe what was | 214 // ErrorContext holds a stack of string literals which describe what was |
215 // happening at the time the error occurred. This is helpful because | 215 // happening at the time the error occurred. This is helpful because |
216 // parsing of the algorithm dictionary can be recursive and it is difficult to | 216 // parsing of the algorithm dictionary can be recursive and it is difficult to |
217 // tell what went wrong from a failure alone. | 217 // tell what went wrong from a failure alone. |
218 class ErrorContext { | 218 class ErrorContext { |
219 public: | 219 public: |
220 void add(const char* message) { m_messages.append(message); } | 220 void add(const char* message) { m_messages.push_back(message); } |
221 | 221 |
222 void removeLast() { m_messages.pop_back(); } | 222 void removeLast() { m_messages.pop_back(); } |
223 | 223 |
224 // Join all of the string literals into a single String. | 224 // Join all of the string literals into a single String. |
225 String toString() const { | 225 String toString() const { |
226 if (m_messages.isEmpty()) | 226 if (m_messages.isEmpty()) |
227 return String(); | 227 return String(); |
228 | 228 |
229 StringBuilder result; | 229 StringBuilder result; |
230 const char* Separator = ": "; | 230 const char* Separator = ": "; |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1093 } // namespace | 1093 } // namespace |
1094 | 1094 |
1095 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, | 1095 bool normalizeAlgorithm(const AlgorithmIdentifier& raw, |
1096 WebCryptoOperation op, | 1096 WebCryptoOperation op, |
1097 WebCryptoAlgorithm& algorithm, | 1097 WebCryptoAlgorithm& algorithm, |
1098 AlgorithmError* error) { | 1098 AlgorithmError* error) { |
1099 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); | 1099 return parseAlgorithmIdentifier(raw, op, algorithm, ErrorContext(), error); |
1100 } | 1100 } |
1101 | 1101 |
1102 } // namespace blink | 1102 } // namespace blink |
OLD | NEW |