Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp

Issue 1702223002: PaymentRequest API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Windows linking. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 83%
rename from third_party/WebKit/Source/platform/JSONValuesForV8.cpp
rename to third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp
index 94ded635e57939761eefbcd53aca5b311aef680e..9dbf7f57d091a57739a12ce9e64c5061e73216ad 100644
--- a/third_party/WebKit/Source/platform/JSONValuesForV8.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.cpp
@@ -2,7 +2,11 @@
// 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/ScriptState.h"
+#include "bindings/core/v8/V8Binding.h"
namespace blink {
@@ -83,4 +87,17 @@ PassRefPtr<JSONValue> toJSONValue(v8::Local<v8::Context> context, v8::Local<v8::
return nullptr;
}
+v8::Local<v8::Value> fromJSONString(ScriptState* scriptState, const String& stringifiedJSON, ExceptionState& exceptionState)
+{
+ v8::Isolate* isolate = scriptState->isolate();
+ v8::Local<v8::Value> parsed;
+ v8::TryCatch tryCatch(isolate);
+ if (!v8Call(v8::JSON::Parse(isolate, v8String(isolate, stringifiedJSON)), parsed, tryCatch)) {
+ if (tryCatch.HasCaught())
+ exceptionState.rethrowV8Exception(tryCatch.Exception());
+ }
+
+ return parsed;
+}
+
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.h ('k') | third_party/WebKit/Source/bindings/core/v8/v8.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698