/// <summary> /// Constructs an instance of the Chakra “IE” JsRT JavaScript engine /// </summary> /// <param name="enableDebugging">Flag for whether to enable script debugging features</param> public ChakraIeJsRtJsEngine(bool enableDebugging) : base(JsEngineMode.ChakraIeJsRt, enableDebugging) { _dispatcher.Invoke(() => { try { _jsRuntime = CreateJsRuntime(); _jsContext = _jsRuntime.CreateContext(); } catch (JsUsageException e) { string errorMessage; if (e.ErrorCode == JsErrorCode.WrongThread) { errorMessage = CommonStrings.Runtime_JsEnginesConflictOnMachine; } else { errorMessage = string.Format(CommonStrings.Runtime_IeJsEngineNotLoaded, _engineModeName, LOWER_IE_VERSION, e.Message); } throw new JsEngineLoadException(errorMessage, _engineModeName); } catch (Exception e) { throw new JsEngineLoadException( string.Format(CommonStrings.Runtime_IeJsEngineNotLoaded, _engineModeName, LOWER_IE_VERSION, e.Message), _engineModeName); } }); }
public override object Evaluate(string expression) { object result = InvokeScript(() => { IeJsValue resultValue = IeJsContext.RunScript(expression); return(MapToHostType(resultValue)); }); return(result); }
public override object Evaluate(string expression, string documentName) { object result = InvokeScript(() => { IeJsValue resultValue = IeJsContext.RunScript(expression, _jsSourceContext++, documentName); return(MapToHostType(resultValue)); }); return(result); }
protected override void InnerStartDebugging() { if (Utils.Is64BitProcess()) { var processDebugManager64 = (IProcessDebugManager64) new ProcessDebugManager(); IDebugApplication64 debugApplication64; processDebugManager64.GetDefaultApplication(out debugApplication64); IeJsContext.StartDebugging(debugApplication64); } else { var processDebugManager32 = (IProcessDebugManager32) new ProcessDebugManager(); IDebugApplication32 debugApplication32; processDebugManager32.GetDefaultApplication(out debugApplication32); IeJsContext.StartDebugging(debugApplication32); } }
public override void Execute(string code, string documentName) { InvokeScript(() => IeJsContext.RunScript(code, _jsSourceContext++, documentName)); }
public override void Execute(string code) { InvokeScript(() => IeJsContext.RunScript(code)); }
internal static extern JsErrorCode JsCreateContext(IeJsRuntime runtime, IDebugApplication32 debugSite, out IeJsContext newContext);
internal static extern JsErrorCode JsContextRelease(IeJsContext reference, out uint count);
internal static extern JsErrorCode JsContextAddRef(IeJsContext reference, out uint count);
internal static extern JsErrorCode JsSetCurrentContext(IeJsContext context);
internal static extern JsErrorCode JsSetCurrentContext(IeJsContext context);
/// <summary> /// Initializes a new instance of the <see cref="IeJsScope"/> struct /// </summary> /// <param name="context">The context to create the scope for</param> public IeJsScope(IeJsContext context) { _disposedFlag = new StatedFlag(); _previousContext = IeJsContext.Current; IeJsContext.Current = context; }
internal static extern JsErrorCode JsGetCurrentContext(out IeJsContext currentContext);
internal static extern JsErrorCode JsCreateContext(IeJsRuntime runtime, IDebugApplication32 debugSite, out IeJsContext newContext);
internal static extern JsErrorCode JsContextRelease(IeJsContext reference, out uint count);
internal static extern JsErrorCode JsContextAddRef(IeJsContext reference, out uint count);
internal static extern JsErrorCode JsGetRuntime(IeJsContext context, out IeJsRuntime runtime);
internal static extern JsErrorCode JsGetCurrentContext(out IeJsContext currentContext);
internal static extern JsErrorCode JsGetRuntime(IeJsContext context, out IeJsRuntime runtime);
/// <summary> /// Initializes a new instance of the <see cref="IeJsScope"/> struct /// </summary> /// <param name="context">The context to create the scope for</param> public IeJsScope(IeJsContext context) { _disposed = false; _previousContext = IeJsContext.Current; IeJsContext.Current = context; }
/// <summary> /// Initializes a new instance of the <see cref="IeJsScope"/> struct /// </summary> /// <param name="context">The context to create the scope for</param> public IeJsScope(IeJsContext context) { _disposedFlag = new StatedFlag(); _previousContext = IeJsContext.Current; IeJsContext.Current = context; }