Пример #1
0
        public static JSHandleObject FromValue(Rooted <JS.Value> rval)
        {
            // Assert that we can actually convert the value into an object pointer.
            var ptr = rval.Value.AsObject;
            // Now get a handle to the value
            JSHandleValue v = rval;

            // HACK: Now take the value handle and turn it into an object handle.
            // This is valid because JS.Value type tagging is at the end of the 8 bytes.
            return(new JSHandleObject(v.AddressOfTarget));
        }
Пример #2
0
        public Rooted <JS.Value> Get()
        {
            var root = new Rooted <JS.Value>(Context, JS.Value.Undefined);

            if (JSAPI.GetPendingException(Context, root))
            {
                return(root);
            }

            root.Dispose();
            return(null);
        }
Пример #3
0
        public Rooted <JS.Value> GetProperty(JSContextPtr context, string name)
        {
            var result = new Rooted <JS.Value>(context);

            if (JSAPI.GetProperty(context, TransientSelf(), name, result))
            {
                return(result);
            }

            result.Dispose();
            return(null);
        }
Пример #4
0
        public Exception GetManaged()
        {
            var root = new Rooted <JS.Value>(Context, JS.Value.Undefined);

            if (!JSAPI.GetPendingException(Context, root))
            {
                return(null);
            }

            var error = new Spidermonkey.Managed.JSError(Context, root.Value.AsObject);

            return(error.ToException());
        }