Address review comments from billm in bug 672829 comment 76.
authorJason Orendorff <jorendorff@mozilla.com>
Thu, 11 Aug 2011 16:07:35 -0500
changeset 75245 718fd6b1d535433e044d1a1d4f30964f24a4378e
parent 75244 e80ea91176e0f8f32969678ec274193e392d9069
child 75246 0fbb475b0cba5ee9fb3362ffc5d05faf7f354a03
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
bugs672829
milestone8.0a1
Address review comments from billm in bug 672829 comment 76.
js/src/jscompartment.cpp
js/src/vm/Debugger.cpp
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -810,18 +810,18 @@ JSCompartment::markBreakpointsIterativel
     for (BreakpointSiteMap::Range r = breakpointSites.all(); !r.empty(); r.popFront()) {
         BreakpointSite *site = r.front().value;
 
         // Mark jsdbgapi state if any. But if we know the scriptObject, put off
         // marking trap state until we know the scriptObject is live.
         if (site->trapHandler &&
             (!site->scriptObject || IsAboutToBeFinalized(cx, site->scriptObject)))
         {
-            if (site->trapClosure.isObject() &&
-                IsAboutToBeFinalized(cx, &site->trapClosure.toObject()))
+            if (site->trapClosure.isMarkable() &&
+                IsAboutToBeFinalized(cx, site->trapClosure.toGCThing()))
             {
                 markedAny = true;
             }
             MarkValue(trc, site->trapClosure, "trap closure");
         }
 
         // Mark js::Debugger breakpoints. If either the debugger or the script is
         // collected, then the breakpoint is collected along with it. So do not
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -916,16 +916,21 @@ Debugger::onTrap(JSContext *cx, Value *v
 /*** Debugger JSObjects **************************************************************************/
 
 void
 Debugger::markKeysInCompartment(JSTracer *tracer, const ObjectWeakMap &map)
 {
     JSCompartment *comp = tracer->context->runtime->gcCurrentCompartment;
     JS_ASSERT(comp);
 
+    /*
+     * WeakMap::Range is deliberately private, to discourage C++ code from
+     * enumerating WeakMap keys. However in this case we need access, so we
+     * make a base-class reference. Range is public in HashMap.
+     */
     typedef HashMap<JSObject *, JSObject *, DefaultHasher<JSObject *>, RuntimeAllocPolicy> Map;
     const Map &storage = map;
     for (Map::Range r = storage.all(); !r.empty(); r.popFront()) {
         JSObject *key = r.front().key;
         if (key->compartment() == comp && IsAboutToBeFinalized(tracer->context, key))
             js::gc::MarkObject(tracer, *key, "cross-compartment WeakMap key");
     }
 }