2020-01-06 10:59:05 +01:00
|
|
|
// Copyright (c) 2020 Marshall A. Greenblatt. All rights reserved.
|
2012-04-03 03:34:16 +02:00
|
|
|
//
|
|
|
|
// Redistribution and use in source and binary forms, with or without
|
|
|
|
// modification, are permitted provided that the following conditions are
|
|
|
|
// met:
|
|
|
|
//
|
|
|
|
// * Redistributions of source code must retain the above copyright
|
|
|
|
// notice, this list of conditions and the following disclaimer.
|
|
|
|
// * Redistributions in binary form must reproduce the above
|
|
|
|
// copyright notice, this list of conditions and the following disclaimer
|
|
|
|
// in the documentation and/or other materials provided with the
|
|
|
|
// distribution.
|
|
|
|
// * Neither the name of Google Inc. nor the name Chromium Embedded
|
|
|
|
// Framework nor the names of its contributors may be used to endorse
|
|
|
|
// or promote products derived from this software without specific prior
|
|
|
|
// written permission.
|
|
|
|
//
|
|
|
|
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
|
|
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
|
|
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
|
|
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
|
|
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
|
|
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
|
|
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
//
|
|
|
|
// ---------------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// This file was generated by the CEF translator tool and should not edited
|
|
|
|
// by hand. See the translator.README.txt file in the tools directory for
|
|
|
|
// more information.
|
|
|
|
//
|
2020-01-06 10:59:05 +01:00
|
|
|
// $hash=3bb8f9801a153172981120926c7a5629e08d7131$
|
2017-05-17 11:29:28 +02:00
|
|
|
//
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
#ifndef CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
|
|
|
|
#define CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "include/capi/cef_base_capi.h"
|
2014-01-06 20:59:48 +01:00
|
|
|
#include "include/capi/cef_browser_capi.h"
|
|
|
|
#include "include/capi/cef_frame_capi.h"
|
|
|
|
#include "include/capi/cef_task_capi.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2014-02-10 18:20:38 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2014-01-06 20:59:48 +01:00
|
|
|
struct _cef_v8exception_t;
|
|
|
|
struct _cef_v8handler_t;
|
|
|
|
struct _cef_v8stack_frame_t;
|
|
|
|
struct _cef_v8value_t;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2013-01-03 18:24:24 +01:00
|
|
|
// Structure representing a V8 context handle. V8 handles can only be accessed
|
|
|
|
// from the thread on which they are created. Valid threads for creating a V8
|
|
|
|
// handle include the render process main thread (TID_RENDERER) and WebWorker
|
|
|
|
// threads. A task runner for posting tasks on the associated thread can be
|
|
|
|
// retrieved via the cef_v8context_t::get_task_runner() function.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8context_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-01-03 18:24:24 +01:00
|
|
|
///
|
|
|
|
// Returns the task runner associated with this context. V8 handles can only
|
|
|
|
// be accessed from the thread on which they are created. This function can be
|
|
|
|
// called on any render process thread.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_task_runner_t*(CEF_CALLBACK* get_task_runner)(
|
2013-01-03 18:24:24 +01:00
|
|
|
struct _cef_v8context_t* self);
|
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2012-12-30 22:16:59 +01:00
|
|
|
// Returns true (1) if the underlying handle is valid and it can be accessed
|
|
|
|
// on the current thread. Do not call any other functions if this function
|
|
|
|
// returns false (0).
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_valid)(struct _cef_v8context_t* self);
|
2012-10-29 22:46:02 +01:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2013-01-03 18:24:24 +01:00
|
|
|
// Returns the browser for this context. This function will return an NULL
|
|
|
|
// reference for WebWorker contexts.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_browser_t*(CEF_CALLBACK* get_browser)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8context_t* self);
|
|
|
|
|
|
|
|
///
|
2013-01-03 18:24:24 +01:00
|
|
|
// Returns the frame for this context. This function will return an NULL
|
|
|
|
// reference for WebWorker contexts.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_frame_t*(CEF_CALLBACK* get_frame)(struct _cef_v8context_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the global object for this context. The context must be entered
|
|
|
|
// before calling this function.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8value_t*(CEF_CALLBACK* get_global)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8context_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Enter this context. A context must be explicitly entered before creating a
|
|
|
|
// V8 Object, Array, Function or Date asynchronously. exit() must be called
|
|
|
|
// the same number of times as enter() before releasing this context. V8
|
|
|
|
// objects belong to the context in which they are created. Returns true (1)
|
|
|
|
// if the scope was entered successfully.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* enter)(struct _cef_v8context_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Exit this context. Call this function only after calling enter(). Returns
|
|
|
|
// true (1) if the scope was exited successfully.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* exit)(struct _cef_v8context_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if this object is pointing to the same handle as |that|
|
|
|
|
// object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_same)(struct _cef_v8context_t* self,
|
|
|
|
struct _cef_v8context_t* that);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-27 18:34:19 +02:00
|
|
|
// Execute a string of JavaScript code in this V8 context. The |script_url|
|
|
|
|
// parameter is the URL where the script in question can be found, if any. The
|
|
|
|
// |start_line| parameter is the base line number to use for error reporting.
|
2012-04-03 03:34:16 +02:00
|
|
|
// On success |retval| will be set to the return value, if any, and the
|
|
|
|
// function will return true (1). On failure |exception| will be set to the
|
|
|
|
// exception, if any, and the function will return false (0).
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* eval)(struct _cef_v8context_t* self,
|
|
|
|
const cef_string_t* code,
|
|
|
|
const cef_string_t* script_url,
|
|
|
|
int start_line,
|
|
|
|
struct _cef_v8value_t** retval,
|
|
|
|
struct _cef_v8exception_t** exception);
|
2012-04-03 03:34:16 +02:00
|
|
|
} cef_v8context_t;
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the current (top) context object in the V8 context stack.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8context_t* cef_v8context_get_current_context();
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the entered (bottom) context object in the V8 context stack.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8context_t* cef_v8context_get_entered_context();
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if V8 is currently inside a context.
|
|
|
|
///
|
|
|
|
CEF_EXPORT int cef_v8context_in_context();
|
|
|
|
|
|
|
|
///
|
|
|
|
// Structure that should be implemented to handle V8 function calls. The
|
2013-01-03 18:24:24 +01:00
|
|
|
// functions of this structure will be called on the thread associated with the
|
|
|
|
// V8 function.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8handler_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle execution of the function identified by |name|. |object| is the
|
|
|
|
// receiver ('this' object) of the function. |arguments| is the list of
|
|
|
|
// arguments passed to the function. If execution succeeds set |retval| to the
|
|
|
|
// function return value. If execution fails set |exception| to the exception
|
|
|
|
// that will be thrown. Return true (1) if execution was handled.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* execute)(struct _cef_v8handler_t* self,
|
|
|
|
const cef_string_t* name,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
size_t argumentsCount,
|
|
|
|
struct _cef_v8value_t* const* arguments,
|
|
|
|
struct _cef_v8value_t** retval,
|
|
|
|
cef_string_t* exception);
|
2012-04-03 03:34:16 +02:00
|
|
|
} cef_v8handler_t;
|
|
|
|
|
|
|
|
///
|
|
|
|
// Structure that should be implemented to handle V8 accessor calls. Accessor
|
2015-04-15 15:45:30 +02:00
|
|
|
// identifiers are registered by calling cef_v8value_t::set_value(). The
|
|
|
|
// functions of this structure will be called on the thread associated with the
|
|
|
|
// V8 accessor.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8accessor_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle retrieval the accessor value identified by |name|. |object| is the
|
|
|
|
// receiver ('this' object) of the accessor. If retrieval succeeds set
|
|
|
|
// |retval| to the return value. If retrieval fails set |exception| to the
|
|
|
|
// exception that will be thrown. Return true (1) if accessor retrieval was
|
|
|
|
// handled.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get)(struct _cef_v8accessor_t* self,
|
|
|
|
const cef_string_t* name,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
struct _cef_v8value_t** retval,
|
|
|
|
cef_string_t* exception);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle assignment of the accessor value identified by |name|. |object| is
|
|
|
|
// the receiver ('this' object) of the accessor. |value| is the new value
|
|
|
|
// being assigned to the accessor. If assignment fails set |exception| to the
|
|
|
|
// exception that will be thrown. Return true (1) if accessor assignment was
|
|
|
|
// handled.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set)(struct _cef_v8accessor_t* self,
|
|
|
|
const cef_string_t* name,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
struct _cef_v8value_t* value,
|
|
|
|
cef_string_t* exception);
|
2012-04-03 03:34:16 +02:00
|
|
|
} cef_v8accessor_t;
|
|
|
|
|
2016-10-27 19:23:56 +02:00
|
|
|
///
|
|
|
|
// Structure that should be implemented to handle V8 interceptor calls. The
|
|
|
|
// functions of this structure will be called on the thread associated with the
|
|
|
|
// V8 interceptor. Interceptor's named property handlers (with first argument of
|
|
|
|
// type CefString) are called when object is indexed by string. Indexed property
|
|
|
|
// handlers (with first argument of type int) are called when object is indexed
|
|
|
|
// by integer.
|
|
|
|
///
|
|
|
|
typedef struct _cef_v8interceptor_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2016-10-27 19:23:56 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle retrieval of the interceptor value identified by |name|. |object| is
|
|
|
|
// the receiver ('this' object) of the interceptor. If retrieval succeeds, set
|
|
|
|
// |retval| to the return value. If the requested value does not exist, don't
|
|
|
|
// set either |retval| or |exception|. If retrieval fails, set |exception| to
|
|
|
|
// the exception that will be thrown. If the property has an associated
|
|
|
|
// accessor, it will be called only if you don't set |retval|. Return true (1)
|
|
|
|
// if interceptor retrieval was handled, false (0) otherwise.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_byname)(struct _cef_v8interceptor_t* self,
|
|
|
|
const cef_string_t* name,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
struct _cef_v8value_t** retval,
|
|
|
|
cef_string_t* exception);
|
2016-10-27 19:23:56 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle retrieval of the interceptor value identified by |index|. |object|
|
|
|
|
// is the receiver ('this' object) of the interceptor. If retrieval succeeds,
|
|
|
|
// set |retval| to the return value. If the requested value does not exist,
|
|
|
|
// don't set either |retval| or |exception|. If retrieval fails, set
|
|
|
|
// |exception| to the exception that will be thrown. Return true (1) if
|
|
|
|
// interceptor retrieval was handled, false (0) otherwise.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_byindex)(struct _cef_v8interceptor_t* self,
|
|
|
|
int index,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
struct _cef_v8value_t** retval,
|
|
|
|
cef_string_t* exception);
|
2016-10-27 19:23:56 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle assignment of the interceptor value identified by |name|. |object|
|
|
|
|
// is the receiver ('this' object) of the interceptor. |value| is the new
|
|
|
|
// value being assigned to the interceptor. If assignment fails, set
|
|
|
|
// |exception| to the exception that will be thrown. This setter will always
|
|
|
|
// be called, even when the property has an associated accessor. Return true
|
|
|
|
// (1) if interceptor assignment was handled, false (0) otherwise.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_byname)(struct _cef_v8interceptor_t* self,
|
|
|
|
const cef_string_t* name,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
struct _cef_v8value_t* value,
|
|
|
|
cef_string_t* exception);
|
2016-10-27 19:23:56 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Handle assignment of the interceptor value identified by |index|. |object|
|
|
|
|
// is the receiver ('this' object) of the interceptor. |value| is the new
|
|
|
|
// value being assigned to the interceptor. If assignment fails, set
|
|
|
|
// |exception| to the exception that will be thrown. Return true (1) if
|
|
|
|
// interceptor assignment was handled, false (0) otherwise.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_byindex)(struct _cef_v8interceptor_t* self,
|
|
|
|
int index,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
struct _cef_v8value_t* value,
|
|
|
|
cef_string_t* exception);
|
2016-10-27 19:23:56 +02:00
|
|
|
} cef_v8interceptor_t;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2012-12-30 22:16:59 +01:00
|
|
|
// Structure representing a V8 exception. The functions of this structure may be
|
|
|
|
// called on any render process thread.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8exception_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the exception message.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_message)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8exception_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the line of source code that the exception occurred within.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_source_line)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8exception_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the resource name for the script from where the function causing
|
|
|
|
// the error originates.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_script_resource_name)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8exception_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the 1-based number of the line where the error occurred or 0 if the
|
|
|
|
// line number is unknown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_line_number)(struct _cef_v8exception_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the index within the script of the first character where the error
|
|
|
|
// occurred.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_start_position)(struct _cef_v8exception_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the index within the script of the last character where the error
|
|
|
|
// occurred.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_end_position)(struct _cef_v8exception_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the index within the line of the first character where the error
|
|
|
|
// occurred.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_start_column)(struct _cef_v8exception_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the index within the line of the last character where the error
|
|
|
|
// occurred.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_end_column)(struct _cef_v8exception_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
} cef_v8exception_t;
|
|
|
|
|
2018-04-10 21:37:33 +02:00
|
|
|
///
|
|
|
|
// Callback structure that is passed to cef_v8value_t::CreateArrayBuffer.
|
|
|
|
///
|
|
|
|
typedef struct _cef_v8array_buffer_release_callback_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
|
|
|
cef_base_ref_counted_t base;
|
|
|
|
|
|
|
|
///
|
|
|
|
// Called to release |buffer| when the ArrayBuffer JS object is garbage
|
|
|
|
// collected. |buffer| is the value that was passed to CreateArrayBuffer along
|
|
|
|
// with this object.
|
|
|
|
///
|
|
|
|
void(CEF_CALLBACK* release_buffer)(
|
|
|
|
struct _cef_v8array_buffer_release_callback_t* self,
|
|
|
|
void* buffer);
|
|
|
|
} cef_v8array_buffer_release_callback_t;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2013-01-03 18:24:24 +01:00
|
|
|
// Structure representing a V8 value handle. V8 handles can only be accessed
|
|
|
|
// from the thread on which they are created. Valid threads for creating a V8
|
|
|
|
// handle include the render process main thread (TID_RENDERER) and WebWorker
|
|
|
|
// threads. A task runner for posting tasks on the associated thread can be
|
|
|
|
// retrieved via the cef_v8context_t::get_task_runner() function.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8value_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2012-12-30 22:16:59 +01:00
|
|
|
// Returns true (1) if the underlying handle is valid and it can be accessed
|
|
|
|
// on the current thread. Do not call any other functions if this function
|
|
|
|
// returns false (0).
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_valid)(struct _cef_v8value_t* self);
|
2012-10-29 22:46:02 +01:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
// True if the value type is undefined.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_undefined)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is null.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_null)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is bool.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_bool)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is int.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_int)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is unsigned int.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_uint)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is double.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_double)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is Date.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_date)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is string.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_string)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_object)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// True if the value type is array.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_array)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-04-10 21:37:33 +02:00
|
|
|
///
|
|
|
|
// True if the value type is an ArrayBuffer.
|
|
|
|
///
|
|
|
|
int(CEF_CALLBACK* is_array_buffer)(struct _cef_v8value_t* self);
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
// True if the value type is function.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_function)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if this object is pointing to the same handle as |that|
|
|
|
|
// object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_same)(struct _cef_v8value_t* self,
|
|
|
|
struct _cef_v8value_t* that);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-29 02:52:40 +02:00
|
|
|
// Return a bool value.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_bool_value)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-29 02:52:40 +02:00
|
|
|
// Return an int value.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int32(CEF_CALLBACK* get_int_value)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-29 02:52:40 +02:00
|
|
|
// Return an unsigned int value.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
uint32(CEF_CALLBACK* get_uint_value)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-29 02:52:40 +02:00
|
|
|
// Return a double value.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
double(CEF_CALLBACK* get_double_value)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-29 02:52:40 +02:00
|
|
|
// Return a Date value.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_time_t(CEF_CALLBACK* get_date_value)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
2016-10-29 02:52:40 +02:00
|
|
|
// Return a string value.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_string_value)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
// OBJECT METHODS - These functions are only available on objects. Arrays and
|
|
|
|
// functions are also objects. String- and integer-based keys can be used
|
|
|
|
// interchangably with the framework converting between them as necessary.
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if this is a user created object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_user_created)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if the last function call resulted in an exception. This
|
|
|
|
// attribute exists only in the scope of the current CEF value object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* has_exception)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the exception resulting from the last function call. This attribute
|
|
|
|
// exists only in the scope of the current CEF value object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8exception_t*(CEF_CALLBACK* get_exception)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Clears the last exception and returns true (1) on success.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* clear_exception)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if this object will re-throw future exceptions. This
|
|
|
|
// attribute exists only in the scope of the current CEF value object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* will_rethrow_exceptions)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Set whether this object will re-throw future exceptions. By default
|
|
|
|
// exceptions are not re-thrown. If a exception is re-thrown the current
|
|
|
|
// context should not be accessed again until after the exception has been
|
|
|
|
// caught and not re-thrown. Returns true (1) on success. This attribute
|
|
|
|
// exists only in the scope of the current CEF value object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_rethrow_exceptions)(struct _cef_v8value_t* self,
|
|
|
|
int rethrow);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if the object has a value with the specified identifier.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* has_value_bykey)(struct _cef_v8value_t* self,
|
|
|
|
const cef_string_t* key);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if the object has a value with the specified identifier.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* has_value_byindex)(struct _cef_v8value_t* self, int index);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Deletes the value with the specified identifier and returns true (1) on
|
|
|
|
// success. Returns false (0) if this function is called incorrectly or an
|
|
|
|
// exception is thrown. For read-only and don't-delete values this function
|
|
|
|
// will return true (1) even though deletion failed.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* delete_value_bykey)(struct _cef_v8value_t* self,
|
|
|
|
const cef_string_t* key);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Deletes the value with the specified identifier and returns true (1) on
|
|
|
|
// success. Returns false (0) if this function is called incorrectly, deletion
|
|
|
|
// fails or an exception is thrown. For read-only and don't-delete values this
|
|
|
|
// function will return true (1) even though deletion failed.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* delete_value_byindex)(struct _cef_v8value_t* self,
|
|
|
|
int index);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the value with the specified identifier on success. Returns NULL if
|
|
|
|
// this function is called incorrectly or an exception is thrown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8value_t*(CEF_CALLBACK* get_value_bykey)(
|
|
|
|
struct _cef_v8value_t* self,
|
|
|
|
const cef_string_t* key);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the value with the specified identifier on success. Returns NULL if
|
|
|
|
// this function is called incorrectly or an exception is thrown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8value_t*(
|
|
|
|
CEF_CALLBACK* get_value_byindex)(struct _cef_v8value_t* self, int index);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Associates a value with the specified identifier and returns true (1) on
|
|
|
|
// success. Returns false (0) if this function is called incorrectly or an
|
|
|
|
// exception is thrown. For read-only values this function will return true
|
|
|
|
// (1) even though assignment failed.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_value_bykey)(struct _cef_v8value_t* self,
|
|
|
|
const cef_string_t* key,
|
|
|
|
struct _cef_v8value_t* value,
|
|
|
|
cef_v8_propertyattribute_t attribute);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Associates a value with the specified identifier and returns true (1) on
|
|
|
|
// success. Returns false (0) if this function is called incorrectly or an
|
|
|
|
// exception is thrown. For read-only values this function will return true
|
|
|
|
// (1) even though assignment failed.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_value_byindex)(struct _cef_v8value_t* self,
|
|
|
|
int index,
|
|
|
|
struct _cef_v8value_t* value);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Registers an identifier and returns true (1) on success. Access to the
|
|
|
|
// identifier will be forwarded to the cef_v8accessor_t instance passed to
|
|
|
|
// cef_v8value_t::cef_v8value_create_object(). Returns false (0) if this
|
|
|
|
// function is called incorrectly or an exception is thrown. For read-only
|
|
|
|
// values this function will return true (1) even though assignment failed.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_value_byaccessor)(struct _cef_v8value_t* self,
|
|
|
|
const cef_string_t* key,
|
|
|
|
cef_v8_accesscontrol_t settings,
|
|
|
|
cef_v8_propertyattribute_t attribute);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Read the keys for the object's values into the specified vector. Integer-
|
|
|
|
// based keys will also be returned as strings.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_keys)(struct _cef_v8value_t* self,
|
|
|
|
cef_string_list_t keys);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Sets the user data for this object and returns true (1) on success. Returns
|
|
|
|
// false (0) if this function is called incorrectly. This function can only be
|
|
|
|
// called on user created objects.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* set_user_data)(struct _cef_v8value_t* self,
|
|
|
|
struct _cef_base_ref_counted_t* user_data);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the user data, if any, assigned to this object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_base_ref_counted_t*(CEF_CALLBACK* get_user_data)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the amount of externally allocated memory registered for the
|
|
|
|
// object.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_externally_allocated_memory)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Adjusts the amount of registered external memory for the object. Used to
|
|
|
|
// give V8 an indication of the amount of externally allocated memory that is
|
|
|
|
// kept alive by JavaScript objects. V8 uses this information to decide when
|
|
|
|
// to perform global garbage collection. Each cef_v8value_t tracks the amount
|
|
|
|
// of external memory associated with it and automatically decreases the
|
|
|
|
// global total by the appropriate amount on its destruction.
|
|
|
|
// |change_in_bytes| specifies the number of bytes to adjust by. This function
|
|
|
|
// returns the number of bytes associated with the object after the
|
|
|
|
// adjustment. This function can only be called on user created objects.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* adjust_externally_allocated_memory)(
|
|
|
|
struct _cef_v8value_t* self,
|
|
|
|
int change_in_bytes);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
// ARRAY METHODS - These functions are only available on arrays.
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the number of elements in the array.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_array_length)(struct _cef_v8value_t* self);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-04-10 21:37:33 +02:00
|
|
|
// ARRAY BUFFER METHODS - These functions are only available on ArrayBuffers.
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the ReleaseCallback object associated with the ArrayBuffer or NULL
|
|
|
|
// if the ArrayBuffer was not created with CreateArrayBuffer.
|
|
|
|
///
|
|
|
|
struct _cef_v8array_buffer_release_callback_t*(
|
|
|
|
CEF_CALLBACK* get_array_buffer_release_callback)(
|
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Prevent the ArrayBuffer from using it's memory block by setting the length
|
|
|
|
// to zero. This operation cannot be undone. If the ArrayBuffer was created
|
|
|
|
// with CreateArrayBuffer then
|
|
|
|
// cef_v8array_buffer_release_callback_t::ReleaseBuffer will be called to
|
|
|
|
// release the underlying buffer.
|
|
|
|
///
|
|
|
|
int(CEF_CALLBACK* neuter_array_buffer)(struct _cef_v8value_t* self);
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// FUNCTION METHODS - These functions are only available on functions.
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the function name.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_function_name)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the function handler or NULL if not a CEF-created function.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8handler_t*(CEF_CALLBACK* get_function_handler)(
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Execute the function using the current V8 context. This function should
|
|
|
|
// only be called from within the scope of a cef_v8handler_t or
|
|
|
|
// cef_v8accessor_t callback, or in combination with calling enter() and
|
|
|
|
// exit() on a stored cef_v8context_t reference. |object| is the receiver
|
|
|
|
// ('this' object) of the function. If |object| is NULL the current context's
|
|
|
|
// global object will be used. |arguments| is the list of arguments that will
|
|
|
|
// be passed to the function. Returns the function return value on success.
|
|
|
|
// Returns NULL if this function is called incorrectly or an exception is
|
|
|
|
// thrown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8value_t*(CEF_CALLBACK* execute_function)(
|
|
|
|
struct _cef_v8value_t* self,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
size_t argumentsCount,
|
|
|
|
struct _cef_v8value_t* const* arguments);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Execute the function using the specified V8 context. |object| is the
|
|
|
|
// receiver ('this' object) of the function. If |object| is NULL the specified
|
|
|
|
// context's global object will be used. |arguments| is the list of arguments
|
|
|
|
// that will be passed to the function. Returns the function return value on
|
|
|
|
// success. Returns NULL if this function is called incorrectly or an
|
|
|
|
// exception is thrown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8value_t*(CEF_CALLBACK* execute_function_with_context)(
|
|
|
|
struct _cef_v8value_t* self,
|
|
|
|
struct _cef_v8context_t* context,
|
|
|
|
struct _cef_v8value_t* object,
|
|
|
|
size_t argumentsCount,
|
2012-04-03 03:34:16 +02:00
|
|
|
struct _cef_v8value_t* const* arguments);
|
|
|
|
} cef_v8value_t;
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type undefined.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_undefined();
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type null.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_null();
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type bool.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_bool(int value);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type int.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_int(int32 value);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type unsigned int.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_uint(uint32 value);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type double.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_double(double value);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type Date. This function should only be
|
2015-03-30 11:40:33 +02:00
|
|
|
// called from within the scope of a cef_render_process_handler_t,
|
|
|
|
// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling
|
|
|
|
// enter() and exit() on a stored cef_v8context_t reference.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_date(const cef_time_t* date);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type string.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value);
|
|
|
|
|
|
|
|
///
|
2016-10-27 19:23:56 +02:00
|
|
|
// Create a new cef_v8value_t object of type object with optional accessor
|
|
|
|
// and/or interceptor. This function should only be called from within the scope
|
|
|
|
// of a cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t
|
|
|
|
// callback, or in combination with calling enter() and exit() on a stored
|
|
|
|
// cef_v8context_t reference.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_object(
|
|
|
|
cef_v8accessor_t* accessor,
|
2016-10-27 19:23:56 +02:00
|
|
|
cef_v8interceptor_t* interceptor);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type array with the specified |length|.
|
|
|
|
// If |length| is negative the returned array will have length 0. This function
|
2015-03-30 11:40:33 +02:00
|
|
|
// should only be called from within the scope of a
|
|
|
|
// cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t callback,
|
|
|
|
// or in combination with calling enter() and exit() on a stored cef_v8context_t
|
|
|
|
// reference.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_array(int length);
|
|
|
|
|
2018-04-10 21:37:33 +02:00
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type ArrayBuffer which wraps the
|
|
|
|
// provided |buffer| of size |length| bytes. The ArrayBuffer is externalized,
|
|
|
|
// meaning that it does not own |buffer|. The caller is responsible for freeing
|
|
|
|
// |buffer| when requested via a call to cef_v8array_buffer_release_callback_t::
|
|
|
|
// ReleaseBuffer. This function should only be called from within the scope of a
|
|
|
|
// cef_render_process_handler_t, cef_v8handler_t or cef_v8accessor_t callback,
|
|
|
|
// or in combination with calling enter() and exit() on a stored cef_v8context_t
|
|
|
|
// reference.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_array_buffer(
|
|
|
|
void* buffer,
|
|
|
|
size_t length,
|
|
|
|
cef_v8array_buffer_release_callback_t* release_callback);
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
// Create a new cef_v8value_t object of type function. This function should only
|
2015-03-30 11:40:33 +02:00
|
|
|
// be called from within the scope of a cef_render_process_handler_t,
|
|
|
|
// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling
|
|
|
|
// enter() and exit() on a stored cef_v8context_t reference.
|
2012-04-03 03:34:16 +02:00
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8value_t* cef_v8value_create_function(const cef_string_t* name,
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_v8handler_t* handler);
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
///
|
2013-01-03 18:24:24 +01:00
|
|
|
// Structure representing a V8 stack trace handle. V8 handles can only be
|
|
|
|
// accessed from the thread on which they are created. Valid threads for
|
|
|
|
// creating a V8 handle include the render process main thread (TID_RENDERER)
|
|
|
|
// and WebWorker threads. A task runner for posting tasks on the associated
|
|
|
|
// thread can be retrieved via the cef_v8context_t::get_task_runner() function.
|
2012-07-25 13:50:35 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8stack_trace_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2012-12-30 22:16:59 +01:00
|
|
|
// Returns true (1) if the underlying handle is valid and it can be accessed
|
|
|
|
// on the current thread. Do not call any other functions if this function
|
|
|
|
// returns false (0).
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_valid)(struct _cef_v8stack_trace_t* self);
|
2012-10-29 22:46:02 +01:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
///
|
|
|
|
// Returns the number of stack frames.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_frame_count)(struct _cef_v8stack_trace_t* self);
|
2012-07-25 13:50:35 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the stack frame at the specified 0-based index.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
struct _cef_v8stack_frame_t*(
|
|
|
|
CEF_CALLBACK* get_frame)(struct _cef_v8stack_trace_t* self, int index);
|
2012-07-25 13:50:35 +02:00
|
|
|
} cef_v8stack_trace_t;
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the stack trace for the currently active context. |frame_limit| is
|
|
|
|
// the maximum number of frames that will be captured.
|
|
|
|
///
|
|
|
|
CEF_EXPORT cef_v8stack_trace_t* cef_v8stack_trace_get_current(int frame_limit);
|
|
|
|
|
|
|
|
///
|
2013-01-03 18:24:24 +01:00
|
|
|
// Structure representing a V8 stack frame handle. V8 handles can only be
|
|
|
|
// accessed from the thread on which they are created. Valid threads for
|
|
|
|
// creating a V8 handle include the render process main thread (TID_RENDERER)
|
|
|
|
// and WebWorker threads. A task runner for posting tasks on the associated
|
|
|
|
// thread can be retrieved via the cef_v8context_t::get_task_runner() function.
|
2012-07-25 13:50:35 +02:00
|
|
|
///
|
|
|
|
typedef struct _cef_v8stack_frame_t {
|
|
|
|
///
|
|
|
|
// Base structure.
|
|
|
|
///
|
2017-02-09 23:07:43 +01:00
|
|
|
cef_base_ref_counted_t base;
|
2012-07-25 13:50:35 +02:00
|
|
|
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2012-12-30 22:16:59 +01:00
|
|
|
// Returns true (1) if the underlying handle is valid and it can be accessed
|
|
|
|
// on the current thread. Do not call any other functions if this function
|
|
|
|
// returns false (0).
|
2012-10-29 22:46:02 +01:00
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_valid)(struct _cef_v8stack_frame_t* self);
|
2012-10-29 22:46:02 +01:00
|
|
|
|
2012-07-25 13:50:35 +02:00
|
|
|
///
|
|
|
|
// Returns the name of the resource script that contains the function.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_script_name)(
|
2012-07-25 13:50:35 +02:00
|
|
|
struct _cef_v8stack_frame_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the name of the resource script that contains the function or the
|
|
|
|
// sourceURL value if the script name is undefined and its source ends with a
|
|
|
|
// "//@ sourceURL=..." string.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_script_name_or_source_url)(
|
2012-07-25 13:50:35 +02:00
|
|
|
struct _cef_v8stack_frame_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the name of the function.
|
|
|
|
///
|
|
|
|
// The resulting string must be freed by calling cef_string_userfree_free().
|
2017-05-17 11:29:28 +02:00
|
|
|
cef_string_userfree_t(CEF_CALLBACK* get_function_name)(
|
2012-07-25 13:50:35 +02:00
|
|
|
struct _cef_v8stack_frame_t* self);
|
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the 1-based line number for the function call or 0 if unknown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_line_number)(struct _cef_v8stack_frame_t* self);
|
2012-07-25 13:50:35 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns the 1-based column offset on the line for the function call or 0 if
|
|
|
|
// unknown.
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* get_column)(struct _cef_v8stack_frame_t* self);
|
2012-07-25 13:50:35 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if the function was compiled using eval().
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_eval)(struct _cef_v8stack_frame_t* self);
|
2012-07-25 13:50:35 +02:00
|
|
|
|
|
|
|
///
|
|
|
|
// Returns true (1) if the function was called as a constructor via "new".
|
|
|
|
///
|
2017-05-17 11:29:28 +02:00
|
|
|
int(CEF_CALLBACK* is_constructor)(struct _cef_v8stack_frame_t* self);
|
2012-07-25 13:50:35 +02:00
|
|
|
} cef_v8stack_frame_t;
|
|
|
|
|
2014-01-06 20:59:48 +01:00
|
|
|
///
|
|
|
|
// Register a new V8 extension with the specified JavaScript extension code and
|
|
|
|
// handler. Functions implemented by the handler are prototyped using the
|
|
|
|
// keyword 'native'. The calling of a native function is restricted to the scope
|
|
|
|
// in which the prototype of the native function is defined. This function may
|
|
|
|
// only be called on the render process main thread.
|
|
|
|
//
|
|
|
|
// Example JavaScript extension code: <pre>
|
|
|
|
// // create the 'example' global object if it doesn't already exist.
|
|
|
|
// if (!example)
|
|
|
|
// example = {};
|
|
|
|
// // create the 'example.test' global object if it doesn't already exist.
|
|
|
|
// if (!example.test)
|
|
|
|
// example.test = {};
|
|
|
|
// (function() {
|
|
|
|
// // Define the function 'example.test.myfunction'.
|
|
|
|
// example.test.myfunction = function() {
|
|
|
|
// // Call CefV8Handler::Execute() with the function name 'MyFunction'
|
|
|
|
// // and no arguments.
|
|
|
|
// native function MyFunction();
|
|
|
|
// return MyFunction();
|
|
|
|
// };
|
|
|
|
// // Define the getter function for parameter 'example.test.myparam'.
|
|
|
|
// example.test.__defineGetter__('myparam', function() {
|
|
|
|
// // Call CefV8Handler::Execute() with the function name 'GetMyParam'
|
|
|
|
// // and no arguments.
|
|
|
|
// native function GetMyParam();
|
|
|
|
// return GetMyParam();
|
|
|
|
// });
|
|
|
|
// // Define the setter function for parameter 'example.test.myparam'.
|
|
|
|
// example.test.__defineSetter__('myparam', function(b) {
|
|
|
|
// // Call CefV8Handler::Execute() with the function name 'SetMyParam'
|
|
|
|
// // and a single argument.
|
|
|
|
// native function SetMyParam();
|
|
|
|
// if(b) SetMyParam(b);
|
|
|
|
// });
|
|
|
|
//
|
|
|
|
// // Extension definitions can also contain normal JavaScript variables
|
|
|
|
// // and functions.
|
|
|
|
// var myint = 0;
|
|
|
|
// example.test.increment = function() {
|
|
|
|
// myint += 1;
|
|
|
|
// return myint;
|
|
|
|
// };
|
|
|
|
// })();
|
|
|
|
// </pre> Example usage in the page: <pre>
|
|
|
|
// // Call the function.
|
|
|
|
// example.test.myfunction();
|
|
|
|
// // Set the parameter.
|
|
|
|
// example.test.myparam = value;
|
|
|
|
// // Get the parameter.
|
|
|
|
// value = example.test.myparam;
|
|
|
|
// // Call another function.
|
|
|
|
// example.test.increment();
|
|
|
|
// </pre>
|
|
|
|
///
|
|
|
|
CEF_EXPORT int cef_register_extension(const cef_string_t* extension_name,
|
2017-05-17 11:29:28 +02:00
|
|
|
const cef_string_t* javascript_code,
|
|
|
|
cef_v8handler_t* handler);
|
2014-01-06 20:59:48 +01:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif // CEF_INCLUDE_CAPI_CEF_V8_CAPI_H_
|