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