diff --git a/js/src/jsapi-tests/testFuncCallback.cpp b/js/src/jsapi-tests/testFuncCallback.cpp index bad8063f02d..c6dde2ec744 100644 --- a/js/src/jsapi-tests/testFuncCallback.cpp +++ b/js/src/jsapi-tests/testFuncCallback.cpp @@ -131,8 +131,10 @@ virtual JSContext *createContext() { JSContext *cx = JSAPITest::createContext(); - if (cx) - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION); + if (!cx) + return NULL; + ContextOptionsRef(cx).setBaseline(true) + .setIon(true); return cx; } diff --git a/js/src/jsapi-tests/testJSEvaluateScript.cpp b/js/src/jsapi-tests/testJSEvaluateScript.cpp index bfc6e5a47ff..69ee63bcfa8 100644 --- a/js/src/jsapi-tests/testJSEvaluateScript.cpp +++ b/js/src/jsapi-tests/testJSEvaluateScript.cpp @@ -9,8 +9,7 @@ BEGIN_TEST(testJSEvaluateScript) JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, nullptr, global)); CHECK(obj); - uint32_t options = JS_GetOptions(cx); - CHECK(options & JSOPTION_VAROBJFIX); + CHECK(ContextOptionsRef(cx).varObjFix()); static const char src[] = "var x = 5;"; @@ -27,7 +26,7 @@ BEGIN_TEST(testJSEvaluateScript) CHECK(hasProp); // Now do the same thing, but without JSOPTION_VAROBJFIX - JS_SetOptions(cx, options & ~JSOPTION_VAROBJFIX); + ContextOptionsRef(cx).setVarObjFix(false); static const char src2[] = "var y = 5;"; diff --git a/js/src/jsapi-tests/testProfileStrings.cpp b/js/src/jsapi-tests/testProfileStrings.cpp index 4ab46494768..772af439238 100644 --- a/js/src/jsapi-tests/testProfileStrings.cpp +++ b/js/src/jsapi-tests/testProfileStrings.cpp @@ -141,7 +141,8 @@ END_TEST(testProfileStrings_isCalledWithInterpreter) BEGIN_TEST(testProfileStrings_isCalledWithJIT) { CHECK(initialize(cx)); - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION); + ContextOptionsRef(cx).setBaseline(true) + .setIon(true); EXEC("function g() { var p = new Prof(); p.test_fn(); }"); EXEC("function f() { g(); }"); @@ -189,12 +190,13 @@ END_TEST(testProfileStrings_isCalledWithJIT) BEGIN_TEST(testProfileStrings_isCalledWhenError) { CHECK(initialize(cx)); - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION); + ContextOptionsRef(cx).setBaseline(true) + .setIon(true); EXEC("function check2() { throw 'a'; }"); reset(cx); - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_DONT_REPORT_UNCAUGHT); + ContextOptionsRef(cx).setDontReportUncaught(true); { JS::RootedValue rval(cx); /* Make sure the stack resets and we have an entry for each stack */ @@ -212,7 +214,8 @@ END_TEST(testProfileStrings_isCalledWhenError) BEGIN_TEST(testProfileStrings_worksWhenEnabledOnTheFly) { CHECK(initialize(cx)); - JS_SetOptions(cx, JS_GetOptions(cx) | JSOPTION_BASELINE | JSOPTION_ION); + ContextOptionsRef(cx).setBaseline(true) + .setIon(true); EXEC("function b(p) { p.test_fn(); }"); EXEC("function a() { var p = new Prof(); p.enable(); b(p); }"); diff --git a/js/src/jsapi-tests/tests.h b/js/src/jsapi-tests/tests.h index 94db8b5eaee..6f64ad046e3 100644 --- a/js/src/jsapi-tests/tests.h +++ b/js/src/jsapi-tests/tests.h @@ -300,7 +300,7 @@ class JSAPITest JSContext *cx = JS_NewContext(rt, 8192); if (!cx) return nullptr; - JS_SetOptions(cx, JSOPTION_VAROBJFIX); + ContextOptionsRef(cx).setVarObjFix(true); JS_SetErrorReporter(cx, &reportError); return cx; }