[Pkg-mozext-commits] [firebug] 01/16: Issue 7721: Limit the number of dynamic scripts to list in the script panel

David Prévot taffit at moszumanska.debian.org
Fri Feb 6 17:18:16 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository firebug.

commit f2a77d4e6b00c17abbb2d9b9535e48322428087a
Author: Florent FAYOLLE <florent.fayolle69 at gmail.com>
Date:   Sat Dec 13 12:26:23 2014 +0100

    Issue 7721: Limit the number of dynamic scripts to list in the script panel
---
 extension/content/firebug/debugger/script/sourceTool.js | 16 +++++++++++++++-
 extension/defaults/preferences/firebug.js               |  1 +
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/extension/content/firebug/debugger/script/sourceTool.js b/extension/content/firebug/debugger/script/sourceTool.js
index d289d0f..6b271e2 100644
--- a/extension/content/firebug/debugger/script/sourceTool.js
+++ b/extension/content/firebug/debugger/script/sourceTool.js
@@ -4,6 +4,7 @@ define([
     "firebug/firebug",
     "firebug/lib/trace",
     "firebug/lib/object",
+    "firebug/lib/options",
     "firebug/lib/string",
     "firebug/lib/url",
     "firebug/lib/xpath",
@@ -18,7 +19,7 @@ define([
     "firebug/remoting/debuggerClient",
     "arch/compilationunit",
 ],
-function (Firebug, FBTrace, Obj, Str, Url, Xpath, Xpcom, Tool, ErrorStackTraceObserver,
+function (Firebug, FBTrace, Obj, Options, Str, Url, Xpath, Xpcom, Tool, ErrorStackTraceObserver,
     BreakpointStore, BreakpointTool, SourceFile, StackFrame, DebuggerLib,
     DebuggerClient, CompilationUnit) {
 
@@ -313,6 +314,8 @@ DynamicSourceCollector.prototype =
         this.originalOnNewScript = dbg.onNewScript;
 
         dbg.onNewScript = this.onNewScript.bind(this);
+        this.context.numberOfDynamicScripts = 0;
+        this.maxNumberOfDynamicScripts = Options.get("maxNumberOfDynamicScripts");
     },
 
     detach: function()
@@ -452,6 +455,16 @@ DynamicSourceCollector.prototype =
             this.context.addSourceFile(sourceFile);
         }
 
+        // If we reach the limit of dynamic scripts, we stop listening on dynamic script additions.
+        // This prevents unresponsive warnings on pages like ones using Polymer.
+        if (this.maxNumberOfDynamicScripts >= 0 &&
+            this.context.numberOfDynamicScripts > this.maxNumberOfDynamicScripts)
+        {
+            var dbg = DebuggerLib.getThreadDebugger(this.context);
+            if (dbg)
+                dbg.onNewScript = this.originalOnNewScript;
+        }
+
         // Register new script object in the source file object, before "newSource" event.
         // This way bp.params.dynamicHandler is set for dynamic breakpoints and filtered
         // out during standard breakpoint initialization within:
@@ -816,6 +829,7 @@ function computeDynamicUrl(script, context)
             sourceFile.uniqueUrlIndex = index;
             // Update the unique URL so it is really unique.
             uniqueUrl += " (" + index + ")";
+            context.numberOfDynamicScripts++;
             sourceFile.otherUniqueUrlsAtSameLocation.push(uniqueUrl);
         }
     }
diff --git a/extension/defaults/preferences/firebug.js b/extension/defaults/preferences/firebug.js
index 9f66bb5..e612c17 100644
--- a/extension/defaults/preferences/firebug.js
+++ b/extension/defaults/preferences/firebug.js
@@ -109,6 +109,7 @@ pref("extensions.firebug.maxScriptLineLength", 10000);
 pref("extensions.firebug.breakOnExceptions", false);
 pref("extensions.firebug.ignoreCaughtExceptions", false);
 pref("extensions.firebug.enableSyntaxHighlighting", true);
+pref("extensions.firebug.maxNumberOfDynamicScripts", 300);
 
 // Stack
 pref("extensions.firebug.omitObjectPathStack", false);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/firebug.git



More information about the Pkg-mozext-commits mailing list