Bug 1189677 - Only add scripts to the ScriptStore if we intend to debug their source; r=jsantell
authorNick Fitzgerald <fitzgen@gmail.com>
Fri, 31 Jul 2015 17:22:28 -0700
changeset 287386 70041285743416985d75534de430263d58644ade
parent 287385 de94f408a90191eaf57a1e3266f0f705a9b7be45
child 287387 61ab62f2fa33e4cfd32f948bfeb3db3b65800d11
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjsantell
bugs1189677
milestone42.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 1189677 - Only add scripts to the ScriptStore if we intend to debug their source; r=jsantell
toolkit/devtools/server/actors/script.js
--- a/toolkit/devtools/server/actors/script.js
+++ b/toolkit/devtools/server/actors/script.js
@@ -1862,23 +1862,16 @@ ThreadActor.prototype = {
    * scope of the specified debuggee global.
    *
    * @param aScript Debugger.Script
    *        The source script that has been loaded into a debuggee compartment.
    * @param aGlobal Debugger.Object
    *        A Debugger.Object instance whose referent is the global object.
    */
   onNewScript: function (aScript, aGlobal) {
-    // XXX: The scripts must be added to the ScriptStore before restoring
-    // breakpoints in _addScript. If we try to add them to the ScriptStore
-    // inside _addScript, we can accidentally set a breakpoint in a top level
-    // script as a "closest match" because we wouldn't have added the child
-    // scripts to the ScriptStore yet.
-    this.scripts.addScripts(this.dbg.findScripts({ source: aScript.source }));
-
     this._addSource(aScript.source);
   },
 
   onNewSource: function (aSource) {
     this.conn.send({
       from: this.actorID,
       type: "newSource",
       source: aSource.form()
@@ -1905,16 +1898,22 @@ ThreadActor.prototype = {
    *        The source that will be stored.
    * @returns true, if the source was added; false otherwise.
    */
   _addSource: function (aSource) {
     if (!this.sources.allowSource(aSource)) {
       return false;
     }
 
+    // The scripts must be added to the ScriptStore before restoring
+    // breakpoints. If we try to add them to the ScriptStore any later, we can
+    // accidentally set a breakpoint in a top level script as a "closest match"
+    // because we wouldn't have added the child scripts to the ScriptStore yet.
+    this.scripts.addScripts(this.dbg.findScripts({ source: aSource }));
+
     let sourceActor = this.sources.createNonSourceMappedActor(aSource);
 
     // Go ahead and establish the source actors for this script, which
     // fetches sourcemaps if available and sends onNewSource
     // notifications.
     //
     // We need to use unsafeSynchronize here because if the page is being reloaded,
     // this call will replace the previous set of source actors for this source