Commit 1a6d5b21 authored by vsevik@chromium.org's avatar vsevik@chromium.org

Web Inspector: UISourceCode commitWorkingCopy should not fail when original...

Web Inspector: UISourceCode commitWorkingCopy should not fail when original script had syntax error.
https://bugs.webkit.org/show_bug.cgi?id=97272

Reviewed by Pavel Feldman.

This patch is based on patch by John J. Barton.

Source/WebCore:

* inspector/front-end/JavaScriptSource.js:
(WebInspector.JavaScriptSource.prototype.workingCopyCommitted): added rawLocation null check.

LayoutTests:

* http/tests/inspector/live-edit-test.js:
(initialize_LiveEditTest.InspectorTest.replaceInSource):
(initialize_LiveEditTest):
* inspector/debugger/live-edit-expected.txt:
* inspector/debugger/live-edit.html:
* inspector/debugger/resources/edit-me-syntax-error.js: Added.
(syntaxError):
* platform/chromium/TestExpectations: re-enabled the test.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@130287 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3095f8be
2012-10-03 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: UISourceCode commitWorkingCopy should not fail when original script had syntax error.
https://bugs.webkit.org/show_bug.cgi?id=97272
Reviewed by Pavel Feldman.
This patch is based on patch by John J. Barton.
* http/tests/inspector/live-edit-test.js:
(initialize_LiveEditTest.InspectorTest.replaceInSource):
(initialize_LiveEditTest):
* inspector/debugger/live-edit-expected.txt:
* inspector/debugger/live-edit.html:
* inspector/debugger/resources/edit-me-syntax-error.js: Added.
(syntaxError):
* platform/chromium/TestExpectations: re-enabled the test.
2012-10-03 Csaba Osztrogonác <ossy@webkit.org>
[Qt] Enable mock scrollbars
......
var initialize_LiveEditTest = function() {
InspectorTest.replaceInSource = function(sourceFrame, string, replacement, callback)
InspectorTest.replaceInSource = function(sourceFrame, string, replacement)
{
sourceFrame._textEditor._mainPanel.setReadOnly(false);
var oldRange, newRange;
......
CONSOLE MESSAGE: line 3: Uncaught SyntaxError: Unexpected token ,
Tests live edit feature.
Debugger was enabled.
......@@ -11,6 +12,15 @@ function f()
==Source frame contents end==
Running: testLiveEditSyntaxError
==Source frame contents start==
function syntaxError()
{
return "I'm good";
}
==Source frame contents end==
Running: testLiveEditWhenPaused
Script execution paused.
Script execution paused.
......
......@@ -4,13 +4,14 @@
<script src="../../http/tests/inspector/debugger-test.js"></script>
<script src="../../http/tests/inspector/live-edit-test.js"></script>
<script src="resources/edit-me.js"></script>
<script src="resources/edit-me-syntax-error.js"></script>
<script src="resources/edit-me-when-paused.js"></script>
<script>
function test()
{
var panel = WebInspector.panels.scripts;
var panel = WebInspector.showPanel("scripts");
InspectorTest.runDebuggerTestSuite([
function testLiveEdit(next)
......@@ -35,6 +36,23 @@ function test()
}
},
function testLiveEditSyntaxError(next)
{
InspectorTest.showScriptSource("edit-me-syntax-error.js", didShowScriptSource);
function didShowScriptSource(sourceFrame)
{
InspectorTest.addSniffer(WebInspector.JavaScriptSourceFrame.prototype, "_didEditContent", didEditScriptSource);
InspectorTest.replaceInSource(sourceFrame, ",\"I'm good\"", "\"I'm good\"");
}
function didEditScriptSource()
{
InspectorTest.dumpSourceFrameContents(panel.visibleView);
next();
}
},
function testLiveEditWhenPaused(next)
{
InspectorTest.showScriptSource("edit-me-when-paused.js", didShowScriptSource);
......
function syntaxError()
{
return ,"I'm good";
}
......@@ -985,11 +985,6 @@ http/tests/inspector/network/network-content-replacement-embed.html [ WontFix ]
webkit.org/b/91435 [ Linux Win ] http/tests/inspector/extensions-ignore-cache.html [ Pass Timeout ]
webkit.org/b/91435 [ Linux ] inspector/timeline/timeline-network-received-data.html [ Failure Pass ]
webkit.org/b/91435 [ Win Release ] inspector/timeline/timeline-network-received-data.html [ Failure Pass ]
webkit.org/b/91435 [ Linux Win Release ] inspector/debugger/live-edit.html [ Failure Pass ]
webkit.org/b/91435 [ Linux Win Debug ] inspector/debugger/live-edit.html [ Failure Pass Slow ]
crbug.com/89357 [ Mac ] http/tests/inspector/extensions-ignore-cache.html [ Skip ]
crbug.com/89357 [ Mac ] inspector/timeline/timeline-network-received-data.html [ Skip ]
crbug.com/89357 [ Mac ] inspector/debugger/live-edit.html [ Skip ]
# Add support for inspector layout tests on Mac.
crbug.com/89357 [ Mac ] inspector
......
2012-10-03 Vsevolod Vlasov <vsevik@chromium.org>
Web Inspector: UISourceCode commitWorkingCopy should not fail when original script had syntax error.
https://bugs.webkit.org/show_bug.cgi?id=97272
Reviewed by Pavel Feldman.
This patch is based on patch by John J. Barton.
* inspector/front-end/JavaScriptSource.js:
(WebInspector.JavaScriptSource.prototype.workingCopyCommitted): added rawLocation null check.
2012-10-03 Alexander Pavlov <apavlov@chromium.org>
Web Inspector: After "Edit as HTML", any click outside box should stop editing
......
......@@ -59,6 +59,10 @@ WebInspector.JavaScriptSource.prototype = {
callback(error);
}
var rawLocation = /** @type {WebInspector.DebuggerModel.Location} */ this.uiLocationToRawLocation(0, 0);
if (!rawLocation) {
callback(null);
return;
}
var script = WebInspector.debuggerModel.scriptForId(rawLocation.scriptId);
WebInspector.debuggerModel.setScriptSource(script.scriptId, this.workingCopy(), innerCallback);
},
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment