зеркало из https://github.com/mozilla/gecko-dev.git
Bug 940317 - Move the varObjFix flag from ContextOptions to RuntimeOptions. r=bholley
This commit is contained in:
Родитель
aa5f852abc
Коммит
e6bf27b287
|
@ -9,7 +9,7 @@ BEGIN_TEST(testJSEvaluateScript)
|
|||
JS::RootedObject obj(cx, JS_NewObject(cx, nullptr, JS::NullPtr(), global));
|
||||
CHECK(obj);
|
||||
|
||||
CHECK(JS::ContextOptionsRef(cx).varObjFix());
|
||||
CHECK(JS::RuntimeOptionsRef(cx).varObjFix());
|
||||
|
||||
static const char src[] = "var x = 5;";
|
||||
|
||||
|
@ -25,7 +25,7 @@ BEGIN_TEST(testJSEvaluateScript)
|
|||
CHECK(hasProp);
|
||||
|
||||
// Now do the same thing, but without JSOPTION_VAROBJFIX
|
||||
JS::ContextOptionsRef(cx).setVarObjFix(false);
|
||||
JS::RuntimeOptionsRef(cx).setVarObjFix(false);
|
||||
|
||||
static const char src2[] = "var y = 5;";
|
||||
|
||||
|
|
|
@ -298,6 +298,7 @@ class JSAPITest
|
|||
if (!rt)
|
||||
return nullptr;
|
||||
setNativeStackQuota(rt);
|
||||
JS::RuntimeOptionsRef(rt).setVarObjFix(true);
|
||||
return rt;
|
||||
}
|
||||
|
||||
|
@ -318,7 +319,6 @@ class JSAPITest
|
|||
JSContext *cx = JS_NewContext(rt, 8192);
|
||||
if (!cx)
|
||||
return nullptr;
|
||||
JS::ContextOptionsRef(cx).setVarObjFix(true);
|
||||
JS_SetErrorReporter(cx, &reportError);
|
||||
return cx;
|
||||
}
|
||||
|
|
|
@ -1423,7 +1423,8 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
|||
asmJS_(false),
|
||||
nativeRegExp_(false),
|
||||
werror_(false),
|
||||
strictMode_(false)
|
||||
strictMode_(false),
|
||||
varObjFix_(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -1483,6 +1484,16 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool varObjFix() const { return varObjFix_; }
|
||||
RuntimeOptions &setVarObjFix(bool flag) {
|
||||
varObjFix_ = flag;
|
||||
return *this;
|
||||
}
|
||||
RuntimeOptions &toggleVarObjFix() {
|
||||
varObjFix_ = !varObjFix_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
bool baseline_ : 1;
|
||||
bool ion_ : 1;
|
||||
|
@ -1490,6 +1501,7 @@ class JS_PUBLIC_API(RuntimeOptions) {
|
|||
bool nativeRegExp_ : 1;
|
||||
bool werror_ : 1;
|
||||
bool strictMode_ : 1;
|
||||
bool varObjFix_ : 1;
|
||||
};
|
||||
|
||||
JS_PUBLIC_API(RuntimeOptions &)
|
||||
|
@ -1502,7 +1514,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
public:
|
||||
ContextOptions()
|
||||
: extraWarnings_(false),
|
||||
varObjFix_(false),
|
||||
privateIsNSISupports_(false),
|
||||
dontReportUncaught_(false),
|
||||
noDefaultCompartmentObject_(false),
|
||||
|
@ -1520,16 +1531,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
return *this;
|
||||
}
|
||||
|
||||
bool varObjFix() const { return varObjFix_; }
|
||||
ContextOptions &setVarObjFix(bool flag) {
|
||||
varObjFix_ = flag;
|
||||
return *this;
|
||||
}
|
||||
ContextOptions &toggleVarObjFix() {
|
||||
varObjFix_ = !varObjFix_;
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool privateIsNSISupports() const { return privateIsNSISupports_; }
|
||||
ContextOptions &setPrivateIsNSISupports(bool flag) {
|
||||
privateIsNSISupports_ = flag;
|
||||
|
@ -1572,7 +1573,6 @@ class JS_PUBLIC_API(ContextOptions) {
|
|||
|
||||
private:
|
||||
bool extraWarnings_ : 1;
|
||||
bool varObjFix_ : 1;
|
||||
bool privateIsNSISupports_ : 1;
|
||||
bool dontReportUncaught_ : 1;
|
||||
bool noDefaultCompartmentObject_ : 1;
|
||||
|
|
|
@ -638,7 +638,7 @@ js::Execute(JSContext *cx, HandleScript script, JSObject &scopeChainArg, Value *
|
|||
#endif
|
||||
|
||||
/* The VAROBJFIX option makes varObj == globalObj in global code. */
|
||||
if (!cx->options().varObjFix()) {
|
||||
if (!cx->runtime()->options().varObjFix()) {
|
||||
if (!scopeChain->setVarObj(cx))
|
||||
return false;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче