Backed out changeset da7ad37975f1 (bug 1377016) on suspicion of frequently asserting at dom/script/ScriptLoader.cpp:649 during wpt instantiation-error-2.html. r=backout

This commit is contained in:
Sebastian Hengst 2017-07-22 11:08:53 +02:00
parent cc27374338
commit a5b5831097

View File

@ -569,13 +569,10 @@ JSCompartment::getOrCreateNonSyntacticLexicalEnvironment(JSContext* cx, HandleOb
return nullptr; return nullptr;
} }
// If a wrapped WithEnvironmentObject was passed in, unwrap it, as we may // The key is the unwrapped dynamic scope, as we may be creating different
// be creating different WithEnvironmentObject wrappers each time. // WithEnvironmentObject wrappers each time.
RootedObject key(cx, enclosing); MOZ_ASSERT(!enclosing->as<WithEnvironmentObject>().isSyntactic());
if (enclosing->is<WithEnvironmentObject>()) { RootedObject key(cx, &enclosing->as<WithEnvironmentObject>().object());
MOZ_ASSERT(!enclosing->as<WithEnvironmentObject>().isSyntactic());
key = &enclosing->as<WithEnvironmentObject>().object();
}
RootedObject lexicalEnv(cx, nonSyntacticLexicalEnvironments_->lookup(key)); RootedObject lexicalEnv(cx, nonSyntacticLexicalEnvironments_->lookup(key));
if (!lexicalEnv) { if (!lexicalEnv) {
@ -594,13 +591,9 @@ JSCompartment::getNonSyntacticLexicalEnvironment(JSObject* enclosing) const
{ {
if (!nonSyntacticLexicalEnvironments_) if (!nonSyntacticLexicalEnvironments_)
return nullptr; return nullptr;
// If a wrapped WithEnvironmentObject was passed in, unwrap it as in if (!enclosing->is<WithEnvironmentObject>())
// getOrCreateNonSyntacticLexicalEnvironment. return nullptr;
JSObject* key = enclosing; JSObject* key = &enclosing->as<WithEnvironmentObject>().object();
if (enclosing->is<WithEnvironmentObject>()) {
MOZ_ASSERT(!enclosing->as<WithEnvironmentObject>().isSyntactic());
key = &enclosing->as<WithEnvironmentObject>().object();
}
JSObject* lexicalEnv = nonSyntacticLexicalEnvironments_->lookup(key); JSObject* lexicalEnv = nonSyntacticLexicalEnvironments_->lookup(key);
if (!lexicalEnv) if (!lexicalEnv)
return nullptr; return nullptr;