1 // Copyright 2016 the V8 project 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 "src/inspector/v8-value-utils.h"
6
7 #include "include/v8-container.h"
8 #include "include/v8-context.h"
9 #include "include/v8-exception.h"
10
11 namespace v8_inspector {
12
createDataProperty(v8::Local<v8::Context> context,v8::Local<v8::Object> object,v8::Local<v8::Name> key,v8::Local<v8::Value> value)13 v8::Maybe<bool> createDataProperty(v8::Local<v8::Context> context,
14 v8::Local<v8::Object> object,
15 v8::Local<v8::Name> key,
16 v8::Local<v8::Value> value) {
17 v8::TryCatch tryCatch(context->GetIsolate());
18 v8::Isolate::DisallowJavascriptExecutionScope throwJs(
19 context->GetIsolate(),
20 v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
21 return object->CreateDataProperty(context, key, value);
22 }
23
createDataProperty(v8::Local<v8::Context> context,v8::Local<v8::Array> array,int index,v8::Local<v8::Value> value)24 v8::Maybe<bool> createDataProperty(v8::Local<v8::Context> context,
25 v8::Local<v8::Array> array, int index,
26 v8::Local<v8::Value> value) {
27 v8::TryCatch tryCatch(context->GetIsolate());
28 v8::Isolate::DisallowJavascriptExecutionScope throwJs(
29 context->GetIsolate(),
30 v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
31 return array->CreateDataProperty(context, index, value);
32 }
33 } // namespace v8_inspector
34