Ejemplo n.º 1
0
        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");
            }
        }
Ejemplo n.º 2
0
 public void Enter()
 {
     Request          = Context.Request();
     CompartmentEntry = Context.EnterCompartment(Global);
 }