Diff
Modified: trunk/LayoutTests/ChangeLog (145538 => 145539)
--- trunk/LayoutTests/ChangeLog 2013-03-12 13:02:05 UTC (rev 145538)
+++ trunk/LayoutTests/ChangeLog 2013-03-12 13:10:40 UTC (rev 145539)
@@ -1,5 +1,15 @@
2013-03-12 Vsevolod Vlasov <[email protected]>
+ Web Inspector: ResourceScriptFile diverged state should be correctly reset after debugger reset.
+ https://bugs.webkit.org/show_bug.cgi?id=112036
+
+ Reviewed by Alexander Pavlov.
+
+ * inspector/debugger/file-system-project-mapping-expected.txt:
+ * inspector/debugger/file-system-project-mapping.html:
+
+2013-03-12 Vsevolod Vlasov <[email protected]>
+
Web Inspector: Add a test for Workspace add/removeMapping methods.
https://bugs.webkit.org/show_bug.cgi?id=112035
Modified: trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt (145538 => 145539)
--- trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt 2013-03-12 13:02:05 UTC (rev 145538)
+++ trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt 2013-03-12 13:10:40 UTC (rev 145539)
@@ -1,4 +1,4 @@
-Tests file system project.
+Tests file system project mappings.
Running: testAutomaticMapping
@@ -18,3 +18,19 @@
filesystem:/var/www/html/foo.js ->
filesystem:/var/www/bar.js ->
+Running: testScriptFileOnReloadWithDirtyFile
+Adding file system.
+ - hasDivergedFromVM: false
+Editing uiSourceCode:
+ - hasDivergedFromVM: true
+Committing uiSourceCode with live edit failure:
+ - hasDivergedFromVM: true
+Editing uiSourceCode again:
+ - hasDivergedFromVM: true
+Committing uiSourceCode again (with live edit success now):
+ - hasDivergedFromVM: false
+Reloading page:
+ - hasDivergedFromVM: false
+Editing uiSourceCode again and reloading while it is dirty:
+ - hasDivergedFromVM: true
+
Modified: trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html (145538 => 145539)
--- trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html 2013-03-12 13:02:05 UTC (rev 145538)
+++ trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html 2013-03-12 13:10:40 UTC (rev 145539)
@@ -86,12 +86,77 @@
InspectorTest.testFileMapping.setMappingEntries([]);
next();
+ },
+
+ function testScriptFileOnReloadWithDirtyFile(next)
+ {
+ function uiSourceCodeAdded(uiSourceCode) { }
+
+ function reload()
+ {
+ resourceScriptMapping._debuggerReset();
+ defaultScriptMapping._debuggerReset();
+ script = InspectorTest.createScriptMock("http://localhost/html/foo.js", 0, 0, false, "<foo content>");
+ InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 1);
+ defaultScriptMapping.addScript(script);
+ resourceScriptMapping.addScript(script);
+ }
+
+ var fileSystemPath = "/var/www";
+ var fileSystemProjectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystemPath);
+ var files = {"/html/foo.js": "<foo content>", "/bar.js": "<bar content>"};
+ createObjects();
+ var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/");
+ InspectorTest.testFileMapping.setMappingEntries([entry1]);
+ InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 2);
+ InspectorTest.addResult("Adding file system.");
+ manager.addMockFileSystem(fileSystemPath, files);
+
+ reload();
+
+ var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(fileSystemProjectId, ["html", "foo.js"]);
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+ InspectorTest.addResult("Editing uiSourceCode:");
+ uiSourceCode.setWorkingCopy("<foo content edited>");
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+
+ function setScriptSourceOverrideFailure(scriptId, newContent, callback)
+ {
+ callback("error");
+ }
+ InspectorTest.override(WebInspector.debuggerModel, "setScriptSource", setScriptSourceOverrideFailure);
+ InspectorTest.addResult("Committing uiSourceCode with live edit failure:");
+ uiSourceCode.commitWorkingCopy(function() { });
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+
+ InspectorTest.addResult("Editing uiSourceCode again:");
+ uiSourceCode.setWorkingCopy("<foo content edited again>");
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+
+ function setScriptSourceOverrideSuccess(scriptId, newContent, callback)
+ {
+ callback();
+ }
+ InspectorTest.override(WebInspector.debuggerModel, "setScriptSource", setScriptSourceOverrideSuccess);
+ InspectorTest.addResult("Committing uiSourceCode again (with live edit success now):");
+ uiSourceCode.commitWorkingCopy(function() { });
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+
+ InspectorTest.addResult("Reloading page:");
+ reload();
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+
+ InspectorTest.addResult("Editing uiSourceCode again and reloading while it is dirty:");
+ uiSourceCode.setWorkingCopy("<foo content edited and dirty>");
+ reload();
+ InspectorTest.addResult(" - hasDivergedFromVM: " + !!uiSourceCode.scriptFile().hasDivergedFromVM());
+ next();
}
]);
};
</script>
</head>
<body _onload_="runTest()">
-<p>Tests file system project.</p>
+<p>Tests file system project mappings.</p>
</body>
</html>
Modified: trunk/Source/WebCore/ChangeLog (145538 => 145539)
--- trunk/Source/WebCore/ChangeLog 2013-03-12 13:02:05 UTC (rev 145538)
+++ trunk/Source/WebCore/ChangeLog 2013-03-12 13:10:40 UTC (rev 145539)
@@ -1,3 +1,15 @@
+2013-03-12 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: ResourceScriptFile diverged state should be correctly reset after debugger reset.
+ https://bugs.webkit.org/show_bug.cgi?id=112036
+
+ Reviewed by Alexander Pavlov.
+
+ * inspector/front-end/ResourceScriptMapping.js:
+ (WebInspector.ResourceScriptFile):
+ (WebInspector.ResourceScriptFile.prototype._workingCopyChanged):
+ (WebInspector.ResourceScriptFile.prototype._maybeDirtyChanged):
+
2013-03-12 Marja Hölttä <[email protected]>
[V8] Move the GetRawTemplate and HasInstance logic from generated bindings to V8PerIsolateData
Modified: trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js (145538 => 145539)
--- trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js 2013-03-12 13:02:05 UTC (rev 145538)
+++ trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js 2013-03-12 13:10:40 UTC (rev 145539)
@@ -264,6 +264,7 @@
this._uiSourceCode = uiSourceCode;
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCommitted, this._workingCopyCommitted, this);
this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyChanged, this._workingCopyChanged, this);
+ this._maybeDirtyChanged(false);
}
WebInspector.ResourceScriptFile.prototype = {
@@ -296,6 +297,11 @@
_workingCopyChanged: function(event)
{
var wasDirty = /** @type {boolean} */ (event.data.wasDirty);
+ this._maybeDirtyChanged(wasDirty);
+ },
+
+ _maybeDirtyChanged: function(wasDirty)
+ {
if (!wasDirty && this._uiSourceCode.isDirty() && !this._hasDivergedFromVM) {
this._isDivergingFromVM = true;
this.dispatchEventToListeners(WebInspector.ScriptFile.Events.WillDivergeFromVM, this._uiSourceCode);