Exemple #1
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 = CefV8PropertyAttribute.None)
        {
            ThrowIfObjectIsInvalid();
            fixed(char *key_str = key)
            {
                var n_key = new cef_string_t(key_str, key != null ? key.Length : 0);

                return(cef_v8value_t.invoke_set_value_bykey(this.ptr, &n_key, value.GetNativePointerAndAddRef(), (cef_v8_propertyattribute_t)attribute) != 0);
            }
        }
Exemple #2
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)
        {
            ThrowIfObjectIsInvalid();
            var n_arguments = CreateArgumentsArray(arguments);

            fixed(cef_v8value_t **n_arguments_ptr = n_arguments)
            {
                return(CefV8Value.FromOrDefault(
                           cef_v8value_t.invoke_execute_function(
                               this.ptr,
                               obj.GetNativePointerAndAddRef(),
                               n_arguments != null ? n_arguments.Length : 0,
                               n_arguments_ptr
                               )
                           ));
            }
        }
 /// <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)
 {
     ThrowIfObjectIsInvalid();
     return cef_v8value_t.invoke_set_value_byindex(this.ptr, index, value.GetNativePointerAndAddRef()) != 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 = CefV8PropertyAttribute.None)
        {
            ThrowIfObjectIsInvalid();
            fixed (char* key_str = key)
            {
                var n_key = new cef_string_t(key_str, key != null ? key.Length : 0);

                return cef_v8value_t.invoke_set_value_bykey(this.ptr, &n_key, value.GetNativePointerAndAddRef(), (cef_v8_propertyattribute_t)attribute) != 0;
            }
        }
 /// <summary>
 /// Returns true if this object is pointing to the same handle as |that| object.
 /// </summary>
 public bool IsSame(CefV8Value that)
 {
     ThrowIfObjectIsInvalid();
     return cef_v8value_t.invoke_is_same(this.ptr, that.GetNativePointerAndAddRef()) != 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)
        {
            ThrowIfObjectIsInvalid();
            var n_arguments = CreateArgumentsArray(arguments);

            fixed (cef_v8value_t** n_arguments_ptr = n_arguments)
            {
                return CefV8Value.FromOrDefault(
                    cef_v8value_t.invoke_execute_function_with_context(
                        this.ptr,
                        context.GetNativePointerAndAddRef(),
                        obj.GetNativePointerAndAddRef(),
                        n_arguments != null ? n_arguments.Length : 0,
                        n_arguments_ptr
                    )
                );
            }
        }
Exemple #7
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)
 {
     ThrowIfObjectIsInvalid();
     return(cef_v8value_t.invoke_set_value_byindex(this.ptr, index, value.GetNativePointerAndAddRef()) != 0);
 }
Exemple #8
0
 /// <summary>
 /// Returns true if this object is pointing to the same handle as |that| object.
 /// </summary>
 public bool IsSame(CefV8Value that)
 {
     ThrowIfObjectIsInvalid();
     return(cef_v8value_t.invoke_is_same(this.ptr, that.GetNativePointerAndAddRef()) != 0);
 }