/// <summary>
        /// Associates a value with the specified identifier and returns true on
        /// success. Returns false if this method is called incorrectly or an exception
        /// is thrown. For read-only values this method will return true even though
        /// assignment failed.
        /// </summary>
        public bool SetValue(string key, CefV8Value value, CefV8PropertyAttribute attribute = CefV8PropertyAttribute.None)
        {
            fixed(char *key_str = key)
            {
                var n_key = new cef_string_t(key_str, key != null ? key.Length : 0);

                return(cef_v8value_t.set_value_bykey(_self, &n_key, value.ToNative(), attribute) != 0);
            }
        }
        /// <summary>
        /// Returns true if this object is pointing to the same handle as |that|
        /// object.
        /// </summary>
        public bool IsSame(CefV8Value that)
        {
            if (that == null)
            {
                return(false);
            }

            return(cef_v8value_t.is_same(_self, that.ToNative()) != 0);
        }
        /// <summary>
        /// Execute the function using the current V8 context. This method should only
        /// be called from within the scope of a CefV8Handler or CefV8Accessor
        /// callback, or in combination with calling Enter() and Exit() on a stored
        /// CefV8Context reference. |object| is the receiver ('this' object) of the
        /// function. If |object| is empty 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 method is called incorrectly or an exception is thrown.
        /// </summary>
        public CefV8Value ExecuteFunction(CefV8Value obj, CefV8Value[] arguments)
        {
            var            n_arguments = CreateArguments(arguments);
            cef_v8value_t *n_retval;

            fixed(cef_v8value_t **n_arguments_ptr = n_arguments)
            {
                n_retval = cef_v8value_t.execute_function(
                    _self,
                    obj != null ? obj.ToNative() : null,
                    n_arguments != null ? (UIntPtr)n_arguments.Length : UIntPtr.Zero,
                    n_arguments_ptr
                    );
            }

            return(CefV8Value.FromNativeOrNull(n_retval));
        }
 /// <summary>
 /// Associates a value with the specified identifier and returns true on
 /// success. Returns false if this method is called incorrectly or an exception
 /// is thrown. For read-only values this method will return true even though
 /// assignment failed.
 /// </summary>
 public bool SetValue(int index, CefV8Value value)
 {
     return(cef_v8value_t.set_value_byindex(_self, index, value.ToNative()) != 0);
 }
示例#5
0
 /// <summary>
 /// Associates a value with the specified identifier and returns true on
 /// success. Returns false if this method is called incorrectly or an exception
 /// is thrown. For read-only values this method will return true even though
 /// assignment failed.
 /// </summary>
 public bool SetValue(int index, CefV8Value value)
 {
     return cef_v8value_t.set_value_byindex(_self, index, value.ToNative()) != 0;
 }
示例#6
0
 /// <summary>
 /// Associates a value with the specified identifier and returns true on
 /// success. Returns false if this method is called incorrectly or an exception
 /// is thrown. For read-only values this method will return true even though
 /// assignment failed.
 /// </summary>
 public bool SetValue(string key, CefV8Value value, CefV8PropertyAttribute attribute)
 {
     fixed (char* key_str = key)
     {
         var n_key = new cef_string_t(key_str, key != null ? key.Length : 0);
         return cef_v8value_t.set_value_bykey(_self, &n_key, value.ToNative(), attribute) != 0;
     }
 }
示例#7
0
        /// <summary>
        /// Returns true if this object is pointing to the same handle as |that|
        /// object.
        /// </summary>
        public bool IsSame(CefV8Value that)
        {
            if (that == null) return false;

            return cef_v8value_t.is_same(_self, that.ToNative()) != 0;
        }
示例#8
0
        /// <summary>
        /// Execute the function using the specified V8 context. |object| is the
        /// receiver ('this' object) of the function. If |object| is empty 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 method is called incorrectly or an
        /// exception is thrown.
        /// </summary>
        public CefV8Value ExecuteFunctionWithContext(CefV8Context context, CefV8Value obj, CefV8Value[] arguments)
        {
            var n_arguments = CreateArguments(arguments);
            cef_v8value_t* n_retval;

            fixed (cef_v8value_t** n_arguments_ptr = n_arguments)
            {
                n_retval = cef_v8value_t.execute_function_with_context(
                    _self,
                    context.ToNative(),
                    obj != null ? obj.ToNative() : null,
                    n_arguments != null ? (UIntPtr)n_arguments.Length : UIntPtr.Zero,
                    n_arguments_ptr
                    );
            }

            return CefV8Value.FromNativeOrNull(n_retval);
        }