11cb0ef41Sopenharmony_ci// Copyright 2016 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#include "src/inspector/v8-value-utils.h"
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ci#include "include/v8-container.h"
81cb0ef41Sopenharmony_ci#include "include/v8-context.h"
91cb0ef41Sopenharmony_ci#include "include/v8-exception.h"
101cb0ef41Sopenharmony_ci
111cb0ef41Sopenharmony_cinamespace v8_inspector {
121cb0ef41Sopenharmony_ci
131cb0ef41Sopenharmony_civ8::Maybe<bool> createDataProperty(v8::Local<v8::Context> context,
141cb0ef41Sopenharmony_ci                                   v8::Local<v8::Object> object,
151cb0ef41Sopenharmony_ci                                   v8::Local<v8::Name> key,
161cb0ef41Sopenharmony_ci                                   v8::Local<v8::Value> value) {
171cb0ef41Sopenharmony_ci  v8::TryCatch tryCatch(context->GetIsolate());
181cb0ef41Sopenharmony_ci  v8::Isolate::DisallowJavascriptExecutionScope throwJs(
191cb0ef41Sopenharmony_ci      context->GetIsolate(),
201cb0ef41Sopenharmony_ci      v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
211cb0ef41Sopenharmony_ci  return object->CreateDataProperty(context, key, value);
221cb0ef41Sopenharmony_ci}
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_civ8::Maybe<bool> createDataProperty(v8::Local<v8::Context> context,
251cb0ef41Sopenharmony_ci                                   v8::Local<v8::Array> array, int index,
261cb0ef41Sopenharmony_ci                                   v8::Local<v8::Value> value) {
271cb0ef41Sopenharmony_ci  v8::TryCatch tryCatch(context->GetIsolate());
281cb0ef41Sopenharmony_ci  v8::Isolate::DisallowJavascriptExecutionScope throwJs(
291cb0ef41Sopenharmony_ci      context->GetIsolate(),
301cb0ef41Sopenharmony_ci      v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE);
311cb0ef41Sopenharmony_ci  return array->CreateDataProperty(context, index, value);
321cb0ef41Sopenharmony_ci}
331cb0ef41Sopenharmony_ci}  // namespace v8_inspector
34