diff options
-rw-r--r-- | chrome/browser/debugger/devtools_sanity_unittest.cc | 8 | ||||
-rw-r--r-- | chrome/test/data/devtools/pause_when_loading_devtools.html | 17 | ||||
-rw-r--r-- | webkit/glue/devtools/js/devtools.js | 14 | ||||
-rw-r--r-- | webkit/glue/devtools/js/tests.js | 25 |
4 files changed, 63 insertions, 1 deletions
diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 63e00cb..b5110da 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -51,6 +51,8 @@ const wchar_t kEvalTestPage[] = L"files/devtools/eval_test_page.html"; const wchar_t kJsPage[] = L"files/devtools/js_page.html"; const wchar_t kPauseOnExceptionTestPage[] = L"files/devtools/pause_on_exception.html"; +const wchar_t kPauseWhenLoadingDevTools[] = + L"files/devtools/pause_when_loading_devtools.html"; const wchar_t kResourceContentLengthTestPage[] = L"files/devtools/image.html"; const wchar_t kResourceTestPage[] = L"files/devtools/resource_test_page.html"; const wchar_t kSimplePage[] = L"files/devtools/simple_page.html"; @@ -332,6 +334,12 @@ IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPauseOnException) { RunTest("testPauseOnException", kPauseOnExceptionTestPage); } +// Tests that debugger works correctly if pause event occurs when DevTools +// frontend is being loaded. +IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPauseWhenLoadingDevTools) { + RunTest("testPauseWhenLoadingDevTools", kPauseWhenLoadingDevTools); +} + // Tests eval on call frame. IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestEvalOnCallFrame) { RunTest("testEvalOnCallFrame", kDebuggerTestPage); diff --git a/chrome/test/data/devtools/pause_when_loading_devtools.html b/chrome/test/data/devtools/pause_when_loading_devtools.html new file mode 100644 index 0000000..3cd39e1 --- /dev/null +++ b/chrome/test/data/devtools/pause_when_loading_devtools.html @@ -0,0 +1,17 @@ +<html> +<head> +<script> + +// Try to call debugger in loop so that pause event happens +// during DevTools frontend load. +function callDebugger() { + debugger; + setTimeout(callDebugger, 0); +} + +</script> +</head> +<body onload='callDebugger()'> +Call debugger repeatedly. +</body> +</html> diff --git a/webkit/glue/devtools/js/devtools.js b/webkit/glue/devtools/js/devtools.js index 9820c94..11f482f 100644 --- a/webkit/glue/devtools/js/devtools.js +++ b/webkit/glue/devtools/js/devtools.js @@ -487,4 +487,16 @@ WebInspector.ElementsPanel.prototype._nodeSearchButtonClicked = function( InspectorController.toggleNodeSearch(); this.nodeSearchButton.toggled = !this.nodeSearchButton.toggled; }; -})();
\ No newline at end of file +})(); + + +(function() { +// Temporary fix until fix for https://bugs.webkit.org/show_bug.cgi?id=31343 +// is landed. +var original = WebInspector.addDOMStorage; +WebInspector.addDOMStorage = function(payload) { + if (!this.panels.storage) + return; + return original.apply(this, arguments); +}; +})(); diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js index e65ea9d..0a0cdd6 100644 --- a/webkit/glue/devtools/js/tests.js +++ b/webkit/glue/devtools/js/tests.js @@ -637,6 +637,31 @@ TestSuite.prototype.testPauseOnException = function() { }; +// Tests that debugger works correctly if pause event occurs when DevTools +// frontend is being loaded. +TestSuite.prototype.testPauseWhenLoadingDevTools = function() { + this.showPanel('scripts'); + var test = this; + + // Script execution can already be paused. + if (WebInspector.currentPanel.paused) { + var callFrame = + WebInspector.currentPanel.sidebarPanes.callstack.selectedCallFrame; + this.assertEquals('callDebugger', callFrame.functionName); + return; + } + + this.addSniffer( + WebInspector, + 'pausedScript', + function(callFrames) { + test.assertEquals('callDebugger', callFrames[0].functionName); + test.releaseControl(); + }); + this.takeControl(); +}; + + /** * Serializes options collection to string. * @param {HTMLOptionsCollection} options |