[Pkg-mozext-commits] [firebug] 69/82: Issue 6185: Closure Inspector: .% syntax doesn't work when execution is stopped in frame

David Prévot taffit at moszumanska.debian.org
Mon Mar 31 22:45:42 UTC 2014


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

taffit pushed a commit to tag fbtest-1.11.2
in repository firebug.

commit 15fa818ca71bb6eff0a9379dcc1554260fae1115
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date:   Mon Jan 14 17:20:15 2013 +0100

    Issue 6185: Closure Inspector: .% syntax doesn't work when execution is stopped in frame
    
    http://code.google.com/p/fbug/issues/detail?id=6185
    
    Safe port of 326738e and 18c72bd.
---
 extension/content/firebug/console/autoCompleter.js |  2 +-
 .../content/firebug/console/closureInspector.js    |  2 +-
 extension/content/firebug/console/commandLine.js   | 27 +++++++---------------
 extension/content/firebug/dom/domPanel.js          | 10 ++++----
 extension/content/firebug/js/debugger.js           | 17 ++++++++++++--
 extension/content/firebug/js/scriptPanel.js        |  7 +++---
 extension/content/firebug/js/watchPanel.js         |  7 +++---
 7 files changed, 38 insertions(+), 34 deletions(-)

diff --git a/extension/content/firebug/console/autoCompleter.js b/extension/content/firebug/console/autoCompleter.js
index 65e6483..76a9dbb 100644
--- a/extension/content/firebug/console/autoCompleter.js
+++ b/extension/content/firebug/console/autoCompleter.js
@@ -2148,7 +2148,7 @@ function autoCompleteEval(context, preExpr, spreExpr, includeCurrentScope)
         spreExpr: spreExpr,
         completions: [],
         hiddenCompletions: [],
-        window: context.baseWindow || context.window
+        window: context.stoppedGlobal || context.baseWindow || context.window
     };
     var indexCompletion = false;
 
diff --git a/extension/content/firebug/console/closureInspector.js b/extension/content/firebug/console/closureInspector.js
index 2df62c2..84309f2 100644
--- a/extension/content/firebug/console/closureInspector.js
+++ b/extension/content/firebug/console/closureInspector.js
@@ -234,7 +234,7 @@ var ClosureInspector =
         var ret = [];
 
         // Avoid 'window' and 'document' getting associated with closures.
-        var win = context.baseWindow || context.window;
+        var win = context.stoppedGlobal || context.baseWindow || context.window;
         if (obj === win || obj === win.document)
             return ret;
 
diff --git a/extension/content/firebug/console/commandLine.js b/extension/content/firebug/console/commandLine.js
index ed0668c..0528761 100644
--- a/extension/content/firebug/console/commandLine.js
+++ b/extension/content/firebug/console/commandLine.js
@@ -78,7 +78,7 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
         if (!context)
             return;
 
-        targetWindow = targetWindow || context.baseWindow || context.window;
+        targetWindow = targetWindow || context.stoppedGlobal || context.baseWindow || context.window;
 
         try
         {
@@ -123,7 +123,7 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
     evaluateByEventPassing: function(expr, context, thisValue, targetWindow,
         successConsoleFunction, exceptionFunction, origExpr)
     {
-        var win = targetWindow || context.baseWindow || context.window;
+        var win = targetWindow || context.stoppedGlobal || context.baseWindow || context.window;
 
         if (!win)
         {
@@ -257,7 +257,7 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
     {
         var result = null;
 
-        var win = targetWindow || context.baseWindow || context.window;
+        var win = targetWindow || context.stoppedGlobal || context.baseWindow || context.window;
 
         if (!context.commandLineAPI)
             context.commandLineAPI = new FirebugCommandLineAPI(context);
@@ -286,9 +286,7 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
     evaluateByPostMessage: function(expr, context, thisValue, targetWindow,
         successConsoleFunction, exceptionFunction)
     {
-        // targetWindow may be frame in HTML
-        var win = targetWindow ? targetWindow :
-            (context.baseWindow ? context.baseWindow : context.window);
+        var win = targetWindow || context.stoppedGlobal || context.baseWindow || context.window;
 
         if (!win)
         {
@@ -351,8 +349,8 @@ Firebug.CommandLine = Obj.extend(Firebug.Module,
 
     evaluateInWebPage: function(expr, context, targetWindow)
     {
-        var win = targetWindow ? targetWindow :
-            (context.baseWindow ? context.baseWindow : context.window);
+        var win = targetWindow || context.stoppedGlobal || context.baseWindow || context.window;
+
         var element = Dom.addScript(win.document, "_firebugInWebPage", expr);
         if (!element)
             return;
@@ -1402,8 +1400,8 @@ function CommandLineHandler(context, win)
 
         if (FBTrace.DBG_COMMANDLINE)
         {
-            FBTrace.sysout("commandLine.handleEvent('firebugExecuteCommand') " +
-                "event in context.baseWindow " + context.baseWindow.location, event);
+            FBTrace.sysout("commandLine.handleEvent() " +
+                " window: " + Win.safeGetWindowLocation(win), {win: win, ev: event});
         }
 
         // Appends variables into the api.
@@ -1432,15 +1430,6 @@ function CommandLineHandler(context, win)
             var methodName = win.document.getUserData("firebug-methodName");
             Firebug.Console.log(Locale.$STRF("commandline.MethodNotSupported", [methodName]));
         }
-
-        if (FBTrace.DBG_COMMANDLINE)
-        {
-            FBTrace.sysout("commandLine.handleEvent() " +
-                win.document.getUserData("firebug-methodName") +
-                " context.baseWindow: " +
-                (context.baseWindow ? context.baseWindow.location : "no basewindow"),
-                context.baseWindow);
-        }
     };
 }
 
diff --git a/extension/content/firebug/dom/domPanel.js b/extension/content/firebug/dom/domPanel.js
index 381e538..3165392 100644
--- a/extension/content/firebug/dom/domPanel.js
+++ b/extension/content/firebug/dom/domPanel.js
@@ -696,7 +696,7 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
         {
             try
             {
-                var win = context.baseWindow || context.window;
+                var win = context.stoppedGlobal || context.baseWindow || context.window;
                 ClosureInspector.getEnvironmentForObject(win, value, context);
                 hasChildren = true;
             }
@@ -796,7 +796,7 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
     // Add the magic "(closure)" property.
     maybeAddClosureMember: function(object, type, props, level, context, isScope)
     {
-        var win = context.baseWindow || context.window;
+        var win = context.stoppedGlobal || context.baseWindow || context.window;
         var wrapper = ClosureInspector.getScopeWrapper(object, win, context, isScope);
         if (!wrapper)
             return;
@@ -1163,7 +1163,8 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
         var object = this.getRealRowObject(row);
         if (object && !(object instanceof StackFrame.StackFrame))
         {
-            Firebug.CommandLine.evaluate(value, this.context, object, this.context.getGlobalScope(),
+            var win = this.context.stoppedGlobal || this.context.baseWindow || this.context.window;
+            Firebug.CommandLine.evaluate(value, this.context, object, win,
                 function success(result, context)
                 {
                     if (FBTrace.DBG_DOM)
@@ -1537,7 +1538,8 @@ Firebug.DOMBasePanel.prototype = Obj.extend(Firebug.Panel,
 
     getDefaultSelection: function()
     {
-        return this.getObjectView(this.context.getGlobalScope());
+        // Default to showing the top window.
+        return this.getObjectView(this.context.window);
     },
 
     // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/extension/content/firebug/js/debugger.js b/extension/content/firebug/js/debugger.js
index 21368e1..f21f78b 100644
--- a/extension/content/firebug/js/debugger.js
+++ b/extension/content/firebug/js/debugger.js
@@ -134,7 +134,8 @@ Firebug.Debugger = Obj.extend(Firebug.ActivableModule,
     getCurrentFrameKeys: function(context)  // TODO remote, on bti
     {
         // return is safe
-        var globals = Arr.keys(Wrapper.getContentView(context.getGlobalScope()));
+        var win = context.stoppedGlobal || context.baseWindow || context.window;
+        var globals = Arr.keys(Wrapper.getContentView(win));
         if (context.currentFrame)
             return this.getFrameKeys(context.currentFrame, globals);
 
@@ -300,12 +301,23 @@ Firebug.Debugger = Obj.extend(Firebug.ActivableModule,
         context.stoppedFrame = frame;  // the frame we stopped in, don't change this elsewhere.
         context.currentFrame = frame;  // the frame we show to user, depends on selection
         context.stopped = true;
+        try
+        {
+            context.stoppedGlobal = XPCNativeWrapper(
+                Wrapper.unwrapIValue(frame.executionContext.globalObject));
+        }
+        catch (exc)
+        {
+            if (FBTrace.DBG_ERRORS)
+                FBTrace.sysout("debugger.stop failed to get global scope");
+        }
 
-        var hookReturn = Firebug.connection.dispatch("onStop",[context,frame, type,rv]);
+        var hookReturn = Firebug.connection.dispatch("onStop", [context, frame, type, rv]);
         if ( hookReturn && hookReturn >= 0 )
         {
             delete context.stopped;
             delete context.stoppedFrame;
+            delete context.stoppedGlobal;
             delete context.currentFrame;
 
             if (FBTrace.DBG_UI_LOOP)
@@ -1017,6 +1029,7 @@ Firebug.Debugger = Obj.extend(Firebug.ActivableModule,
             {
                 delete context.stopped;
                 delete context.stoppedFrame;
+                delete context.stoppedGlobal;
                 delete context.currentFrame;
                 context.executingSourceFile = null;
                 delete context.breakLineNumber;
diff --git a/extension/content/firebug/js/scriptPanel.js b/extension/content/firebug/js/scriptPanel.js
index d27112a..b99b623 100644
--- a/extension/content/firebug/js/scriptPanel.js
+++ b/extension/content/firebug/js/scriptPanel.js
@@ -503,7 +503,8 @@ Firebug.ScriptPanel.prototype = Obj.extend(Firebug.SourceBoxPanel,
         var self = this;
 
         // If the evaluate fails, then we report an error and don't show the infotip
-        Firebug.CommandLine.evaluate(expr, this.context, null, this.context.getGlobalScope(),
+        var win = this.context.stoppedGlobal || this.context.baseWindow || this.context.window;
+        Firebug.CommandLine.evaluate(expr, this.context, null, win,
             function success(result, context)
             {
                 var rep = Firebug.getRep(result, context);
@@ -1622,9 +1623,7 @@ Firebug.ScriptPanel.prototype = Obj.extend(Firebug.SourceBoxPanel,
         if (!chrome)
         {
             if (FBTrace.DBG_ERRORS)
-                FBTrace.sysout("debugger.syncCommand, context with no chrome: " +
-                    context.getGlobalScope());
-
+                FBTrace.sysout("debugger.syncCommand, context with no chrome", context);
             return;
         }
 
diff --git a/extension/content/firebug/js/watchPanel.js b/extension/content/firebug/js/watchPanel.js
index aa29044..21fedf7 100644
--- a/extension/content/firebug/js/watchPanel.js
+++ b/extension/content/firebug/js/watchPanel.js
@@ -120,10 +120,12 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
         }
 
         var scopes;
+        var context = this.context;
+        var win = context.stoppedGlobal || context.baseWindow || context.window;
         if (frame instanceof StackFrame.StackFrame)
             scopes = frame.getScopes(Firebug.viewChrome);
         else
-            scopes = [this.context.getGlobalScope()];
+            scopes = [win];
 
         if (FBTrace.DBG_STACK)
             FBTrace.sysout("dom watch frame isStackFrame " +
@@ -132,7 +134,6 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
 
         var members = [];
 
-        var context = this.context;
         if (this.watches)
         {
             for (var i = 0; i < this.watches.length; ++i)
@@ -140,7 +141,7 @@ Firebug.WatchPanel.prototype = Obj.extend(Firebug.DOMBasePanel.prototype,
                 var expr = this.watches[i];
                 var value = null;
 
-                Firebug.CommandLine.evaluate(expr, context, null, context.getGlobalScope(),
+                Firebug.CommandLine.evaluate(expr, context, null, win,
                     function success(result, context)
                     {
                         value = result;

-- 
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