| OLD | NEW |
| (Empty) |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "bindings/core/v8/JSONValuesForV8.h" | |
| 6 | |
| 7 #include "bindings/core/v8/ExceptionState.h" | |
| 8 #include "bindings/core/v8/ScriptState.h" | |
| 9 #include "bindings/core/v8/V8Binding.h" | |
| 10 | |
| 11 namespace blink { | |
| 12 | |
| 13 v8::Local<v8::Value> fromJSONString(ScriptState* scriptState, | |
| 14 const String& stringifiedJSON, | |
| 15 ExceptionState& exceptionState) { | |
| 16 v8::Isolate* isolate = scriptState->isolate(); | |
| 17 v8::Local<v8::Value> parsed; | |
| 18 v8::TryCatch tryCatch(isolate); | |
| 19 if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), | |
| 20 parsed, tryCatch)) { | |
| 21 if (tryCatch.HasCaught()) | |
| 22 exceptionState.rethrowV8Exception(tryCatch.Exception()); | |
| 23 } | |
| 24 | |
| 25 return parsed; | |
| 26 } | |
| 27 | |
| 28 } // namespace blink | |
| OLD | NEW |