[Pkg-mozext-commits] [firebug] 05/21: Issue #7917: Introduce extensions.firebug.listenDynamicScripts option

David Prévot taffit at moszumanska.debian.org
Tue Sep 15 16:17:05 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 72de59443ba383e4b39c25b141dae1c797f9faa2
Author: Florent FAYOLLE <florent.fayolle69 at gmail.com>
Date:   Sat Jul 11 21:19:18 2015 +0200

    Issue #7917: Introduce extensions.firebug.listenDynamicScripts option
---
 .../content/firebug/debugger/script/sourceTool.js  | 22 +++++++++++++++++++++-
 extension/defaults/preferences/firebug.js          |  1 +
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/extension/content/firebug/debugger/script/sourceTool.js b/extension/content/firebug/debugger/script/sourceTool.js
index fd6b01e..d6fceb6 100644
--- a/extension/content/firebug/debugger/script/sourceTool.js
+++ b/extension/content/firebug/debugger/script/sourceTool.js
@@ -77,6 +77,7 @@ var dynamicTypesMap = {
 function SourceTool(context)
 {
     this.context = context;
+    this.ignoreDynamicScripts = Options.get("ignoreDynamicScripts");
 }
 
 /**
@@ -161,6 +162,15 @@ SourceTool.prototype = Obj.extend(new Tool(),
             return;
         }
 
+        // Reject dynamic scripts if the option to listen them is turned off.
+        if (this.ignoreDynamicScripts &&
+            dynamicTypesMap[script.introductionType] &&
+            script.introductionType !== "scriptElement") {
+            Trace.sysout("sourceTool.updateScriptFiles; dynamic script introduced and " +
+                "ignored as the user set the preference \"ignoreDynamicScripts\" to true");
+            return;
+        }
+
         // xxxHonza: Ignore inner scripts for now
         if (this.context.getSourceFile(script.url))
         {
@@ -312,6 +322,9 @@ DynamicSourceCollector.prototype =
 {
     attach: function()
     {
+        if (this.sourceTool.ignoreDynamicScripts)
+            return;
+
         var dbg = DebuggerLib.getThreadDebugger(this.context);
 
         // Monkey patch the current debugger.
@@ -526,8 +539,9 @@ DynamicSourceCollector.prototype =
     restoreBreakpoints: function(script)
     {
         var threadActor = DebuggerLib.getThreadActor(this.context.browser);
-        if (!threadActor._allowSource(script.url))
+        if (!allowSource(threadActor, script)) {
             return false;
+        }
 
         // Firefox 38 removes the breakpointStore
         if (!threadActor.breakpointStore)
@@ -865,6 +879,12 @@ function getElementId(script)
     return Xpath.getElementTreeXPath(element) + " " + attrName;
 }
 
+function allowSource(threadActor, script) {
+    return threadActor._allowSource ?
+        threadActor._allowSource(script.url) :
+        threadActor.sources.allowSource(script.source);
+}
+
 // ********************************************************************************************* //
 // Registration
 
diff --git a/extension/defaults/preferences/firebug.js b/extension/defaults/preferences/firebug.js
index d78144d..7df4e05 100644
--- a/extension/defaults/preferences/firebug.js
+++ b/extension/defaults/preferences/firebug.js
@@ -110,6 +110,7 @@ pref("extensions.firebug.breakOnExceptions", false);
 pref("extensions.firebug.ignoreCaughtExceptions", false);
 pref("extensions.firebug.enableSyntaxHighlighting", true);
 pref("extensions.firebug.maxNumberOfDynamicScripts", 150);
+pref("extensions.firebug.ignoreDynamicScripts", false);
 
 // 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