diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 14:01:53 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-30 14:01:53 +0000 |
commit | d665486437d81ef40160203e128b0d74e9bb7d6e (patch) | |
tree | c98e5451e184fdf24fc879f0ef57a79517442f61 /webkit | |
parent | 85ebad6ec451f726596d9596299487e31c2063b4 (diff) | |
download | chromium_src-d665486437d81ef40160203e128b0d74e9bb7d6e.zip chromium_src-d665486437d81ef40160203e128b0d74e9bb7d6e.tar.gz chromium_src-d665486437d81ef40160203e128b0d74e9bb7d6e.tar.bz2 |
DevTools: hide script for javascript:void(0)
Review URL: http://codereview.chromium.org/159636
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@22053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index 2394ad6..a5ae1d1 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -110,6 +110,13 @@ devtools.DebuggerAgent.ScopeType = { /** + * A no-op JS expression that is sent to the inspected page in order to force v8 + * execution. + */ +devtools.DebuggerAgent.VOID_SCRIPT = 'javascript:void(0)'; + + +/** * Resets debugger agent to its initial state. */ devtools.DebuggerAgent.prototype.reset = function() { @@ -151,7 +158,7 @@ devtools.DebuggerAgent.prototype.initUI = function() { }); devtools.DebuggerAgent.sendCommand_(cmd); // Force v8 execution so that it gets to processing the requested command. - devtools.tools.evaluateJavaScript('javascript:void(0)'); + devtools.tools.evaluateJavaScript(devtools.DebuggerAgent.VOID_SCRIPT); }; @@ -176,7 +183,7 @@ devtools.DebuggerAgent.prototype.resolveScriptSource = function( }); devtools.DebuggerAgent.sendCommand_(cmd); // Force v8 execution so that it gets to processing the requested command. - devtools.tools.evaluateJavaScript('javascript:void(0)'); + devtools.tools.evaluateJavaScript(devtools.DebuggerAgent.VOID_SCRIPT); this.requestSeqToCallback_[cmd.getSequenceNumber()] = function(msg) { if (msg.isSuccess()) { @@ -741,6 +748,11 @@ devtools.DebuggerAgent.prototype.handleScriptsResponse_ = function(msg) { continue; } + // There is no script source + if (this.isVoidScript_(script)) { + continue; + } + // We may already have received the info in an afterCompile event. if (script.id in this.parsedScripts_) { continue; @@ -805,6 +817,11 @@ devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg) { return; } var script = msg.getBody().script; + + if (this.isVoidScript_(script)) { + return; + } + // Ignore scripts from other tabs. if (!this.isScriptFromInspectedContext_(script, msg)) { return; @@ -814,6 +831,18 @@ devtools.DebuggerAgent.prototype.handleAfterCompileEvent_ = function(msg) { /** + * @param {Object} script Parsed JSON object representing script. + * @return {boolean} Whether the script is a result of the void script + * evaluation and should not appear in the UI. + */ +devtools.DebuggerAgent.prototype.isVoidScript_ = function(script) { + return !script.name && + (script.sourceStart == devtools.DebuggerAgent.VOID_SCRIPT || + script.source == devtools.DebuggerAgent.VOID_SCRIPT); +}; + + +/** * Handles current profiler status. */ devtools.DebuggerAgent.prototype.didIsProfilingStarted_ = function( |