/// <summary> /// Evaluates the specified JavaScript code using this context's global object. /// On success |retval| will be set to the return value, if any, and the /// function will return true (1). On failure |exception| will be set to the /// exception, if any, and the function will return false (0). /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>. /// </remarks> public bool Eval(string code, out CfrV8Value retval, out CfrV8Exception exception) { var call = new CfxV8ContextEvalRenderProcessCall(); call.self = CfrObject.Unwrap(this); call.code = code; call.RequestExecution(this); retval = CfrV8Value.Wrap(call.retval); exception = CfrV8Exception.Wrap(call.exception); return(call.__retval); }
/// <summary> /// Execute a string of JavaScript code in this V8 context. The |scriptUrl| /// parameter is the URL where the script in question can be found, if any. The /// |startLine| 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 (1). On failure |exception| will be set to the /// exception, if any, and the function will return false (0). /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>. /// </remarks> public bool Eval(string code, string scriptUrl, int startLine, out CfrV8Value retval, out CfrV8Exception exception) { var call = new CfxV8ContextEvalRemoteCall(); call.@this = RemotePtr.ptr; call.code = code; call.scriptUrl = scriptUrl; call.startLine = startLine; call.RequestExecution(RemotePtr.connection); retval = CfrV8Value.Wrap(new RemotePtr(connection, call.retval)); exception = CfrV8Exception.Wrap(new RemotePtr(connection, call.exception)); return(call.__retval); }
internal static CfrV8Exception Wrap(IntPtr proxyId) { if (proxyId == IntPtr.Zero) { return(null); } var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache; lock (weakCache) { var cfrObj = (CfrV8Exception)weakCache.Get(proxyId); if (cfrObj == null) { cfrObj = new CfrV8Exception(proxyId); weakCache.Add(proxyId, cfrObj); } return(cfrObj); } }
internal static CfrV8Exception Wrap(RemotePtr remotePtr) { if (remotePtr == RemotePtr.Zero) { return(null); } var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache; lock (weakCache) { var cfrObj = (CfrV8Exception)weakCache.Get(remotePtr.ptr); if (cfrObj == null) { cfrObj = new CfrV8Exception(remotePtr); weakCache.Add(remotePtr.ptr, cfrObj); } return(cfrObj); } }
internal static CfrV8Exception Wrap(IntPtr proxyId) { if(proxyId == IntPtr.Zero) return null; var weakCache = CfxRemoteCallContext.CurrentContext.connection.weakCache; lock(weakCache) { var cfrObj = (CfrV8Exception)weakCache.Get(proxyId); if(cfrObj == null) { cfrObj = new CfrV8Exception(proxyId); weakCache.Add(proxyId, cfrObj); } return cfrObj; } }
/// <summary> /// Evaluates the specified JavaScript code using this context's global object. /// On success |retval| will be set to the return value, if any, and the /// function will return true (1). On failure |exception| will be set to the /// exception, if any, and the function will return false (0). /// </summary> /// <remarks> /// See also the original CEF documentation in /// <see href="https://bitbucket.org/chromiumfx/chromiumfx/src/tip/cef/include/capi/cef_v8_capi.h">cef/include/capi/cef_v8_capi.h</see>. /// </remarks> public bool Eval(string code, out CfrV8Value retval, out CfrV8Exception exception) { var call = new CfxV8ContextEvalRenderProcessCall(); call.self = CfrObject.Unwrap(this); call.code = code; call.RequestExecution(this); retval = CfrV8Value.Wrap(call.retval); exception = CfrV8Exception.Wrap(call.exception); return call.__retval; }