summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authoryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 15:16:18 +0000
committeryurys@google.com <yurys@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-24 15:16:18 +0000
commit81762dde0dd66ae2eed6f45859e6f79154419819 (patch)
treee8c5228fe17387adf135e83492985515a0bf9bcf /webkit
parent12329519308255722992dab7fb5f7350414d13e1 (diff)
downloadchromium_src-81762dde0dd66ae2eed6f45859e6f79154419819.zip
chromium_src-81762dde0dd66ae2eed6f45859e6f79154419819.tar.gz
chromium_src-81762dde0dd66ae2eed6f45859e6f79154419819.tar.bz2
DevTools: autoresume execution on parse errors.
BUG=22852 TEST=DevToolsSanityTest.TestAutoContinueOnSyntaxError Review URL: http://codereview.chromium.org/218026 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27067 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/glue/devtools/js/debugger_agent.js5
-rw-r--r--webkit/glue/devtools/js/tests.js73
2 files changed, 68 insertions, 10 deletions
diff --git a/webkit/glue/devtools/js/debugger_agent.js b/webkit/glue/devtools/js/debugger_agent.js
index 884a994..4a9784a 100644
--- a/webkit/glue/devtools/js/debugger_agent.js
+++ b/webkit/glue/devtools/js/debugger_agent.js
@@ -790,8 +790,9 @@ devtools.DebuggerAgent.prototype.handleExceptionEvent_ = function(msg) {
WebInspector.currentPanel = WebInspector.panels.scripts;
var body = msg.getBody();
- if (this.pauseOnExceptions_) {
- var body = msg.getBody();
+ // No script field in the body means that v8 failed to parse the script. We
+ // resume execution on parser errors automatically.
+ if (this.pauseOnExceptions_ && body.script) {
var line = devtools.DebuggerAgent.v8ToWwebkitLineNumber_(body.sourceLine);
this.createExceptionMessage_(body.script.name, line, body.exception.text);
this.requestBacktrace_();
diff --git a/webkit/glue/devtools/js/tests.js b/webkit/glue/devtools/js/tests.js
index 7c241ad..3f168c5 100644
--- a/webkit/glue/devtools/js/tests.js
+++ b/webkit/glue/devtools/js/tests.js
@@ -667,6 +667,68 @@ TestSuite.prototype.testEvalOnCallFrame = function() {
/**
+ * Tests that inspected page doesn't hang on reload if it contains a syntax
+ * error and DevTools window is open.
+ */
+TestSuite.prototype.testAutoContinueOnSyntaxError = function() {
+ this.showPanel('scripts');
+ var test = this;
+
+ function checkScriptsList() {
+ var scriptSelect = document.getElementById('scripts-files');
+ var options = scriptSelect.options;
+ // There should be only console API source (see
+ // InjectedScript._ensureCommandLineAPIInstalled) since the page script
+ // contains a syntax error.
+ for (var i = 0 ; i < options.length; i++) {
+ if (options[i].text.search('script_syntax_error.html$') != -1) {
+ test.fail('Script with syntax error should not be in the list of ' +
+ 'parsed scripts.');
+ }
+ }
+ }
+
+ this.addSniffer(devtools.DebuggerAgent.prototype, 'handleScriptsResponse_',
+ function(msg) {
+ checkScriptsList();
+
+ // Reload inspected page.
+ test.evaluateInConsole_(
+ 'window.location.reload(true);',
+ function(resultText) {
+ test.assertEquals('undefined', resultText,
+ 'Unexpected result of reload().');
+ waitForExceptionEvent();
+ });
+ });
+
+ function waitForExceptionEvent() {
+ var exceptionCount = 0;
+ test.addSniffer(
+ devtools.DebuggerAgent.prototype,
+ 'handleExceptionEvent_',
+ function(msg) {
+ exceptionCount++;
+ test.assertEquals(1, exceptionCount, 'Too many exceptions.');
+ test.assertEquals(undefined, msg.getBody().script,
+ 'Unexpected exception: ' + JSON.stringify(msg));
+ test.releaseControl();
+ });
+
+ // Check that the script is not paused on parse error.
+ test.addSniffer(
+ WebInspector,
+ 'pausedScript',
+ function(callFrames) {
+ test.fail('Script execution should not pause on syntax error.');
+ });
+ }
+
+ this.takeControl();
+};
+
+
+/**
* Tests 'Pause' button will pause debugger when a snippet is evaluated.
*/
TestSuite.prototype.testPauseInEval = function() {
@@ -702,15 +764,10 @@ TestSuite.KeyEvent.prototype.stopPropagation = function() {};
* Tests console eval.
*/
TestSuite.prototype.testConsoleEval = function() {
- WebInspector.console.visible = true;
- WebInspector.console.prompt.text = '123';
- WebInspector.console.promptElement.handleKeyEvent(
- new TestSuite.KeyEvent('Enter'));
-
var test = this;
- this.addSniffer(WebInspector.ConsoleView.prototype, 'addMessage',
- function(commandResult) {
- test.assertEquals('123', commandResult.toMessageElement().textContent);
+ this.evaluateInConsole_('123',
+ function(resultText) {
+ test.assertEquals('123', resultText);
test.releaseControl();
});