Bug 1398601 - Don't allow NSVO in js::CreateObjectsForEnvironmentChain r=jorendorff
☠☠ backed out by fe7465d53091 ☠ ☠
authorTed Campbell <tcampbell@mozilla.com>
Sat, 09 Sep 2017 20:37:18 -0400
changeset 429651 7aac2595bc175c596a5159dd059dce2201bd5430
parent 429650 7a4bb5a1848a315bd3e5be8557fbe74b5d855218
child 429652 1a56faf6adf5699f52f6a2a8293e10afe75dde78
push id7761
push userjlund@mozilla.com
push dateFri, 15 Sep 2017 00:19:52 +0000
treeherdermozilla-beta@c38455951db4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1398601
milestone57.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1398601 - Don't allow NSVO in js::CreateObjectsForEnvironmentChain r=jorendorff Seeing an NSVO in CreateObjectsForEnvironmentChain indicates the shared global namespace is about to be polluted, so fix those bugs and turn this to a diagnostic. MozReview-Commit-ID: 7OUef76geJL
js/src/vm/EnvironmentObject.cpp
--- a/js/src/vm/EnvironmentObject.cpp
+++ b/js/src/vm/EnvironmentObject.cpp
@@ -3182,17 +3182,18 @@ js::GetDebugEnvironmentForGlobalLexicalE
 
 bool
 js::CreateObjectsForEnvironmentChain(JSContext* cx, AutoObjectVector& chain,
                                      HandleObject terminatingEnv, MutableHandleObject envObj)
 {
 #ifdef DEBUG
     for (size_t i = 0; i < chain.length(); ++i) {
         assertSameCompartment(cx, chain[i]);
-        MOZ_ASSERT(!chain[i]->is<GlobalObject>());
+        MOZ_ASSERT(!chain[i]->is<GlobalObject>() &&
+                   !chain[i]->is<NonSyntacticVariablesObject>());
     }
 #endif
 
     // Construct With object wrappers for the things on this environment chain
     // and use the result as the thing to scope the function to.
     Rooted<WithEnvironmentObject*> withEnv(cx);
     RootedObject enclosingEnv(cx, terminatingEnv);
     for (size_t i = chain.length(); i > 0; ) {