Changeset 143448 in webkit
- Timestamp:
- Feb 20, 2013 4:06:43 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r143445 r143448 1 2013-02-19 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Move workspace specific code from FileMapping to workspace. 4 https://bugs.webkit.org/show_bug.cgi?id=110219 5 6 Reviewed by Pavel Feldman. 7 8 * http/tests/inspector/compiler-script-mapping.html: 9 * http/tests/inspector/workspace-test.js: 10 (initialize_WorkspaceTest.InspectorTest.createWorkspace): 11 * inspector/debugger/network-uisourcecode-provider.html: 12 * inspector/file-mapping-expected.txt: 13 * inspector/file-mapping.html: 14 * inspector/file-system-mapping-expected.txt: 15 * inspector/file-system-mapping.html: 16 * inspector/file-system-project.html: 17 * inspector/workspace-mapping-expected.txt: Added. 18 * inspector/workspace-mapping.html: Added. 19 1 20 2013-02-20 Zan Dobersek <zdobersek@igalia.com> 2 21 -
trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html
r142445 r143448 279 279 }; 280 280 script.sourceMapURL = "data:application/json;base64," + btoa(JSON.stringify(sourceMap)); 281 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent( originalUISourceCodeAdded);282 283 function originalUISourceCodeAdded(uiSourceCode)284 { 285 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent( compiledUISourceCodeAdded);286 } 287 288 function compiledUISourceCodeAdded(uiSourceCode) { }281 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUISourceCodeAdded); 282 283 function compiledUISourceCodeAdded(uiSourceCode) 284 { 285 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUISourceCodeAdded); 286 } 287 288 function originalUISourceCodeAdded(uiSourceCode) { } 289 289 290 290 defaultScriptMapping.addScript(script); … … 310 310 WebInspector.settings.sourceMapsEnabled.set(true); 311 311 WebInspector.debuggerModel._reset(); 312 var workspace = new WebInspector.Workspace();313 var networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(workspace, WebInspector.projectTypes.Network);314 var debuggerScriptMapping = new WebInspector.DebuggerScriptMapping(workspace, networkWorkspaceProvider); 315 312 InspectorTest.createWorkspace(); 313 var debuggerScriptMapping = new WebInspector.DebuggerScriptMapping(InspectorTest.testWorkspace, InspectorTest.testNetworkWorkspaceProvider); 314 315 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(compiledUISourceCodeAdded); 316 316 var script = InspectorTest.createScriptMock("compiled.js", 0, 0, true, ""); 317 318 function compiledUISourceCodeAdded(uiSourceCode) 319 { 320 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(originalUISourceCodeAdded); 321 } 322 323 function originalUISourceCodeAdded(uiSourceCode) { } 324 317 325 script.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json_"; 318 326 console.error = function() {}; // Error message is platform dependent. -
trunk/LayoutTests/http/tests/inspector/workspace-test.js
r143327 r143448 1 1 var initialize_WorkspaceTest = function() { 2 2 3 InspectorTest.testWorkspace;4 3 InspectorTest.createWorkspace = function() 5 4 { 6 InspectorTest.testWorkspace = new WebInspector.Workspace(); 5 InspectorTest.testFileMapping = new WebInspector.FileMapping(); 6 InspectorTest.testFileSystemMapping = new WebInspector.FileSystemMappingImpl(); 7 InspectorTest.testFileSystemMapping._fileSystemMappingSetting = new InspectorTest.MockSetting({}); 8 9 InspectorTest.testWorkspace = new WebInspector.Workspace(InspectorTest.testFileMapping, InspectorTest.testFileSystemMapping); 7 10 InspectorTest.testNetworkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(InspectorTest.testWorkspace, WebInspector.projectTypes.Network); 8 11 InspectorTest.testWorkspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, InspectorTest._defaultUISourceCodeProviderEventHandler); -
trunk/LayoutTests/inspector/debugger/network-uisourcecode-provider.html
r142148 r143448 57 57 InspectorTest.createWorkspace(); 58 58 WebInspector.resourceTreeModel = new WebInspector.Object(); 59 var networkUISourceCodeProvider = new WebInspector.NetworkUISourceCodeProvider(InspectorTest.testNetworkWorkspaceProvider );59 var networkUISourceCodeProvider = new WebInspector.NetworkUISourceCodeProvider(InspectorTest.testNetworkWorkspaceProvider, InspectorTest.testWorkspace); 60 60 return networkUISourceCodeProvider; 61 61 } -
trunk/LayoutTests/inspector/file-mapping-expected.txt
r143327 r143448 1 1 Tests FileMapping 2 2 3 uri:/home/example.com 4 uri:/home/example.com/ 5 uri:/var/www/index.html 6 uri:/var/www/foo/index.html 7 https://localhost 8 http://example.com 9 http://www.example.com 10 http://www.example.com/ 11 http://localhost/index.html 12 http://localhost/foo/index.html 13 All mappings were correct. 3 Test mappingEntryForURL 4 http://www.example.com -> null 5 http://www.example.com/ -> /home/example.com/ 6 http://localhost/index.html -> /var/www/ 7 http://localhost/foo/index.html -> /var/www/ 8 https://localhost -> null 9 http://example.com -> null 10 Test mappingEntryForPath 11 /home/example.com -> null 12 /home/example.com/ -> http://www.example.com/ 13 /var/www/index.html -> http://localhost/ 14 /var/www/foo/index.html -> http://localhost/ 14 15 -
trunk/LayoutTests/inspector/file-mapping.html
r143327 r143448 5 5 function test() 6 6 { 7 function MockFileSystemMapping() {}8 MockFileSystemMapping.prototype = {9 uriPrefixForPathPrefix: function(pathPrefix) {10 return "uri:" + pathPrefix;11 }12 };13 14 7 // At first fill file mapping with entries. 15 var fileMapping = new WebInspector.FileMapping( new MockFileSystemMapping());8 var fileMapping = new WebInspector.FileMapping(); 16 9 var mappingEntries = []; 17 mappingEntries.push(new WebInspector.FileMapping.Entry("http://localhost ", "/var/www"));18 mappingEntries.push(new WebInspector.FileMapping.Entry("http://www.example.com ", "/home/example.com"));19 mappingEntries.push(new WebInspector.FileMapping.Entry("http://www.foo.com ", "/bar/"));10 mappingEntries.push(new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/")); 11 mappingEntries.push(new WebInspector.FileMapping.Entry("http://www.example.com/", "/home/example.com/")); 12 mappingEntries.push(new WebInspector.FileMapping.Entry("http://www.foo.com/", "/bar/")); 20 13 fileMapping.setMappingEntries(mappingEntries); 21 14 22 15 // Then create another file mapping to make sure it is correctly restored from the settings. 23 fileMapping = new WebInspector.FileMapping(new MockFileSystemMapping()); 16 fileMapping = new WebInspector.FileMapping(); 17 18 function testPathPrefixForURL(url) 19 { 20 var entry = fileMapping.mappingEntryForURL(url); 21 InspectorTest.addResult(" " + url + " -> " + (entry ? entry.pathPrefix : null)); 22 } 23 24 function testURLPrefixForPath(path) 25 { 26 var entry = fileMapping.mappingEntryForPath(path); 27 InspectorTest.addResult(" " + path + " -> " + (entry ? entry.urlPrefix : null)); 28 } 24 29 25 30 // Now test all FileMapping methods. 26 InspectorTest.assertTrue(fileMapping.hasMappingForURL("http://www.example.com"), "fileMapping.hasMappingForURL failed."); 27 InspectorTest.assertTrue(fileMapping.hasMappingForURL("http://www.example.com/"), "fileMapping.hasMappingForURL failed."); 28 InspectorTest.assertTrue(fileMapping.hasMappingForURL("http://localhost/index.html"), "fileMapping.hasMappingForURL failed."); 29 InspectorTest.assertTrue(fileMapping.hasMappingForURL("http://localhost/foo/index.html"), "fileMapping.hasMappingForURL failed."); 30 InspectorTest.assertTrue(!fileMapping.hasMappingForURL("https://localhost"), "fileMapping.hasMappingForURL failed."); 31 InspectorTest.assertTrue(!fileMapping.hasMappingForURL("http://example.com"), "fileMapping.hasMappingForURL failed."); 31 InspectorTest.addResult("Test mappingEntryForURL"); 32 testPathPrefixForURL("http://www.example.com"); 33 testPathPrefixForURL("http://www.example.com/"); 34 testPathPrefixForURL("http://localhost/index.html"); 35 testPathPrefixForURL("http://localhost/foo/index.html"); 36 testPathPrefixForURL("https://localhost"); 37 testPathPrefixForURL("http://example.com"); 32 38 33 InspectorTest.addResult(fileMapping.uriForURL("http://www.example.com")); 34 InspectorTest.addResult(fileMapping.uriForURL("http://www.example.com/")); 35 InspectorTest.addResult(fileMapping.uriForURL("http://localhost/index.html")); 36 InspectorTest.addResult(fileMapping.uriForURL("http://localhost/foo/index.html")); 37 InspectorTest.addResult(fileMapping.uriForURL("https://localhost")); 38 InspectorTest.addResult(fileMapping.uriForURL("http://example.com")); 39 InspectorTest.addResult("Test mappingEntryForPath"); 40 testURLPrefixForPath("/home/example.com"); 41 testURLPrefixForPath("/home/example.com/"); 42 testURLPrefixForPath("/var/www/index.html"); 43 testURLPrefixForPath("/var/www/foo/index.html"); 39 44 40 InspectorTest.addResult(fileMapping.urlForPath("/home/example.com"));41 InspectorTest.addResult(fileMapping.urlForPath("/home/example.com/"));42 InspectorTest.addResult(fileMapping.urlForPath("/var/www/index.html"));43 InspectorTest.addResult(fileMapping.urlForPath("/var/www/foo/index.html"));44 45 InspectorTest.addResult("All mappings were correct.");46 45 InspectorTest.completeTest(); 47 46 } -
trunk/LayoutTests/inspector/file-system-mapping-expected.txt
r142867 r143448 3 3 Testing file system mapping. 4 4 file system paths: 5 uriPrefixForPathPrefix:5 fileSystemPathForPrefix: 6 6 7 7 Adding file system /home/username/projects/foo … … 9 9 file system paths: 10 10 - /home/username/projects/foo(id = 0@foo) 11 uriPrefixForPathPrefix:12 /home/username/projects/foo => 0@foo/13 /home/username/projects/foo => 0@foo/11 fileSystemPathForPrefix: 12 /home/username/projects/foo => /home/username/projects/foo 13 /home/username/projects/foo => /home/username/projects/foo 14 14 15 15 Adding file system /home/username/projects/bar … … 18 18 - /home/username/projects/foo(id = 0@foo) 19 19 - /home/username/projects/bar(id = 1@bar) 20 uriPrefixForPathPrefix:21 /home/username/projects/foo => 0@foo/22 /home/username/projects/bar => 1@bar/23 /home/username/projects/foo => 0@foo/24 /home/username/projects/bar => 1@bar/20 fileSystemPathForPrefix: 21 /home/username/projects/foo => /home/username/projects/foo 22 /home/username/projects/bar => /home/username/projects/bar 23 /home/username/projects/foo => /home/username/projects/foo 24 /home/username/projects/bar => /home/username/projects/bar 25 25 26 26 Adding file system /www/site1 … … 30 30 - /home/username/projects/bar(id = 1@bar) 31 31 - /www/site1(id = 2@site1) 32 uriPrefixForPathPrefix:33 /home/username/projects/foo => 0@foo/34 /home/username/projects/bar => 1@bar/35 /www/site1 => 2@site1/36 /home/username/projects/foo => 0@foo/37 /home/username/projects/bar => 1@bar/38 /www/site1 => 2@site1/32 fileSystemPathForPrefix: 33 /home/username/projects/foo => /home/username/projects/foo 34 /home/username/projects/bar => /home/username/projects/bar 35 /www/site1 => /www/site1 36 /home/username/projects/foo => /home/username/projects/foo 37 /home/username/projects/bar => /home/username/projects/bar 38 /www/site1 => /www/site1 39 39 40 40 Creating another file system mapping. … … 44 44 - /home/username/projects/bar(id = 1@bar) 45 45 - /www/site1(id = 2@site1) 46 uriPrefixForPathPrefix:47 /home/username/projects/foo => 0@foo/48 /home/username/projects/bar => 1@bar/49 /www/site1 => 2@site1/50 /home/username/projects/foo => 0@foo/51 /home/username/projects/bar => 1@bar/52 /www/site1 => 2@site1/46 fileSystemPathForPrefix: 47 /home/username/projects/foo => /home/username/projects/foo 48 /home/username/projects/bar => /home/username/projects/bar 49 /www/site1 => /www/site1 50 /home/username/projects/foo => /home/username/projects/foo 51 /home/username/projects/bar => /home/username/projects/bar 52 /www/site1 => /www/site1 53 53 54 54 Removing file system /www/site1 … … 57 57 - /home/username/projects/foo(id = 0@foo) 58 58 - /home/username/projects/bar(id = 1@bar) 59 uriPrefixForPathPrefix:60 /home/username/projects/foo => 0@foo/61 /home/username/projects/bar => 1@bar/62 /home/username/projects/foo => 0@foo/63 /home/username/projects/bar => 1@bar/59 fileSystemPathForPrefix: 60 /home/username/projects/foo => /home/username/projects/foo 61 /home/username/projects/bar => /home/username/projects/bar 62 /home/username/projects/foo => /home/username/projects/foo 63 /home/username/projects/bar => /home/username/projects/bar 64 64 65 65 Removing file system /home/username/projects/foo … … 67 67 file system paths: 68 68 - /home/username/projects/bar(id = 1@bar) 69 uriPrefixForPathPrefix:70 /home/username/projects/bar => 1@bar/71 /home/username/projects/bar => 1@bar/69 fileSystemPathForPrefix: 70 /home/username/projects/bar => /home/username/projects/bar 71 /home/username/projects/bar => /home/username/projects/bar 72 72 73 73 Removing file system /home/username/projects/bar 74 74 Testing file system mapping. 75 75 file system paths: 76 uriPrefixForPathPrefix:76 fileSystemPathForPrefix: 77 77 78 78 -
trunk/LayoutTests/inspector/file-system-mapping.html
r142867 r143448 32 32 InspectorTest.addResult(" - " + fileSystemPaths[i] + "(id = " + id + ")"); 33 33 } 34 InspectorTest.addResult(" uriPrefixForPathPrefix:");35 // Call uriPrefixForPathPrefix twice for each path prefix to check caching.34 InspectorTest.addResult(" fileSystemPathForPrefix:"); 35 // Call fileSystemPathForPrefix twice for each path prefix to check caching. 36 36 for (var i = 0; i < 2; ++i) { 37 37 for (pathId in paths) { 38 38 var pathPrefix = paths[pathId]; 39 var uriPrefix = fileSystemMapping.uriPrefixForPathPrefix(pathPrefix + "/");40 if (! uriPrefix)39 var fileSystemPath = fileSystemMapping.fileSystemPathForPrefix(pathPrefix + "/"); 40 if (!fileSystemPath) 41 41 continue; 42 InspectorTest.addResult(" " + pathPrefix + " => " + uriPrefix);42 InspectorTest.addResult(" " + pathPrefix + " => " + fileSystemPath); 43 43 } 44 44 } -
trunk/LayoutTests/inspector/file-system-project.html
r143327 r143448 45 45 addMockFileSystem: function(path, files) 46 46 { 47 var id = this.fileSystemMapping.addFileSystemMapping(path);47 var id = InspectorTest.testFileSystemMapping.addFileSystemMapping(path); 48 48 var fileSystem = new MockIsolatedFileSystem(id, path, files); 49 49 this._fileSystems = this._fileSystems || {}; … … 56 56 var fileSystem = this._fileSystems[path]; 57 57 delete this._fileSystems[path]; 58 InspectorTest.testFileSystemMapping.removeFileSystemMapping(path); 58 59 this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, fileSystem); 59 60 }, … … 66 67 InspectorTest.createWorkspace(); 67 68 var manager = new MockIsolatedFileSystemManager(); 68 manager.fileSystemMapping = new WebInspector.FileSystemMappingImpl(); 69 manager.fileSystemMapping._fileSystemMappingSetting = new InspectorTest.MockSetting({}); 70 InspectorTest.MockSetting 71 manager.fileMapping = new WebInspector.FileMapping(manager.fileSystemMapping); 72 manager.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(manager, InspectorTest.testWorkspace, manager.fileMapping); 69 manager.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(manager, InspectorTest.testWorkspace); 73 70 return manager; 74 71 } … … 96 93 var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/localhost/"); 97 94 var entry2 = new WebInspector.FileMapping.Entry("http://www.example.com/", "/foo/bar/"); 98 manager.fileMapping.setMappingEntries([entry1, entry2]);95 InspectorTest.testFileMapping.setMappingEntries([entry1, entry2]); 99 96 InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 3); 100 97 InspectorTest.addResult("Adding first file system."); … … 124 121 if (!url) 125 122 continue; 126 var uri = manager.fileMapping.uriForURL(url);123 var uri = InspectorTest.testWorkspace.uiSourceCodeForURL(url).uri(); 127 124 InspectorTest.addResult(" " + url + " -> " + uri); 128 125 } -
trunk/Source/WebCore/ChangeLog
r143443 r143448 1 2013-02-19 Vsevolod Vlasov <vsevik@chromium.org> 2 3 Web Inspector: Move workspace specific code from FileMapping to workspace. 4 https://bugs.webkit.org/show_bug.cgi?id=110219 5 6 Reviewed by Pavel Feldman. 7 8 Extracted workspace specific code from FileMapping to Workspace. 9 This allows to reduce usage of uri and eventually make UISourceCode.path an array of path segments. 10 11 Test: inspector/workspace-mapping.html 12 13 * inspector/front-end/CSSStyleModel.js: 14 (WebInspector.CSSStyleModel.prototype.rawLocationToUILocation): 15 * inspector/front-end/CompilerScriptMapping.js: 16 (WebInspector.CompilerScriptMapping.prototype.rawLocationToUILocation): 17 (WebInspector.CompilerScriptMapping.prototype.get addScript.get this): 18 (WebInspector.CompilerScriptMapping.prototype.get addScript): 19 * inspector/front-end/FileMapping.js: 20 (WebInspector.FileMapping): 21 (WebInspector.FileMapping.prototype.mappingEntryForURL): 22 (WebInspector.FileMapping.prototype.mappingEntryForPath): 23 * inspector/front-end/FileSystemMapping.js: 24 (WebInspector.FileSystemMapping.prototype.fileSystemPathForPrefix): 25 (WebInspector.FileSystemMappingImpl.prototype.addFileSystemMapping): 26 (WebInspector.FileSystemMappingImpl.prototype.removeFileSystemMapping): 27 (WebInspector.FileSystemMappingImpl.prototype.fileSystemPathForPrefix): 28 * inspector/front-end/FileSystemProjectDelegate.js: 29 (WebInspector.FileSystemProjectDelegate): 30 (WebInspector.FileSystemProjectDelegate.prototype.populate.filesLoaded): 31 (WebInspector.FileSystemProjectDelegate.prototype.populate): 32 (WebInspector.FileSystemWorkspaceProvider): 33 (WebInspector.FileSystemWorkspaceProvider.prototype._fileSystemAdded): 34 * inspector/front-end/IsolatedFileSystemManager.js: 35 (WebInspector.IsolatedFileSystemManager): 36 * inspector/front-end/NetworkUISourceCodeProvider.js: 37 (WebInspector.NetworkUISourceCodeProvider): 38 (WebInspector.NetworkUISourceCodeProvider.prototype._addFile): 39 * inspector/front-end/ResourceScriptMapping.js: 40 (WebInspector.ResourceScriptMapping.prototype._workspaceUISourceCodeForScript): 41 * inspector/front-end/ResourceUtils.js: 42 (WebInspector.displayNameForURL): 43 * inspector/front-end/SASSSourceMapping.js: 44 (WebInspector.SASSSourceMapping.prototype._reloadCSS): 45 (WebInspector.SASSSourceMapping.prototype._bindUISourceCode): 46 (WebInspector.SASSSourceMapping.prototype.rawLocationToUILocation): 47 * inspector/front-end/ScriptsPanel.js: 48 (WebInspector.ScriptsPanel.prototype.canShowAnchorLocation): 49 * inspector/front-end/SimpleWorkspaceProvider.js: 50 (WebInspector.SimpleWorkspaceProvider.pathForSplittedURL): 51 (WebInspector.SimpleWorkspaceProvider.prototype._innerAddFileForURL): 52 * inspector/front-end/StylesSourceMapping.js: 53 (WebInspector.StylesSourceMapping.prototype.rawLocationToUILocation): 54 (WebInspector.StylesSourceMapping.prototype._resourceAdded): 55 (WebInspector.StylesSourceMapping.prototype._mainFrameCreatedOrNavigated): 56 (WebInspector.StyleContentBinding): 57 (WebInspector.StyleContentBinding.prototype._innerStyleSheetChanged): 58 * inspector/front-end/Workspace.js: 59 (WebInspector.Workspace): 60 (WebInspector.Workspace.prototype.hasMappingForURL): 61 (WebInspector.Workspace.prototype._fileSystemPathForEntry): 62 (WebInspector.Workspace.prototype.uiSourceCodeForURL): 63 (WebInspector.Workspace.prototype.urlForPath): 64 * inspector/front-end/inspector.js: 65 1 66 2013-02-20 Alexander Pavlov <apavlov@chromium.org> 2 67 -
trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js
r143333 r143448 549 549 return uiLocation; 550 550 } 551 var uri = WebInspector.fileMapping.uriForURL(rawLocation.url); 552 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 551 var uiSourceCode = this._workspace.uiSourceCodeForURL(rawLocation.url); 553 552 if (!uiSourceCode) 554 553 return null; -
trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js
r142445 r143448 65 65 return null; 66 66 var url = entry[2]; 67 var uri = WebInspector.fileMapping.uriForURL(url); 68 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 67 var uiSourceCode = this._workspace.uiSourceCodeForURL(url); 69 68 if (!uiSourceCode) 70 69 return null; … … 110 109 for (var i = 0; i < sourceURLs.length; ++i) { 111 110 var sourceURL = sourceURLs[i]; 112 var uri = WebInspector.fileMapping.uriForURL(sourceURL);113 111 if (this._sourceMapForURL[sourceURL]) 114 112 continue; 115 113 this._sourceMapForURL[sourceURL] = sourceMap; 116 if (! WebInspector.fileMapping.hasMappingForURL(sourceURL) && !this._workspace.uiSourceCodeForURI(uri)) {114 if (!this._workspace.hasMappingForURL(sourceURL) && !this._workspace.uiSourceCodeForURL(sourceURL)) { 117 115 var sourceContent = sourceMap.sourceContent(sourceURL); 118 116 var contentProvider; … … 123 121 this._networkWorkspaceProvider.addFileForURL(sourceURL, contentProvider, true); 124 122 } 125 var uiSourceCode = this._workspace.uiSourceCodeForUR I(uri);123 var uiSourceCode = this._workspace.uiSourceCodeForURL(sourceURL); 126 124 if (uiSourceCode) { 127 this._bindUISourceCode( this._workspace.uiSourceCodeForURI(uri));125 this._bindUISourceCode(uiSourceCode); 128 126 uiSourceCode.isContentScript = script.isContentScript; 129 127 } -
trunk/Source/WebCore/inspector/front-end/FileMapping.js
r143327 r143448 31 31 /** 32 32 * @constructor 33 * @param {WebInspector.FileSystemMapping} fileSystemMapping34 33 */ 35 WebInspector.FileMapping = function( fileSystemMapping)34 WebInspector.FileMapping = function() 36 35 { 37 this._fileSystemMapping = fileSystemMapping;38 36 this._mappingEntriesSetting = WebInspector.settings.createSetting("fileMappingEntries", []); 39 37 /** @type {Array.<WebInspector.FileMapping.Entry>} */ … … 44 42 WebInspector.FileMapping.prototype = { 45 43 /** 46 * @param {WebInspector.FileMapping.Entry} entry47 44 * @param {string} url 48 * @return { boolean}45 * @return {?WebInspector.FileMapping.Entry} 49 46 */ 50 _entryMatchesURL: function(entry, url) 51 { 52 return url.startsWith(entry.urlPrefix); 53 }, 54 55 /** 56 * @param {WebInspector.FileMapping.Entry} entry 57 * @return {?string} 58 */ 59 _entryURIPrefix: function(entry) 60 { 61 return this._fileSystemMapping.uriPrefixForPathPrefix(entry.pathPrefix); 62 }, 63 64 /** 65 * @param {string} url 66 * @return {boolean} 67 */ 68 hasMappingForURL: function(url) 69 { 70 return !!this._innerURIForURL(url); 71 }, 72 73 /** 74 * @param {string} url 75 * @return {?string} 76 */ 77 _innerURIForURL: function(url) 47 mappingEntryForURL: function(url) 78 48 { 79 49 for (var i = 0; i < this._entries.length; ++i) { 80 50 var entry = this._entries[i]; 81 var uriPrefix = this._entryURIPrefix(entry); 82 if (uriPrefix && this._entryMatchesURL(entry, url)) 83 return uriPrefix + url.substring(entry.urlPrefix.length); 51 if (url.startsWith(entry.urlPrefix)) 52 return entry; 84 53 } 85 54 return null; 86 55 }, 87 88 /** 89 * @param {string} url 90 * @return {string} 91 */ 92 uriForURL: function(url) 93 { 94 return this._innerURIForURL(url) || WebInspector.SimpleWorkspaceProvider.uriForURL(url, WebInspector.projectTypes.Network); 95 }, 96 56 97 57 /** 98 58 * @param {string} path 99 * @return { string}59 * @return {?WebInspector.FileMapping.Entry} 100 60 */ 101 urlForPath: function(path)61 mappingEntryForPath: function(path) 102 62 { 103 63 for (var i = 0; i < this._entries.length; ++i) { 104 64 var entry = this._entries[i]; 105 65 if (path.startsWith(entry.pathPrefix)) 106 return entry .urlPrefix + path.substring(entry.pathPrefix.length);66 return entry; 107 67 } 108 return "";68 return null; 109 69 }, 110 70 -
trunk/Source/WebCore/inspector/front-end/FileSystemMapping.js
r142867 r143448 41 41 42 42 /** 43 * @param {string} p athPrefix43 * @param {string} prefix 44 44 * @return {?string} 45 45 */ 46 uriPrefixForPathPrefix: function(pathPrefix) { },46 fileSystemPathForPrefix: function(prefix) { } 47 47 } 48 48 … … 120 120 this._fileSystemPaths[id] = fileSystemPath; 121 121 this._saveToSettings(); 122 delete this._cached URIPrefixes;122 delete this._cachedFileSystemPaths; 123 123 return id; 124 124 }, … … 136 136 delete this._fileSystemPaths[id]; 137 137 this._saveToSettings(); 138 delete this._cached URIPrefixes;138 delete this._cachedFileSystemPaths; 139 139 }, 140 140 … … 148 148 149 149 /** 150 * @param {string} p athPrefix150 * @param {string} prefix 151 151 * @return {?string} 152 152 */ 153 uriPrefixForPathPrefix: function(pathPrefix)153 fileSystemPathForPrefix: function(prefix) 154 154 { 155 this._cached URIPrefixes = this._cachedURIPrefixes || {};156 if (this._cached URIPrefixes.hasOwnProperty(pathPrefix))157 return this._cached URIPrefixes[pathPrefix];158 var uriPrefix= null;155 this._cachedFileSystemPaths = this._cachedFileSystemPaths || {}; 156 if (this._cachedFileSystemPaths.hasOwnProperty(prefix)) 157 return this._cachedFileSystemPaths[prefix]; 158 var result = null; 159 159 for (var id in this._fileSystemPaths) { 160 160 var fileSystemPath = this._fileSystemPaths[id]; 161 if (p athPrefix.startsWith(fileSystemPath + "/")) {162 uriPrefix = id + pathPrefix.substr(fileSystemPath.length);161 if (prefix.startsWith(fileSystemPath + "/")) { 162 result = fileSystemPath; 163 163 break; 164 164 } 165 165 } 166 this._cached URIPrefixes[pathPrefix] = uriPrefix;167 return uriPrefix;166 this._cachedFileSystemPaths[prefix] = result; 167 return result; 168 168 }, 169 169 -
trunk/Source/WebCore/inspector/front-end/FileSystemProjectDelegate.js
r143327 r143448 34 34 * @extends {WebInspector.Object} 35 35 * @param {WebInspector.IsolatedFileSystem} isolatedFileSystem 36 * @param {WebInspector. FileMapping} fileMapping37 */ 38 WebInspector.FileSystemProjectDelegate = function(isolatedFileSystem, fileMapping)36 * @param {WebInspector.Workspace} workspace 37 */ 38 WebInspector.FileSystemProjectDelegate = function(isolatedFileSystem, workspace) 39 39 { 40 40 this._fileSystem = isolatedFileSystem; 41 this._ fileMapping = fileMapping;41 this._workspace = workspace; 42 42 } 43 43 … … 164 164 var fullPath = this._fileSystem.path() + files[i]; 165 165 var path = files[i].substr(1); 166 var url = this._ fileMapping.urlForPath(fullPath);166 var url = this._workspace.urlForPath(fullPath); 167 167 var contentType = this._contentTypeForPath(path); 168 168 var fileDescriptor = new WebInspector.FileDescriptor(path, "file://" + fullPath, url, contentType, true); … … 203 203 /** 204 204 * @constructor 205 * @implements {WebInspector.ProjectDelegate}206 205 * @param {WebInspector.IsolatedFileSystemManager} isolatedFileSystemManager 207 206 * @param {WebInspector.Workspace} workspace 208 * @param {WebInspector.FileMapping} fileMapping 209 */ 210 WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemManager, workspace, fileMapping) 207 */ 208 WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemManager, workspace) 211 209 { 212 210 this._isolatedFileSystemManager = isolatedFileSystemManager; 213 211 this._workspace = workspace; 214 this._fileMapping = fileMapping;215 212 this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this); 216 213 this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this); … … 219 216 WebInspector.FileSystemWorkspaceProvider.prototype = { 220 217 /** 221 * @param {WebInspector. event} event218 * @param {WebInspector.Event} event 222 219 */ 223 220 _fileSystemAdded: function(event) … … 225 222 var fileSystem = /** @type {WebInspector.IsolatedFileSystem} */ (event.data); 226 223 console.assert(!this._workspace.project(fileSystem.id())); 227 var projectDelegate = new WebInspector.FileSystemProjectDelegate(fileSystem, this._ fileMapping)224 var projectDelegate = new WebInspector.FileSystemProjectDelegate(fileSystem, this._workspace) 228 225 this._workspace.addProject(projectDelegate); 229 226 projectDelegate.populate(); … … 231 228 232 229 /** 233 * @param {WebInspector. event} event230 * @param {WebInspector.Event} event 234 231 */ 235 232 _fileSystemRemoved: function(event) -
trunk/Source/WebCore/inspector/front-end/IsolatedFileSystemManager.js
r143327 r143448 35 35 WebInspector.IsolatedFileSystemManager = function() 36 36 { 37 /** @type {!Object.<string, WebInspector.IsolatedFileSystem Manager.FileSystem>} */37 /** @type {!Object.<string, WebInspector.IsolatedFileSystem>} */ 38 38 this._fileSystems = {}; 39 39 /** @type {Object.<string, Array.<function(DOMFileSystem)>>} */ -
trunk/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js
r142148 r143448 32 32 * @constructor 33 33 * @param {WebInspector.SimpleWorkspaceProvider} networkWorkspaceProvider 34 * @param {WebInspector.Workspace} workspace 34 35 */ 35 WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceProvider )36 WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceProvider, workspace) 36 37 { 37 38 this._networkWorkspaceProvider = networkWorkspaceProvider; 39 this._workspace = workspace; 38 40 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this); 39 41 WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this); … … 113 115 _addFile: function(url, contentProvider, isContentScript) 114 116 { 115 if ( WebInspector.fileMapping.hasMappingForURL(url))117 if (this._workspace.hasMappingForURL(url)) 116 118 return; 117 119 -
trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js
r139885 r143448 139 139 if (!script.isInlineScript() && this._inlineScriptsForSourceURL[script.sourceURL]) 140 140 return null; 141 var uri = WebInspector.fileMapping.uriForURL(script.sourceURL); 142 return this._workspace.uiSourceCodeForURI(uri); 141 return this._workspace.uiSourceCodeForURL(script.sourceURL); 143 142 }, 144 143 -
trunk/Source/WebCore/inspector/front-end/ResourceUtils.js
r142871 r143448 59 59 return resource.displayName; 60 60 61 var uri = WebInspector.fileMapping.uriForURL(url); 62 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURI(uri); 61 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url); 63 62 if (uiSourceCode) 64 63 return uiSourceCode.parsedURL.displayName; -
trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js
r143333 r143448 118 118 _reloadCSS: function(url) 119 119 { 120 var uri = WebInspector.fileMapping.uriForURL(url); 121 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 120 var uiSourceCode = this._workspace.uiSourceCodeForURL(url); 122 121 if (!uiSourceCode) 123 122 return; … … 231 230 for (var i = 0; i < sources.length; ++i) { 232 231 var url = sources[i]; 233 var uri = WebInspector.fileMapping.uriForURL(url); 234 if (!WebInspector.fileMapping.hasMappingForURL(url) && !this._workspace.uiSourceCodeForURI(uri)) { 232 if (!this._workspace.hasMappingForURL(url) && !this._workspace.uiSourceCodeForURL(url)) { 235 233 var content = InspectorFrontendHost.loadResourceSynchronously(url); 236 234 var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss"); … … 252 250 var location = /** @type WebInspector.CSSLocation */ (rawLocation); 253 251 var entry; 254 var uiSourceCode;255 252 var sourceMap = this._sourceMapByStyleSheetURL[location.url]; 256 253 if (!sourceMap) … … 259 256 if (!entry || entry.length === 2) 260 257 return null; 261 var uri = WebInspector.fileMapping.uriForURL(entry[2]); 262 uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 258 var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]); 263 259 if (!uiSourceCode) 264 260 return null; -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r143227 r143448 373 373 if (WebInspector.debuggerModel.debuggerEnabled() && anchor.uiSourceCode) 374 374 return true; 375 var uri = WebInspector.fileMapping.uriForURL(anchor.href); 376 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 375 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(anchor.href); 377 376 if (uiSourceCode) { 378 377 anchor.uiSourceCode = uiSourceCode; -
trunk/Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js
r143202 r143448 214 214 * @return {string} 215 215 */ 216 WebInspector.SimpleWorkspaceProvider. _pathForSplittedURL = function(splittedURL)216 WebInspector.SimpleWorkspaceProvider.pathForSplittedURL = function(splittedURL) 217 217 { 218 218 splittedURL.shift(); 219 219 return splittedURL.join("/"); 220 220 } 221 222 /**223 * @param {string} url224 * @param {string} type225 * @return {string}226 */227 WebInspector.SimpleWorkspaceProvider.uriForURL = function(url, type)228 {229 var splittedURL = WebInspector.SimpleWorkspaceProvider.splitURL(url);230 var projectId = WebInspector.SimpleProjectDelegate.projectId(splittedURL[0], type);231 var path = WebInspector.SimpleWorkspaceProvider._pathForSplittedURL(splittedURL);232 return WebInspector.UISourceCode.uri(projectId, path);233 }234 221 235 222 WebInspector.SimpleWorkspaceProvider.prototype = { … … 284 271 var splittedURL = WebInspector.SimpleWorkspaceProvider.splitURL(url); 285 272 var projectName = splittedURL[0]; 286 var path = WebInspector.SimpleWorkspaceProvider. _pathForSplittedURL(splittedURL);273 var path = WebInspector.SimpleWorkspaceProvider.pathForSplittedURL(splittedURL); 287 274 return this._innerAddFile(projectName, path, url, contentProvider, isEditable, forceUnique, isContentScript); 288 275 }, -
trunk/Source/WebCore/inspector/front-end/StylesSourceMapping.js
r143333 r143448 55 55 { 56 56 var location = /** @type WebInspector.CSSLocation */ (rawLocation); 57 var uri = WebInspector.fileMapping.uriForURL(location.url); 58 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 57 var uiSourceCode = this._workspace.uiSourceCodeForURL(location.url); 59 58 return new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0); 60 59 }, … … 78 77 if (!resource.url) 79 78 return; 80 var uri = WebInspector.fileMapping.uriForURL(resource.url); 81 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 79 var uiSourceCode = this._workspace.uiSourceCodeForURL(resource.url); 82 80 if (!uiSourceCode) 83 81 return; … … 126 124 { 127 125 for (var mappedURL in this._mappedURLs) { 128 var uri = WebInspector.fileMapping.uriForURL(mappedURL); 129 var uiSourceCode = this._workspace.uiSourceCodeForURI(uri); 126 var uiSourceCode = this._workspace.uiSourceCodeForURL(mappedURL); 130 127 if (!uiSourceCode) 131 128 continue; … … 215 212 } 216 213 217 218 214 /** 219 215 * @constructor 220 216 * @param {WebInspector.CSSStyleModel} cssModel 221 217 */ 222 WebInspector.StyleContentBinding = function(cssModel )218 WebInspector.StyleContentBinding = function(cssModel, workspace) 223 219 { 224 220 this._cssModel = cssModel; 221 this._workspace = workspace; 225 222 this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this); 226 223 } … … 311 308 return; 312 309 313 var uri = WebInspector.fileMapping.uriForURL(styleSheetURL); 314 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURI(uri); 310 var uiSourceCode = this._workspace.uiSourceCodeForURL(styleSheetURL); 315 311 if (!uiSourceCode) 316 312 return; -
trunk/Source/WebCore/inspector/front-end/Workspace.js
r143202 r143448 308 308 * @implements {WebInspector.UISourceCodeProvider} 309 309 * @extends {WebInspector.Object} 310 */ 311 WebInspector.Workspace = function() 310 * @param {WebInspector.FileMapping} fileMapping 311 * @param {WebInspector.FileSystemMapping} fileSystemMapping 312 */ 313 WebInspector.Workspace = function(fileMapping, fileSystemMapping) 312 314 { 315 this._fileMapping = fileMapping; 316 this._fileSystemMapping = fileSystemMapping; 313 317 /** @type {!Object.<string, WebInspector.Project>} */ 314 318 this._projects = {}; … … 444 448 }, 445 449 450 /** 451 * @param {string} url 452 * @return {boolean} 453 */ 454 hasMappingForURL: function(url) 455 { 456 var entry = this._fileMapping.mappingEntryForURL(url); 457 if (!entry) 458 return false; 459 return !!this._fileSystemPathForEntry(entry); 460 }, 461 462 /** 463 * @param {WebInspector.FileMapping.Entry} entry 464 * @return {?string} 465 */ 466 _fileSystemPathForEntry: function(entry) 467 { 468 return this._fileSystemMapping.fileSystemPathForPrefix(entry.pathPrefix); 469 }, 470 /** 471 * @param {string} url 472 * @return {WebInspector.UISourceCode} 473 */ 474 uiSourceCodeForURL: function(url) 475 { 476 var entry = this._fileMapping.mappingEntryForURL(url); 477 var fileSystemPath = entry ? this._fileSystemPathForEntry(entry) : null; 478 if (!fileSystemPath) { 479 var splittedURL = WebInspector.SimpleWorkspaceProvider.splitURL(url); 480 var projectId = WebInspector.SimpleProjectDelegate.projectId(splittedURL[0], WebInspector.projectTypes.Network); 481 var path = WebInspector.SimpleWorkspaceProvider.pathForSplittedURL(splittedURL); 482 var project = this.project(projectId); 483 return project ? project.uiSourceCode(path) : null; 484 } 485 486 var projectId = this._fileSystemMapping.fileSystemId(fileSystemPath); 487 var pathPrefix = entry.pathPrefix.substr(fileSystemPath.length + 1); 488 var path = pathPrefix + url.substr(entry.urlPrefix.length); 489 var project = this.project(projectId); 490 return project ? project.uiSourceCode(path) : null; 491 }, 492 493 /** 494 * @param {string} path 495 * @return {string} 496 */ 497 urlForPath: function(path) 498 { 499 var entry = this._fileMapping.mappingEntryForPath(path); 500 if (!entry) 501 return ""; 502 return entry.urlPrefix + path.substring(entry.pathPrefix.length); 503 }, 504 446 505 __proto__: WebInspector.Object.prototype 447 506 } -
trunk/Source/WebCore/inspector/front-end/inspector.js
r143327 r143448 416 416 InspectorBackend.registerInspectorDispatcher(this); 417 417 418 this.workspace = new WebInspector.Workspace(); 418 this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager(); 419 this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispatcher(this.isolatedFileSystemManager); 420 this.fileMapping = new WebInspector.FileMapping(); 421 this.workspace = new WebInspector.Workspace(this.fileMapping, this.isolatedFileSystemManager.mapping()); 419 422 420 423 this.cssModel = new WebInspector.CSSStyleModel(this.workspace); … … 439 442 this.workspaceController = new WebInspector.WorkspaceController(this.workspace); 440 443 441 this.isolatedFileSystemManager = new WebInspector.IsolatedFileSystemManager(); 442 this.isolatedFileSystemDispatcher = new WebInspector.IsolatedFileSystemDispatcher(this.isolatedFileSystemManager); 443 this.fileMapping = new WebInspector.FileMapping(this.isolatedFileSystemManager.mapping()); 444 this.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(this.isolatedFileSystemManager, this.workspace, this.fileMapping); 444 this.fileSystemWorkspaceProvider = new WebInspector.FileSystemWorkspaceProvider(this.isolatedFileSystemManager, this.workspace); 445 445 446 446 this.networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(this.workspace, WebInspector.projectTypes.Network); 447 new WebInspector.NetworkUISourceCodeProvider(this.networkWorkspaceProvider );447 new WebInspector.NetworkUISourceCodeProvider(this.networkWorkspaceProvider, this.workspace); 448 448 449 449 this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel, this.workspace); … … 453 453 new WebInspector.DebuggerScriptMapping(this.workspace, this.networkWorkspaceProvider); 454 454 this.liveEditSupport = new WebInspector.LiveEditSupport(this.workspace); 455 this.styleContentBinding = new WebInspector.StyleContentBinding(this.cssModel );455 this.styleContentBinding = new WebInspector.StyleContentBinding(this.cssModel, this.workspace); 456 456 new WebInspector.StylesSourceMapping(this.cssModel, this.workspace); 457 457 if (WebInspector.experimentsSettings.sass.isEnabled())
Note: See TracChangeset
for help on using the changeset viewer.