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

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

Issue 2472753003: Move fromJSONString to V8Binding (Closed)
Patch Set: Really swallow exception Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
(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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/JSONValuesForV8.h ('k') | third_party/WebKit/Source/bindings/core/v8/V8Binding.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698