v8-injected-script-host.h 1.99 KB
Newer Older
1 2 3 4
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5 6
#ifndef V8_INSPECTOR_V8_INJECTED_SCRIPT_HOST_H_
#define V8_INSPECTOR_V8_INJECTED_SCRIPT_HOST_H_
7

8
#include "include/v8.h"
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29

namespace v8_inspector {

class V8InspectorImpl;

// SECURITY NOTE: Although the InjectedScriptHost is intended for use solely by
// the inspector,
// a reference to the InjectedScriptHost may be leaked to the page being
// inspected. Thus, the
// InjectedScriptHost must never implemment methods that have more power over
// the page than the
// page already has itself (e.g. origin restriction bypasses).

class V8InjectedScriptHost {
 public:
  // We expect that debugger outlives any JS context and thus
  // V8InjectedScriptHost (owned by JS)
  // is destroyed before inspector.
  static v8::Local<v8::Object> create(v8::Local<v8::Context>, V8InspectorImpl*);

 private:
30 31
  static void nullifyPrototypeCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
32
  static void getPropertyCallback(const v8::FunctionCallbackInfo<v8::Value>&);
33 34 35 36 37 38 39 40 41 42 43 44
  static void internalConstructorNameCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
  static void formatAccessorsAsProperties(
      const v8::FunctionCallbackInfo<v8::Value>&);
  static void subtypeCallback(const v8::FunctionCallbackInfo<v8::Value>&);
  static void getInternalPropertiesCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
  static void objectHasOwnPropertyCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
  static void bindCallback(const v8::FunctionCallbackInfo<v8::Value>&);
  static void proxyTargetValueCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
45 46
  static void nativeAccessorDescriptorCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
47 48
  static void typedArrayPropertiesCallback(
      const v8::FunctionCallbackInfo<v8::Value>&);
49 50 51 52
};

}  // namespace v8_inspector

53
#endif  // V8_INSPECTOR_V8_INJECTED_SCRIPT_HOST_H_