Chromium Code Reviews| 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 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 185 } | 185 } |
| 186 | 186 |
| 187 void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length) | 187 void CryptoResultImpl::completeWithJson(const char* utf8Data, unsigned length) |
| 188 { | 188 { |
| 189 if (!m_resolver) | 189 if (!m_resolver) |
| 190 return; | 190 return; |
| 191 | 191 |
| 192 ScriptState* scriptState = m_resolver->getScriptState(); | 192 ScriptState* scriptState = m_resolver->getScriptState(); |
| 193 ScriptState::Scope scope(scriptState); | 193 ScriptState::Scope scope(scriptState); |
| 194 | 194 |
| 195 v8::Local<v8::String> jsonString = v8AtomicString(scriptState->isolate(), ut f8Data, length); | 195 v8::Local<v8::String> jsonString = v8StringFromUtf8(scriptState->isolate(), utf8Data, length); |
|
haraken
2016/07/13 01:12:49
Can we use v8AtomicString(..., StringView(utf8Data
esprehn
2016/07/13 01:50:30
That would mangle the utf8 data which needs to be
| |
| 196 | 196 |
| 197 v8::TryCatch exceptionCatcher(scriptState->isolate()); | 197 v8::TryCatch exceptionCatcher(scriptState->isolate()); |
| 198 v8::Local<v8::Value> jsonDictionary; | 198 v8::Local<v8::Value> jsonDictionary; |
| 199 if (v8Call(v8::JSON::Parse(scriptState->isolate(), jsonString), jsonDictiona ry, exceptionCatcher)) | 199 if (v8Call(v8::JSON::Parse(scriptState->isolate(), jsonString), jsonDictiona ry, exceptionCatcher)) |
| 200 m_resolver->resolve(jsonDictionary); | 200 m_resolver->resolve(jsonDictionary); |
| 201 else | 201 else |
| 202 m_resolver->reject(exceptionCatcher.Exception()); | 202 m_resolver->reject(exceptionCatcher.Exception()); |
| 203 clearResolver(); | 203 clearResolver(); |
| 204 } | 204 } |
| 205 | 205 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 245 m_cancel.clear(); | 245 m_cancel.clear(); |
| 246 clearResolver(); | 246 clearResolver(); |
| 247 } | 247 } |
| 248 | 248 |
| 249 ScriptPromise CryptoResultImpl::promise() | 249 ScriptPromise CryptoResultImpl::promise() |
| 250 { | 250 { |
| 251 return m_resolver ? m_resolver->promise() : ScriptPromise(); | 251 return m_resolver ? m_resolver->promise() : ScriptPromise(); |
| 252 } | 252 } |
| 253 | 253 |
| 254 } // namespace blink | 254 } // namespace blink |
| OLD | NEW |