Bug 958980 - Stop Debugger from exposing partially initialized JSScripts. r=jorendorff, a=bajaj
authorShu-yu Guo <shu@rfrn.org>
Tue, 21 Jan 2014 10:59:05 -0800
changeset 167993 664bc0ef6421ce6cd56c5e3a4b5264ba027eb434
parent 167992 e9969e74c4a4ab6ee8f2dd997eea58069cae427f
child 167994 1b3060857876bd9cb6f4eb895d26d5302549cd98
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff, bajaj
bugs958980
milestone27.0
Bug 958980 - Stop Debugger from exposing partially initialized JSScripts. r=jorendorff, a=bajaj
js/src/vm/Debugger.cpp
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -2568,17 +2568,20 @@ class Debugger::ScriptQuery {
     }
 
     /*
      * If |script| matches this query, append it to |vector| or place it in
      * |innermostForCompartment|, as appropriate. Set |oom| if an out of memory
      * condition occurred.
      */
     void consider(JSScript *script) {
-        if (oom || script->selfHosted)
+        // We check for presence of script->code() because it is possible that
+        // the script was created and thus exposed to GC, but *not* fully
+        // initialized from fullyInit{FromEmitter,Trivial} due to errors.
+        if (oom || script->selfHosted || !script->code())
             return;
         JSCompartment *compartment = script->compartment();
         if (!compartments.has(compartment))
             return;
         if (urlCString.ptr()) {
             if (!script->filename() || strcmp(script->filename(), urlCString.ptr()) != 0)
                 return;
         }