1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 * vim: set ts=8 sw=4 et tw=99:
7 BEGIN_TEST(testContexts_IsRunning)
9 CHECK(JS_DefineFunction(cx, global, "chk", chk, 0, 0));
10 EXEC("for (var i = 0; i < 9; i++) chk();");
14 static JSBool chk(JSContext *cx, uintN argc, jsval *vp)
16 JSRuntime *rt = JS_GetRuntime(cx);
17 JSContext *acx = JS_NewContext(rt, 8192);
19 JS_ReportOutOfMemory(cx);
23 // acx should not be running
24 bool ok = !JS_IsRunning(acx);
26 JS_ReportError(cx, "Assertion failed: brand new context claims to be running");
27 JS_DestroyContext(acx);
30 END_TEST(testContexts_IsRunning)
32 BEGIN_TEST(testContexts_bug563735)
34 JSContext *cx2 = JS_NewContext(rt, 8192);
39 JSAutoRequest req(cx2);
40 JSAutoEnterCompartment ac;
41 CHECK(ac.enter(cx2, global));
43 ok = JS_SetProperty(cx2, global, "x", &v);
47 EXEC("(function () { for (var i = 0; i < 9; i++) ; })();");
49 JS_DestroyContext(cx2);
52 END_TEST(testContexts_bug563735)