Diff
Modified: trunk/LayoutTests/ChangeLog (145535 => 145536)
--- trunk/LayoutTests/ChangeLog 2013-03-12 12:32:37 UTC (rev 145535)
+++ trunk/LayoutTests/ChangeLog 2013-03-12 12:42:14 UTC (rev 145536)
@@ -1,5 +1,28 @@
2013-03-12 Vsevolod Vlasov <vse...@chromium.org>
+ Web Inspector: Add a test for Workspace add/removeMapping methods.
+ https://bugs.webkit.org/show_bug.cgi?id=112035
+
+ Reviewed by Alexander Pavlov.
+
+ * http/tests/inspector/isolated-filesystem-test.js: Added.
+ (initialize_IsolatedFileSystemTest.InspectorTest.createIsolatedFileSystemManager):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.path):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.requestFileContent):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.setFileContent):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystem.prototype.requestFilesRecursive):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager.prototype.addMockFileSystem):
+ (initialize_IsolatedFileSystemTest.MockIsolatedFileSystemManager.prototype.removeMockFileSystem):
+ (initialize_IsolatedFileSystemTest):
+ * inspector/debugger/file-system-project-mapping-expected.txt: Added.
+ * inspector/debugger/file-system-project-mapping.html: Added.
+ * inspector/debugger/resource-script-mapping.html:
+ * inspector/file-system-project.html:
+
+2013-03-12 Vsevolod Vlasov <vse...@chromium.org>
+
Web Inspector: SourceFrames are leaking on reload.
https://bugs.webkit.org/show_bug.cgi?id=111961
Added: trunk/LayoutTests/http/tests/inspector/isolated-filesystem-test.js (0 => 145536)
--- trunk/LayoutTests/http/tests/inspector/isolated-filesystem-test.js (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/isolated-filesystem-test.js 2013-03-12 12:42:14 UTC (rev 145536)
@@ -0,0 +1,63 @@
+var initialize_IsolatedFileSystemTest = function() {
+
+InspectorTest.createIsolatedFileSystemManager = function(workspace, fileSystemMapping)
+{
+ var manager = new MockIsolatedFileSystemManager();
+ manager.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(manager, workspace);
+ manager.fileSystemMapping = fileSystemMapping;
+ return manager;
+}
+
+var MockIsolatedFileSystem = function(path, files)
+{
+ this._path = path;
+ this._files = files;
+};
+MockIsolatedFileSystem.prototype = {
+ path: function()
+ {
+ return this._path;
+ },
+
+ requestFileContent: function(path, callback)
+ {
+ callback(this._files[path]);
+ },
+
+ setFileContent: function(path, newContent, callback)
+ {
+ this._files[path] = newContent;
+ callback();
+ },
+
+ requestFilesRecursive: function(path, callback)
+ {
+ var files = Object.keys(this._files);
+ for (var i = 0; i < files.length; ++i)
+ callback(files[i]);
+ },
+}
+
+var MockIsolatedFileSystemManager = function() {};
+MockIsolatedFileSystemManager.prototype = {
+ addMockFileSystem: function(path, files)
+ {
+ var fileSystem = new MockIsolatedFileSystem(path, files);
+ this._fileSystems = this._fileSystems || {};
+ this._fileSystems[path] = fileSystem;
+ this.fileSystemMapping.addFileSystemMapping(path);
+ this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, fileSystem);
+ },
+
+ removeMockFileSystem: function(path)
+ {
+ var fileSystem = this._fileSystems[path];
+ delete this._fileSystems[path];
+ this.fileSystemMapping.removeFileSystemMapping(path);
+ this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, fileSystem);
+ },
+
+ __proto__: WebInspector.Object.prototype
+}
+
+};
Added: trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt (0 => 145536)
--- trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt (rev 0)
+++ trunk/LayoutTests/inspector/debugger/file-system-project-mapping-expected.txt 2013-03-12 12:42:14 UTC (rev 145536)
@@ -0,0 +1,20 @@
+Tests file system project.
+
+
+Running: testAutomaticMapping
+Adding file system.
+Adding network resource.
+UISourceCode uri to url mappings:
+ filesystem:/var/www/html/foo.js ->
+ filesystem:/var/www/bar.js ->
+Adding mapping between network and file system resources.
+Emulate reloading inspector.
+UISourceCode uri to url mappings:
+ filesystem:/var/www/html/foo.js -> http://localhost/html/foo.js
+ filesystem:/var/www/bar.js -> http://localhost/bar.js
+Removing mapping between network and file system resources.
+Emulate reloading inspector.
+UISourceCode uri to url mappings:
+ filesystem:/var/www/html/foo.js ->
+ filesystem:/var/www/bar.js ->
+
Added: trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html (0 => 145536)
--- trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html (rev 0)
+++ trunk/LayoutTests/inspector/debugger/file-system-project-mapping.html 2013-03-12 12:42:14 UTC (rev 145536)
@@ -0,0 +1,97 @@
+<html>
+<head>
+<script src=""
+<script src=""
+<script src=""
+<script src=""
+<script>
+function test()
+{
+ function dumpUISourceCodes(uiSourceCodes, next)
+ {
+ innerDumpUISourceCodes(uiSourceCodes, 0, next);
+
+ function innerDumpUISourceCodes(uiSourceCodes, startIndex, next)
+ {
+ InspectorTest.addResult("");
+ if (startIndex === uiSourceCodes.length) {
+ next();
+ return;
+ }
+ InspectorTest.dumpUISourceCode(uiSourceCodes[startIndex], innerDumpUISourceCodes.bind(this, uiSourceCodes, startIndex + 1, next));
+ }
+ }
+
+ var manager;
+ var resourceScriptMapping;
+ var defaultScriptMapping;
+ function createObjects()
+ {
+ InspectorTest.createWorkspace();
+ manager = InspectorTest.createIsolatedFileSystemManager(InspectorTest.testWorkspace, InspectorTest.testFileSystemMapping);
+ resourceScriptMapping = new WebInspector.ResourceScriptMapping(InspectorTest.testWorkspace);
+ defaultScriptMapping = new WebInspector.DefaultScriptMapping(InspectorTest.testWorkspace);
+ }
+
+ InspectorTest.runTestSuite([
+ function testAutomaticMapping(next)
+ {
+ function uiSourceCodeAdded(uiSourceCode) { }
+
+ function dumpFileSystemUISourceCodesMappings()
+ {
+ var uiSourceCodes = InspectorTest.testWorkspace.project(fileSystemProjectId).uiSourceCodes();
+ InspectorTest.addResult("UISourceCode uri to url mappings:");
+ for (var i = 0; i < uiSourceCodes.length; ++i)
+ InspectorTest.addResult(" " + uiSourceCodes[i].uri() + " -> " + uiSourceCodes[i].url);
+ }
+
+ var fileSystemPath = "/var/www";
+ var fileSystemProjectId = WebInspector.FileSystemProjectDelegate.projectId(fileSystemPath);
+ var files = {"/html/foo.js": "<foo content>", "/bar.js": "<bar content>"};
+
+ createObjects();
+ InspectorTest.testFileMapping.setMappingEntries([]);
+ InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 4);
+ InspectorTest.addResult("Adding file system.");
+ manager.addMockFileSystem(fileSystemPath, files);
+ InspectorTest.addResult("Adding network resource.");
+ InspectorTest.addMockUISourceCodeToWorkspace("http://localhost/html/foo.js", WebInspector.resourceTypes.Script, "<foo content>");
+ InspectorTest.addMockUISourceCodeToWorkspace("http://localhost/bar.js", WebInspector.resourceTypes.Script, "<foo content>");
+ dumpFileSystemUISourceCodesMappings();
+ var uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(fileSystemProjectId, ["html", "foo.js"]);
+ var networkUISourceCode = InspectorTest.testWorkspace.uiSourceCode("http://localhost", ["html", "foo.js"]);
+ InspectorTest.override(WebInspector, "suggestReload", function() { });
+ InspectorTest.addResult("Adding mapping between network and file system resources.");
+ InspectorTest.testWorkspace.addMapping(networkUISourceCode, uiSourceCode, manager.fileSystemWorkspaceProvider);
+ manager.removeMockFileSystem(fileSystemPath);
+
+ InspectorTest.addResult("Emulate reloading inspector.");
+ createObjects();
+ InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 2);
+ manager.addMockFileSystem(fileSystemPath, files);
+ dumpFileSystemUISourceCodesMappings();
+ InspectorTest.override(WebInspector, "suggestReload", function() { });
+ InspectorTest.addResult("Removing mapping between network and file system resources.");
+ uiSourceCode = InspectorTest.testWorkspace.uiSourceCode(fileSystemProjectId, ["html", "foo.js"]);
+ InspectorTest.testWorkspace.removeMapping(uiSourceCode);
+ manager.removeMockFileSystem(fileSystemPath);
+
+ InspectorTest.addResult("Emulate reloading inspector.");
+ createObjects();
+ InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 2);
+ manager.addMockFileSystem(fileSystemPath, files);
+ dumpFileSystemUISourceCodesMappings();
+ manager.removeMockFileSystem("/var/www");
+
+ InspectorTest.testFileMapping.setMappingEntries([]);
+ next();
+ }
+ ]);
+};
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests file system project.</p>
+</body>
+</html>
Modified: trunk/LayoutTests/inspector/debugger/resource-script-mapping.html (145535 => 145536)
--- trunk/LayoutTests/inspector/debugger/resource-script-mapping.html 2013-03-12 12:32:37 UTC (rev 145535)
+++ trunk/LayoutTests/inspector/debugger/resource-script-mapping.html 2013-03-12 12:42:14 UTC (rev 145536)
@@ -6,7 +6,6 @@
<script>
function test()
{
- var workspace;
var defaultScriptMapping;
function createResourceScriptMapping()
{
Modified: trunk/LayoutTests/inspector/file-system-project.html (145535 => 145536)
--- trunk/LayoutTests/inspector/file-system-project.html 2013-03-12 12:32:37 UTC (rev 145535)
+++ trunk/LayoutTests/inspector/file-system-project.html 2013-03-12 12:42:14 UTC (rev 145536)
@@ -3,75 +3,10 @@
<script src=""
<script src=""
<script src=""
+<script src=""
<script>
function test()
{
- var MockIsolatedFileSystem = function(id, path, files)
- {
- this._id = id;
- this._path = path;
- this._files = files;
- };
- MockIsolatedFileSystem.prototype = {
- id: function()
- {
- return this._id;
- },
-
- path: function()
- {
- return this._path;
- },
-
- requestFileContent: function(path, callback)
- {
- callback(this._files[path]);
- },
-
- setFileContent: function(path, newContent, callback)
- {
- this._files[path] = newContent;
- callback();
- },
-
- requestFilesRecursive: function(path, callback)
- {
- var files = Object.keys(this._files);
- for (var i = 0; i < files.length; ++i)
- callback(files[i]);
- },
- }
-
- var MockIsolatedFileSystemManager = function() {};
- MockIsolatedFileSystemManager.prototype = {
- addMockFileSystem: function(path, files)
- {
- var id = InspectorTest.testFileSystemMapping.addFileSystemMapping(path);
- var fileSystem = new MockIsolatedFileSystem(id, path, files);
- this._fileSystems = this._fileSystems || {};
- this._fileSystems[path] = fileSystem;
- this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, fileSystem);
- },
-
- removeMockFileSystem: function(path)
- {
- var fileSystem = this._fileSystems[path];
- delete this._fileSystems[path];
- InspectorTest.testFileSystemMapping.removeFileSystemMapping(path);
- this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, fileSystem);
- },
-
- __proto__: WebInspector.Object.prototype
- }
-
- function createIsolatedFileSystemManager()
- {
- InspectorTest.createWorkspace();
- var manager = new MockIsolatedFileSystemManager();
- manager.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(manager, InspectorTest.testWorkspace);
- return manager;
- }
-
function dumpUISourceCodes(uiSourceCodes, next)
{
innerDumpUISourceCodes(uiSourceCodes, 0, next);
@@ -90,8 +25,9 @@
InspectorTest.runTestSuite([
function testFileSystems(next)
{
+ InspectorTest.createWorkspace();
+ var manager = InspectorTest.createIsolatedFileSystemManager(InspectorTest.testWorkspace, InspectorTest.testFileSystemMapping);
var uiSourceCodes = [];
- var manager = createIsolatedFileSystemManager();
var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/localhost/");
var entry2 = new WebInspector.FileMapping.Entry("http://www.example.com/", "/foo/bar/");
InspectorTest.testFileMapping.setMappingEntries([entry1, entry2]);
Modified: trunk/Source/WebCore/ChangeLog (145535 => 145536)
--- trunk/Source/WebCore/ChangeLog 2013-03-12 12:32:37 UTC (rev 145535)
+++ trunk/Source/WebCore/ChangeLog 2013-03-12 12:42:14 UTC (rev 145536)
@@ -1,5 +1,23 @@
2013-03-12 Vsevolod Vlasov <vse...@chromium.org>
+ Web Inspector: Add a test for Workspace add/removeMapping methods.
+ https://bugs.webkit.org/show_bug.cgi?id=112035
+
+ Reviewed by Alexander Pavlov.
+
+ Test: inspector/debugger/file-system-project-mapping.html
+
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._mapFileSystemToNetwork.mapFileSystemToNetwork):
+ (WebInspector.ScriptsPanel.prototype._mapFileSystemToNetwork):
+ (WebInspector.ScriptsPanel.prototype._mapNetworkToFileSystem.mapNetworkToFileSystem):
+ (WebInspector.ScriptsPanel.prototype._mapNetworkToFileSystem):
+ * inspector/front-end/Workspace.js:
+ (WebInspector.Project.prototype._fileAdded):
+ (WebInspector.Workspace.prototype.addMapping):
+
+2013-03-12 Vsevolod Vlasov <vse...@chromium.org>
+
Web Inspector: SourceFrames are leaking on reload.
https://bugs.webkit.org/show_bug.cgi?id=111961
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (145535 => 145536)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2013-03-12 12:32:37 UTC (rev 145535)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2013-03-12 12:42:14 UTC (rev 145536)
@@ -1123,7 +1123,7 @@
*/
function mapFileSystemToNetwork(networkUISourceCode)
{
- this._workspace.addMapping(networkUISourceCode, uiSourceCode);
+ this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebInspector.fileSystemWorkspaceProvider);
}
},
@@ -1148,7 +1148,7 @@
*/
function mapNetworkToFileSystem(uiSourceCode)
{
- this._workspace.addMapping(networkUISourceCode, uiSourceCode);
+ this._workspace.addMapping(networkUISourceCode, uiSourceCode, WebInspector.fileSystemWorkspaceProvider);
}
},
Modified: trunk/Source/WebCore/inspector/front-end/Workspace.js (145535 => 145536)
--- trunk/Source/WebCore/inspector/front-end/Workspace.js 2013-03-12 12:32:37 UTC (rev 145535)
+++ trunk/Source/WebCore/inspector/front-end/Workspace.js 2013-03-12 12:42:14 UTC (rev 145536)
@@ -186,6 +186,7 @@
// FIXME: Implement
return;
}
+
uiSourceCode = new WebInspector.UISourceCode(this, fileDescriptor.path, fileDescriptor.originURL, fileDescriptor.url, fileDescriptor.contentType, fileDescriptor.isEditable);
uiSourceCode.isContentScript = fileDescriptor.isContentScript;
this._uiSourceCodes[uiSourceCode.path().join("/")] = uiSourceCode;
@@ -481,8 +482,9 @@
/**
* @param {WebInspector.UISourceCode} networkUISourceCode
* @param {WebInspector.UISourceCode} uiSourceCode
+ * @param {WebInspector.FileSystemWorkspaceProvider} fileSystemWorkspaceProvider
*/
- addMapping: function(networkUISourceCode, uiSourceCode)
+ addMapping: function(networkUISourceCode, uiSourceCode, fileSystemWorkspaceProvider)
{
var url = ""
var path = uiSourceCode.path();
@@ -493,7 +495,7 @@
break;
suffix = nextSuffix;
}
- var fileSystemPath = WebInspector.fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);
+ var fileSystemPath = fileSystemWorkspaceProvider.fileSystemPath(uiSourceCode);
var filePath = "/" + path.join("/");
var pathPrefix = fileSystemPath + filePath.substr(0, filePath.length - suffix.length) + "/";
var urlPrefix = url.substr(0, url.length - suffix.length) + "/";