-// Copyright (c) 2014 Marshall A. Greenblatt. All rights reserved.
+// Copyright (c) 2017 Marshall A. Greenblatt. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Returns the task runner associated with this context. V8 handles can only
struct _cef_v8context_t* that);
///
- // Evaluates the specified JavaScript code using this context's global object.
+ // 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.
// 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).
///
int (CEF_CALLBACK *eval)(struct _cef_v8context_t* self,
- const cef_string_t* code, struct _cef_v8value_t** retval,
- struct _cef_v8exception_t** exception);
+ const cef_string_t* code, const cef_string_t* script_url, int start_line,
+ struct _cef_v8value_t** retval, struct _cef_v8exception_t** exception);
} cef_v8context_t;
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Handle execution of the function identified by |name|. |object| is the
///
// Structure that should be implemented to handle V8 accessor calls. Accessor
-// identifiers are registered by calling cef_v8value_t::set_value_byaccessor().
-// The functions of this structure will be called on the thread associated with
-// the V8 accessor.
+// 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.
///
typedef struct _cef_v8accessor_t {
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Handle retrieval the accessor value identified by |name|. |object| is the
} cef_v8accessor_t;
+///
+// 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.
+ ///
+ cef_base_ref_counted_t base;
+
+ ///
+ // 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.
+ ///
+ 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);
+
+ ///
+ // 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.
+ ///
+ 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);
+
+ ///
+ // 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.
+ ///
+ 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);
+
+ ///
+ // 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.
+ ///
+ 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);
+} cef_v8interceptor_t;
+
+
///
// Structure representing a V8 exception. The functions of this structure may be
// called on any render process thread.
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Returns the exception message.
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Returns true (1) if the underlying handle is valid and it can be accessed
struct _cef_v8value_t* that);
///
- // Return a bool value. The underlying data will be converted to if
- // necessary.
+ // Return a bool value.
///
int (CEF_CALLBACK *get_bool_value)(struct _cef_v8value_t* self);
///
- // Return an int value. The underlying data will be converted to if
- // necessary.
+ // Return an int value.
///
int32 (CEF_CALLBACK *get_int_value)(struct _cef_v8value_t* self);
///
- // Return an unisgned int value. The underlying data will be converted to if
- // necessary.
+ // Return an unsigned int value.
///
uint32 (CEF_CALLBACK *get_uint_value)(struct _cef_v8value_t* self);
///
- // Return a double value. The underlying data will be converted to if
- // necessary.
+ // Return a double value.
///
double (CEF_CALLBACK *get_double_value)(struct _cef_v8value_t* self);
///
- // Return a Date value. The underlying data will be converted to if
- // necessary.
+ // Return a Date value.
///
cef_time_t (CEF_CALLBACK *get_date_value)(struct _cef_v8value_t* self);
///
- // Return a string value. The underlying data will be converted to if
- // necessary.
+ // Return a string value.
///
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t (CEF_CALLBACK *get_string_value)(
// called on user created objects.
///
int (CEF_CALLBACK *set_user_data)(struct _cef_v8value_t* self,
- struct _cef_base_t* user_data);
+ struct _cef_base_ref_counted_t* user_data);
///
// Returns the user data, if any, assigned to this object.
///
- struct _cef_base_t* (CEF_CALLBACK *get_user_data)(
+ struct _cef_base_ref_counted_t* (CEF_CALLBACK *get_user_data)(
struct _cef_v8value_t* self);
///
///
// Create a new cef_v8value_t object of type Date. This function should only be
-// called from within the scope of a cef_v8context_tHandler, cef_v8handler_t or
-// cef_v8accessor_t callback, or in combination with calling enter() and exit()
-// on a stored cef_v8context_t reference.
+// 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_date(const cef_time_t* date);
CEF_EXPORT cef_v8value_t* cef_v8value_create_string(const cef_string_t* value);
///
-// Create a new cef_v8value_t object of type object with optional accessor. This
-// function should only be called from within the scope of a
-// cef_v8context_tHandler, cef_v8handler_t or cef_v8accessor_t callback, or in
-// combination with calling enter() and exit() on a stored cef_v8context_t
-// reference.
+// 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.
///
-CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_v8accessor_t* accessor);
+CEF_EXPORT cef_v8value_t* cef_v8value_create_object(cef_v8accessor_t* accessor,
+ cef_v8interceptor_t* interceptor);
///
// 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
-// should only be called from within the scope of a cef_v8context_tHandler,
-// cef_v8handler_t or cef_v8accessor_t callback, or in combination with calling
-// enter() and exit() on a stored cef_v8context_t reference.
+// 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(int length);
///
// Create a new cef_v8value_t object of type function. This function should only
-// be called from within the scope of a cef_v8context_tHandler, cef_v8handler_t
-// or cef_v8accessor_t callback, or in combination with calling enter() and
-// exit() on a stored cef_v8context_t reference.
+// 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_function(const cef_string_t* name,
cef_v8handler_t* handler);
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Returns true (1) if the underlying handle is valid and it can be accessed
///
// Base structure.
///
- cef_base_t base;
+ cef_base_ref_counted_t base;
///
// Returns true (1) if the underlying handle is valid and it can be accessed