Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp |
| diff --git a/third_party/WebKit/Source/platform/JSONValuesForV8.cpp b/third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp |
| similarity index 84% |
| rename from third_party/WebKit/Source/platform/JSONValuesForV8.cpp |
| rename to third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp |
| index 94ded635e57939761eefbcd53aca5b311aef680e..dfd62744ca9c51a0dc51006b72a424ec93732483 100644 |
| --- a/third_party/WebKit/Source/platform/JSONValuesForV8.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp |
| @@ -2,7 +2,10 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "platform/JSONValuesForV8.h" |
| +#include "bindings/core/v8/JSONValuesForV8.h" |
| + |
| +#include "bindings/core/v8/ExceptionState.h" |
| +#include "bindings/core/v8/V8Binding.h" |
| namespace blink { |
| @@ -83,4 +86,17 @@ PassRefPtr<JSONValue> toJSONValue(v8::Local<v8::Context> context, v8::Local<v8:: |
| return nullptr; |
| } |
| +v8::Local<v8::Value> fromJSONString(v8::Local<v8::Context> context, const String& stringifiedJSON, ExceptionState& exceptionState) |
|
haraken
2016/03/02 00:46:16
Nit: You can pass in ScriptState rather than v8::C
please use gerrit instead
2016/03/02 01:24:34
Done.
|
| +{ |
| + v8::Isolate* isolate = context->GetIsolate(); |
| + v8::Local<v8::Value> parsed; |
| + v8::TryCatch tryCatch(isolate); |
|
haraken
2016/03/02 00:46:16
Use scriptState->isolate().
please use gerrit instead
2016/03/02 01:24:34
Done.
|
| + if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), parsed, tryCatch)) { |
| + if (tryCatch.HasCaught()) |
| + exceptionState.rethrowV8Exception(tryCatch.Exception()); |
|
haraken
2016/03/02 00:46:16
Have you confirmed that this throws an exception a
please use gerrit instead
2016/03/02 01:24:34
For PaymentResponse, the stringified JSON comes fr
|
| + } |
| + |
| + return parsed; |
| +} |
| + |
| } // namespace blink |