From f9aafd561fa645fce15b32e25599446414db298c Mon Sep 17 00:00:00 2001 From: Luke Wagner Date: Thu, 23 Aug 2012 10:58:24 -0700 Subject: [PATCH] Bug 784706 - clear proxiedScopes in DebugScopes::onCompartmentLeaveDebugMode (r=jimb) --- js/src/jsweakmap.h | 2 +- js/src/vm/ScopeObject.cpp | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/src/jsweakmap.h b/js/src/jsweakmap.h index 7680151b37b..963a02655c4 100644 --- a/js/src/jsweakmap.h +++ b/js/src/jsweakmap.h @@ -150,9 +150,9 @@ template , public WeakMapBase { private: typedef HashMap Base; - typedef typename Base::Enum Enum; public: + typedef typename Base::Enum Enum; typedef typename Base::Range Range; explicit WeakMap(JSRuntime *rt, JSObject *memOf=NULL) : Base(rt), WeakMapBase(memOf) { } diff --git a/js/src/vm/ScopeObject.cpp b/js/src/vm/ScopeObject.cpp index 1966e126f37..d08b72ba3ea 100644 --- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -1663,7 +1663,7 @@ DebugScopes::onPopCall(StackFrame *fp, JSContext *cx) /* * When the StackFrame is popped, the values of unaliased variables * are lost. If there is any debug scope referring to this scope, save a - * copy of the unaliased variables' values in an array for latter debugger + * copy of the unaliased variables' values in an array for later debugger * access via DebugScopeProxy::handleUnaliasedAccess. * * Note: since it is simplest for this function to be infallible, failure @@ -1776,6 +1776,10 @@ DebugScopes::onGeneratorFrameChange(StackFrame *from, StackFrame *to, JSContext void DebugScopes::onCompartmentLeaveDebugMode(JSCompartment *c) { + for (ObjectWeakMap::Enum e(proxiedScopes); !e.empty(); e.popFront()) { + if (e.front().key->compartment() == c) + e.removeFront(); + } for (MissingScopeMap::Enum e(missingScopes); !e.empty(); e.popFront()) { if (e.front().key.fp()->compartment() == c) e.removeFront();