public JSValue EvaluateScript(JSString script, JSObject thisObject, JSString sourceUrl, int startingLineNumber) { var exception = IntPtr.Zero; var result = JSEvaluateScript (Raw, script, thisObject == null ? IntPtr.Zero : thisObject.Raw, sourceUrl, startingLineNumber, ref exception); JSException.Proxy (this, exception); return new JSValue (this, result); }
internal static string ToStringAndRelease (JSString str) { if (str.Equals (JSString.Zero) || str.raw.Equals (IntPtr.Zero)) { return null; } try { return str.Value; } finally { str.Release (); } }
public void SetProperty(string propertyName, JSValue value, JSPropertyAttribute attributes) { var exception = IntPtr.Zero; var property = JSString.New(propertyName); try { JSObjectSetProperty(Context.Raw, Raw, property, value.Raw, attributes, ref exception); JSException.Proxy(Context, exception); } finally { property.Release(); } }
public JSValue EvaluateScript(string script, JSObject thisObject, string sourceUrl, int startingLineNumber) { var js_script = JSString.New(script); var js_source_url = JSString.New(sourceUrl); try { return(EvaluateScript(js_script, thisObject, js_source_url, startingLineNumber)); } finally { js_script.Release(); js_source_url.Release(); } }
private bool JSSetProperty(IntPtr ctx, IntPtr obj, JSString propertyName, IntPtr value, ref IntPtr exception) { var context = new JSContext(ctx); try { return(OnJSSetProperty(new JSObject(context, obj), propertyName.Value, new JSValue(context, value))); } catch (JSErrorException e) { exception = e.Error.Raw; return(false); } }
internal static string ToStringAndRelease(JSString str) { if (str.Equals(JSString.Zero) || str.raw.Equals(IntPtr.Zero)) { return(null); } try { return(str.Value); } finally { str.Release(); } }
public bool DeleteProperty(string propertyName) { var exception = IntPtr.Zero; var property = JSString.New(propertyName); try { var result = JSObjectDeleteProperty(Context.Raw, Raw, property, ref exception); JSException.Proxy(Context, exception); return(result); } finally { property.Release(); } }
public JSValue GetProperty(string propertyName) { var exception = IntPtr.Zero; var property = JSString.New(propertyName); try { var result = JSObjectGetProperty(Context.Raw, Raw, property, ref exception); JSException.Proxy(Context, exception); return(new JSValue(Context, result)); } finally { property.Release(); } }
private static extern bool JSObjectHasProperty(IntPtr ctx, IntPtr obj, JSString propertyName);
private static extern bool JSObjectDeleteProperty(IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception);
private static extern bool JSObjectDeleteProperty (IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception);
private static extern IntPtr JSStringGetCharactersPtr(JSString str);
public bool IsEqual(JSString str) { return(JSStringIsEqual(this, str)); }
private static extern void JSStringRelease(JSString str);
private bool JSSetProperty (IntPtr ctx, IntPtr obj, JSString propertyName, IntPtr value, ref IntPtr exception) { var context = new JSContext (ctx); try { return OnJSSetProperty (new JSObject (context, obj), propertyName.Value, new JSValue (context, value)); } catch (JSErrorException e) { exception = e.Error.Raw; return false; } }
private bool JSDeleteProperty(IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception) { return(OnJSDeleteProperty(new JSObject(ctx, obj), propertyName.Value)); }
private static extern IntPtr JSObjectGetProperty (IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception);
private bool JSHasProperty(IntPtr ctx, IntPtr obj, JSString propertyName) { return(OnJSHasProperty(new JSObject(ctx, obj), propertyName.Value)); }
private static extern void JSPropertyNameAccumulatorAddName ( JSPropertyNameAccumulator accumulator, JSString propertyName);
public void AddName(string propertyName) { JSPropertyNameAccumulatorAddName(this, JSString.New(propertyName)); }
private static extern void JSPropertyNameAccumulatorAddName( JSPropertyNameAccumulator accumulator, JSString propertyName);
private static extern bool JSObjectHasProperty (IntPtr ctx, IntPtr obj, JSString propertyName);
public static JSValue FromJson (JSContext ctx, JSString json) { var obj = JSValueMakeFromJSONString (ctx.Raw, json); if (obj.Equals (IntPtr.Zero)) { throw new JSException (ctx, "Invalid JSON"); } return new JSValue (ctx, obj); }
public JSValue (JSContext ctx, JSString value) : this (ctx, JSValueMakeString (ctx.Raw, value)) { }
private bool JSHasProperty (IntPtr ctx, IntPtr obj, JSString propertyName) { return OnJSHasProperty (new JSObject (ctx, obj), propertyName.Value); }
private static extern void JSStringRelease (JSString str);
private IntPtr JSGetProperty (IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception) { var context = new JSContext (ctx); return (OnJSGetProperty (new JSObject (context, obj), propertyName.Value) ?? JSValue.NewNull (context)).Raw; }
private static extern bool JSStringIsEqual(JSString a, JSString b);
private static extern JSString JSStringRetain(JSString str);
private static extern IntPtr JSStringGetLength(JSString str);
private static extern IntPtr JSObjectMakeFunctionWithCallback(IntPtr ctx, JSString name, CallAsFunctionCallback callAsFunction);
private bool JSSetProperty (IntPtr ctx, IntPtr obj, JSString propertyName, IntPtr value, ref IntPtr exception) { var context = new JSContext (ctx); return OnJSSetProperty (new JSObject (context, obj), propertyName.Value, new JSValue (context, value)); }
private static extern void JSObjectSetProperty (IntPtr ctx, IntPtr obj, JSString propertyName, IntPtr value, JSPropertyAttribute attributes, ref IntPtr exception);
private static extern IntPtr JSEvaluateScript(IntPtr ctx, JSString script, IntPtr thisObject, JSString sourceURL, int startingLineNumber, ref IntPtr exception);
private bool JSDeleteProperty (IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception) { return OnJSDeleteProperty (new JSObject (ctx, obj), propertyName.Value); }
private static extern IntPtr JSObjectGetProperty(IntPtr ctx, IntPtr obj, JSString propertyName, ref IntPtr exception);
private static extern bool JSStringIsEqual (JSString a, JSString b);
private static extern void JSObjectSetProperty(IntPtr ctx, IntPtr obj, JSString propertyName, IntPtr value, JSPropertyAttribute attributes, ref IntPtr exception);
public bool IsEqual (JSString str) { return JSStringIsEqual (this, str); }
private static extern IntPtr JSStringGetLength (JSString str);
private static extern IntPtr JSStringGetCharactersPtr (JSString str);
private static extern IntPtr JSValueMakeFromJSONString (IntPtr ctx, JSString str);
private static extern IntPtr JSValueMakeString (IntPtr ctx, JSString value);
private static extern IntPtr JSValueMakeFromJSONString(IntPtr ctx, JSString str);
private static extern IntPtr JSObjectMakeFunctionWithCallback (IntPtr ctx, JSString name, CallAsFunctionCallback callAsFunction);
private static extern IntPtr JSValueMakeString(IntPtr ctx, JSString value);
private static extern JSString JSStringRetain (JSString str);
public JSValue(JSContext ctx, string value) : this(ctx, JSValueMakeString(ctx.Raw, JSString.New(value))) { }