public TestContext(JSRuntime runtime = null) { Assert.IsTrue(JSAPI.IsInitialized); if (runtime == null) { Runtime = new JSRuntime(); OwnsRuntime = true; } else { Runtime = runtime; OwnsRuntime = false; } Context = new JSContext(Runtime); Request = Context.Request(); Global = new JSGlobalObject(Context); CompartmentEntry = Context.EnterCompartment(Global); if (!JSAPI.InitStandardClasses(Context, Global)) { throw new Exception("Failed to initialize standard classes"); } }
public void Enter() { Request = Context.Request(); CompartmentEntry = Context.EnterCompartment(Global); }