xref: /third_party/node/deps/v8/src/inspector/v8-value-utils.cc (revision 1cb0ef41)
  • Home
  • History
  • Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /third_party/node/deps/v8/src/inspector/
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
11namespace v8_inspector {
12
13v8::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
24v8::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

Indexes created Thu Nov 07 10:32:03 CST 2024