[Pkg-mozext-commits] [firebug] 67/82: Closure inspector: remove debuggees directly after adding them, to avoid killing performance
David Prévot
taffit at moszumanska.debian.org
Mon Mar 31 22:45:41 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 acdeffcf124ba38698ea8e798fc27a22e21c91f7
Author: Simon Lindholm <simon.lindholm10 at gmail.com>
Date: Fri Jan 18 02:31:11 2013 +0100
Closure inspector: remove debuggees directly after adding them, to avoid killing performance
---
.../content/firebug/console/closureInspector.js | 34 ++++++++++++++++++----
1 file changed, 28 insertions(+), 6 deletions(-)
diff --git a/extension/content/firebug/console/closureInspector.js b/extension/content/firebug/console/closureInspector.js
index a124dea..2df62c2 100644
--- a/extension/content/firebug/console/closureInspector.js
+++ b/extension/content/firebug/console/closureInspector.js
@@ -27,6 +27,7 @@ var ClosureInspector =
{
hasInit: false,
Debugger: null,
+ debuggeeCache: new WeakMap(),
getInactiveDebuggerForContext: function(context)
{
@@ -57,6 +58,27 @@ var ClosureInspector =
return dbg;
},
+ getDebuggeeObject: function(context, global)
+ {
+ var dbg = this.getInactiveDebuggerForContext(context);
+
+ // Because (outer) windows persist between reloads, use their documents
+ // as keys into the cache instead.
+ var cacheKey = global.document || global;
+
+ var dglobal = this.debuggeeCache.get(cacheKey);
+ if (dglobal)
+ return dglobal;
+
+ // Note: for no purposes is it actually important that the global is
+ // held as a debuggee; it just makes things slower.
+ dglobal = dbg.addDebuggee(global);
+ dbg.removeDebuggee(global);
+
+ this.debuggeeCache.set(cacheKey, dglobal);
+ return dglobal;
+ },
+
getVariableOrOptimizedAway: function(scope, name)
{
try
@@ -192,7 +214,9 @@ var ClosureInspector =
throw new Error("permission denied to access cross origin scope");
}
- var dglobal = dbg.addDebuggee(objGlobal);
+ // Create a view of the object as seen from its own global - 'environment'
+ // will not be accessible otherwise.
+ var dglobal = this.getDebuggeeObject(context, objGlobal);
var dobj = dglobal.makeDebuggeeValue(obj);
@@ -250,13 +274,12 @@ var ClosureInspector =
throw exc;
}
- var env, dbg, dglobal;
+ var env, dglobal;
try
{
env = this.getEnvironmentForObject(win, obj, context);
- dbg = this.getInactiveDebuggerForContext(context);
- dglobal = dbg.addDebuggee(win);
+ dglobal = this.getDebuggeeObject(context, win);
}
catch (exc)
{
@@ -345,8 +368,7 @@ var ClosureInspector =
return;
}
- var dbg = this.getInactiveDebuggerForContext(context);
- var dwin = dbg.addDebuggee(win);
+ var dwin = this.getDebuggeeObject(context, win);
var scopeDataHolder = Object.create(ScopeProxy.prototype);
scopeDataHolder.scope = scope;
--
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