mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-08 12:37:37 +00:00
Bug 880330 - Refactor the jsapi-tests to use the new options API; r=bholley
This commit is contained in:
parent
f662b56dc7
commit
c25117dc6e
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;";
|
||||
|
||||
|
@ -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); }");
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user