private int set(cef_v8accessor_t *self, cef_string_t *name, cef_v8value_t * @object, cef_v8value_t *value, cef_string_t *exception)
        {
            CheckSelf(self);

            var    m_name  = cef_string_t.ToString(name);
            var    m_obj   = CefV8Value.FromNative(@object);
            var    m_value = CefV8Value.FromNative(value);
            string mException;

            var handled = this.Set(m_name, m_obj, m_value, out mException);

            if (handled)
            {
                if (mException != null)
                {
                    cef_string_t.Copy(mException, exception);
                }
            }

            return(handled ? 1 : 0);
        }
Exemple #2
0
        /// <summary>
        /// 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. On failure |exception| will be set to the
        /// exception, if any, and the function will return false.
        /// </summary>
        public bool TryEval(string code, string scriptUrl, int startLine, out CefV8Value returnValue, out CefV8Exception exception)
        {
            bool               result;
            cef_v8value_t *    n_retval    = null;
            cef_v8exception_t *n_exception = null;

            fixed(char *code_str = code)
            fixed(char *scriptUrl_str = scriptUrl)
            {
                var n_code      = new cef_string_t(code_str, code != null ? code.Length : 0);
                var n_scriptUrl = new cef_string_t(scriptUrl_str, scriptUrl != null ? scriptUrl.Length : 0);

                result = cef_v8context_t.eval(_self, &n_code, &n_scriptUrl, startLine, &n_retval, &n_exception) != 0;
            }

            returnValue = n_retval != null?CefV8Value.FromNative(n_retval) : null;

            exception = n_exception != null?CefV8Exception.FromNative(n_exception) : null;

            return(result);
        }
        private int get_byindex(cef_v8interceptor_t *self, int index, cef_v8value_t * @object, cef_v8value_t **retval, cef_string_t *exception)
        {
            CheckSelf(self);

            var m_obj = CefV8Value.FromNative(@object);

            CefV8Value m_retval;
            string     m_exception;

            if (GetByIndex(index, m_obj, out m_retval, out m_exception))
            {
                *retval = m_retval != null?m_retval.ToNative() : null;

                cef_string_t.Copy(m_exception, exception);
                return(1);
            }
            else
            {
                return(0);
            }
        }
 /// <summary>
 /// Create a new CefV8Value object of type double.
 /// </summary>
 public static CefV8Value CreateDouble(double value)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_double(value)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type unsigned int.
 /// </summary>
 public static CefV8Value CreateUInt(uint value)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_uint(value)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type bool.
 /// </summary>
 public static CefV8Value CreateBool(bool value)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_bool(value ? 1 : 0)
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type null.
 /// </summary>
 public static CefV8Value CreateNull()
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_null()
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type undefined.
 /// </summary>
 public static CefV8Value CreateUndefined()
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_undefined()
                ));
 }
 /// <summary>
 /// Create a new CefV8Value object of type array with the specified |length|.
 /// If |length| is negative the returned array will have length 0. This method
 /// should only be called from within the scope of a CefRenderProcessHandler,
 /// CefV8Handler or CefV8Accessor callback, or in combination with calling
 /// Enter() and Exit() on a stored CefV8Context reference.
 /// </summary>
 public static CefV8Value CreateArray(int length)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_array(length)
                ));
 }
Exemple #10
0
 /// <summary>
 /// Create a new CefV8Value object of type object with optional accessor. This
 /// method should only be called from within the scope of a
 /// CefRenderProcessHandler, CefV8Handler or CefV8Accessor callback, or in
 /// combination with calling Enter() and Exit() on a stored CefV8Context
 /// reference.
 /// </summary>
 public static CefV8Value CreateObject(CefV8Accessor accessor = null)
 {
     return(CefV8Value.FromNative(
                cef_v8value_t.create_object(accessor != null ? accessor.ToNative() : null)
                ));
 }
Exemple #11
0
 /// <summary>
 /// Returns the global object for this context. The context must be entered
 /// before calling this method.
 /// </summary>
 public CefV8Value GetGlobal()
 {
     return(CefV8Value.FromNative(
                cef_v8context_t.get_global(_self)
                ));
 }