diff options
author | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 13:43:17 +0000 |
---|---|---|
committer | yurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-18 13:43:17 +0000 |
commit | f099ba3032fb9f0f2cdd1a482c33026451ad379d (patch) | |
tree | c437ed6ee2ae626fc62c4dc2c0879eed845bf92e /webkit | |
parent | 572e8f59bbee378bde6159dc05169a48be0f3c0e (diff) | |
download | chromium_src-f099ba3032fb9f0f2cdd1a482c33026451ad379d.zip chromium_src-f099ba3032fb9f0f2cdd1a482c33026451ad379d.tar.gz chromium_src-f099ba3032fb9f0f2cdd1a482c33026451ad379d.tar.bz2 |
DevTools: don't duplicate eval scripts on each panel switch.
Review URL: http://codereview.chromium.org/211012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@26562 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/devtools/js/debugger_agent.js | 8 | ||||
-rw-r--r-- | webkit/glue/devtools/js/tests.js | 54 |
2 files changed, 54 insertions, 8 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js index 1d566eb..884a994 100644 --- a/webkit/glue/devtools/js/debugger_agent.js +++ b/webkit/glue/devtools/js/debugger_agent.js @@ -154,14 +154,6 @@ devtools.DebuggerAgent.prototype.reset = function() { * is shown. It will send request for context id if it's not set yet. */ devtools.DebuggerAgent.prototype.initUI = function() { - // There can be a number of scripts from after-compile events that are - // pending addition into the UI. - for (var scriptId in this.parsedScripts_) { - var script = this.parsedScripts_[scriptId]; - WebInspector.parsedScriptSource(scriptId, script.getUrl(), - undefined /* script source */, script.getLineOffset()); - } - // Initialize scripts cache when Scripts panel is shown first time. if (this.scriptsCacheInitialized_) { return; diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js index 5691017..ae28aed 100644 --- a/webkit/glue/devtools/js/tests.js +++ b/webkit/glue/devtools/js/tests.js @@ -394,6 +394,60 @@ TestSuite.prototype.testShowScriptsTab = function() { /** + * Tests that scripts are not duplicaed on Scripts tab switch. + */ +TestSuite.prototype.testNoScriptDuplicatesOnPanelSwitch = function() { + var test = this; + + // There should be two scripts: one for the main page and another + // one which is source of console API(see + // InjectedScript._ensureCommandLineAPIInstalled). + var expectedScriptsCount = 2; + var parsedScripts = []; + + + function switchToElementsTab() { + test.showPanel('elements'); + setTimeout(switchToScriptsTab, 0); + } + + function switchToScriptsTab() { + test.showPanel('scripts'); + setTimeout(checkScriptsPanel, 0); + } + + function checkScriptsPanel() { + test.assertTrue(!!WebInspector.panels.scripts.visibleView, + 'No visible script view.'); + var select = WebInspector.panels.scripts.filesSelectElement; + test.assertEquals(expectedScriptsCount, select.options.length, + 'Unexpected options count'); + test.releaseControl(); + } + + this.addSniffer(WebInspector, 'parsedScriptSource', + function(sourceID, sourceURL, source, startingLine) { + test.assertTrue( + parsedScripts.indexOf(sourceURL) == -1, + 'Duplicated script: ' + sourceURL); + test.assertTrue( + parsedScripts.length < expectedScriptsCount, + 'Too many scripts: ' + sourceURL); + parsedScripts.push(sourceURL); + + if (parsedScripts.length == expectedScriptsCount) { + setTimeout(switchToElementsTab, 0); + } + }, true /* sticky */); + + this.showPanel('scripts'); + + // Wait until all scripts are added to the debugger. + this.takeControl(); +}; + + +/** * Tests that a breakpoint can be set. */ TestSuite.prototype.testSetBreakpoint = function() { |