Changeset 143448 in webkit


Ignore:
Timestamp:
Feb 20, 2013 4:06:43 AM (11 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: Move workspace specific code from FileMapping to workspace.
https://bugs.webkit.org/show_bug.cgi?id=110219

Reviewed by Pavel Feldman.

Source/WebCore:

Extracted workspace specific code from FileMapping to Workspace.
This allows to reduce usage of uri and eventually make UISourceCode.path an array of path segments.

Test: inspector/workspace-mapping.html

  • inspector/front-end/CSSStyleModel.js:

(WebInspector.CSSStyleModel.prototype.rawLocationToUILocation):

  • inspector/front-end/CompilerScriptMapping.js:

(WebInspector.CompilerScriptMapping.prototype.rawLocationToUILocation):
(WebInspector.CompilerScriptMapping.prototype.get addScript.get this):
(WebInspector.CompilerScriptMapping.prototype.get addScript):

  • inspector/front-end/FileMapping.js:

(WebInspector.FileMapping):
(WebInspector.FileMapping.prototype.mappingEntryForURL):
(WebInspector.FileMapping.prototype.mappingEntryForPath):

  • inspector/front-end/FileSystemMapping.js:

(WebInspector.FileSystemMapping.prototype.fileSystemPathForPrefix):
(WebInspector.FileSystemMappingImpl.prototype.addFileSystemMapping):
(WebInspector.FileSystemMappingImpl.prototype.removeFileSystemMapping):
(WebInspector.FileSystemMappingImpl.prototype.fileSystemPathForPrefix):

  • inspector/front-end/FileSystemProjectDelegate.js:

(WebInspector.FileSystemProjectDelegate):
(WebInspector.FileSystemProjectDelegate.prototype.populate.filesLoaded):
(WebInspector.FileSystemProjectDelegate.prototype.populate):
(WebInspector.FileSystemWorkspaceProvider):
(WebInspector.FileSystemWorkspaceProvider.prototype._fileSystemAdded):

  • inspector/front-end/IsolatedFileSystemManager.js:

(WebInspector.IsolatedFileSystemManager):

  • inspector/front-end/NetworkUISourceCodeProvider.js:

(WebInspector.NetworkUISourceCodeProvider):
(WebInspector.NetworkUISourceCodeProvider.prototype._addFile):

  • inspector/front-end/ResourceScriptMapping.js:

(WebInspector.ResourceScriptMapping.prototype._workspaceUISourceCodeForScript):

  • inspector/front-end/ResourceUtils.js:

(WebInspector.displayNameForURL):

  • inspector/front-end/SASSSourceMapping.js:

(WebInspector.SASSSourceMapping.prototype._reloadCSS):
(WebInspector.SASSSourceMapping.prototype._bindUISourceCode):
(WebInspector.SASSSourceMapping.prototype.rawLocationToUILocation):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype.canShowAnchorLocation):

  • inspector/front-end/SimpleWorkspaceProvider.js:

(WebInspector.SimpleWorkspaceProvider.pathForSplittedURL):
(WebInspector.SimpleWorkspaceProvider.prototype._innerAddFileForURL):

  • inspector/front-end/StylesSourceMapping.js:

(WebInspector.StylesSourceMapping.prototype.rawLocationToUILocation):
(WebInspector.StylesSourceMapping.prototype._resourceAdded):
(WebInspector.StylesSourceMapping.prototype._mainFrameCreatedOrNavigated):
(WebInspector.StyleContentBinding):
(WebInspector.StyleContentBinding.prototype._innerStyleSheetChanged):

  • inspector/front-end/Workspace.js:

(WebInspector.Workspace):
(WebInspector.Workspace.prototype.hasMappingForURL):
(WebInspector.Workspace.prototype._fileSystemPathForEntry):
(WebInspector.Workspace.prototype.uiSourceCodeForURL):
(WebInspector.Workspace.prototype.urlForPath):

  • inspector/front-end/inspector.js:

LayoutTests:

  • http/tests/inspector/compiler-script-mapping.html:
  • http/tests/inspector/workspace-test.js:

(initialize_WorkspaceTest.InspectorTest.createWorkspace):

  • inspector/debugger/network-uisourcecode-provider.html:
  • inspector/file-mapping-expected.txt:
  • inspector/file-mapping.html:
  • inspector/file-system-mapping-expected.txt:
  • inspector/file-system-mapping.html:
  • inspector/file-system-project.html:
  • inspector/workspace-mapping-expected.txt: Added.
  • inspector/workspace-mapping.html: Added.
Location:
trunk
Files:
2 added
25 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143445 r143448  
     12013-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
    1202013-02-20  Zan Dobersek  <zdobersek@igalia.com>
    221
  • trunk/LayoutTests/http/tests/inspector/compiler-script-mapping.html

    r142445 r143448  
    279279            };
    280280            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) { }
    289289           
    290290            defaultScriptMapping.addScript(script);
     
    310310            WebInspector.settings.sourceMapsEnabled.set(true);
    311311            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);
    316316            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
    317325            script.sourceMapURL = "http://localhost:8000/inspector/resources/source-map.json_";
    318326            console.error = function() {}; // Error message is platform dependent.
  • trunk/LayoutTests/http/tests/inspector/workspace-test.js

    r143327 r143448  
    11var initialize_WorkspaceTest = function() {
    22
    3 InspectorTest.testWorkspace;
    43InspectorTest.createWorkspace = function()
    54{
    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);
    710    InspectorTest.testNetworkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(InspectorTest.testWorkspace, WebInspector.projectTypes.Network);
    811    InspectorTest.testWorkspace.addEventListener(WebInspector.UISourceCodeProvider.Events.UISourceCodeAdded, InspectorTest._defaultUISourceCodeProviderEventHandler);
  • trunk/LayoutTests/inspector/debugger/network-uisourcecode-provider.html

    r142148 r143448  
    5757        InspectorTest.createWorkspace();
    5858        WebInspector.resourceTreeModel = new WebInspector.Object();
    59         var networkUISourceCodeProvider = new WebInspector.NetworkUISourceCodeProvider(InspectorTest.testNetworkWorkspaceProvider);
     59        var networkUISourceCodeProvider = new WebInspector.NetworkUISourceCodeProvider(InspectorTest.testNetworkWorkspaceProvider, InspectorTest.testWorkspace);
    6060        return networkUISourceCodeProvider;
    6161    }
  • trunk/LayoutTests/inspector/file-mapping-expected.txt

    r143327 r143448  
    11Tests FileMapping
    22
    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.
     3Test 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
     10Test 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/
    1415
  • trunk/LayoutTests/inspector/file-mapping.html

    r143327 r143448  
    55function test()
    66{
    7     function MockFileSystemMapping() {}
    8     MockFileSystemMapping.prototype = {
    9         uriPrefixForPathPrefix: function(pathPrefix) {
    10             return "uri:" + pathPrefix;
    11         }
    12     };
    13 
    147    // At first fill file mapping with entries.
    15     var fileMapping = new WebInspector.FileMapping(new MockFileSystemMapping());
     8    var fileMapping = new WebInspector.FileMapping();
    169    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/"));
    2013    fileMapping.setMappingEntries(mappingEntries);
    2114
    2215    // 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    }
    2429
    2530    // 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");
    3238
    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");
    3944
    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.");
    4645    InspectorTest.completeTest();
    4746}
  • trunk/LayoutTests/inspector/file-system-mapping-expected.txt

    r142867 r143448  
    33Testing file system mapping.
    44    file system paths:
    5     uriPrefixForPathPrefix:
     5    fileSystemPathForPrefix:
    66
    77Adding file system /home/username/projects/foo
     
    99    file system paths:
    1010     - /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
    1414
    1515Adding file system /home/username/projects/bar
     
    1818     - /home/username/projects/foo(id = 0@foo)
    1919     - /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
    2525
    2626Adding file system /www/site1
     
    3030     - /home/username/projects/bar(id = 1@bar)
    3131     - /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
    3939
    4040Creating another file system mapping.
     
    4444     - /home/username/projects/bar(id = 1@bar)
    4545     - /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
    5353
    5454Removing file system /www/site1
     
    5757     - /home/username/projects/foo(id = 0@foo)
    5858     - /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
    6464
    6565Removing file system /home/username/projects/foo
     
    6767    file system paths:
    6868     - /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
    7272
    7373Removing file system /home/username/projects/bar
    7474Testing file system mapping.
    7575    file system paths:
    76     uriPrefixForPathPrefix:
     76    fileSystemPathForPrefix:
    7777
    7878
  • trunk/LayoutTests/inspector/file-system-mapping.html

    r142867 r143448  
    3232            InspectorTest.addResult("     - " + fileSystemPaths[i] + "(id = " + id + ")");
    3333        }
    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.
    3636        for (var i = 0; i < 2; ++i) {
    3737            for (pathId in paths) {
    3838                var pathPrefix = paths[pathId];
    39                 var uriPrefix = fileSystemMapping.uriPrefixForPathPrefix(pathPrefix + "/");
    40                 if (!uriPrefix)
     39                var fileSystemPath = fileSystemMapping.fileSystemPathForPrefix(pathPrefix + "/");
     40                if (!fileSystemPath)
    4141                    continue;
    42                 InspectorTest.addResult("        " + pathPrefix + " => " + uriPrefix);
     42                InspectorTest.addResult("        " + pathPrefix + " => " + fileSystemPath);
    4343            }
    4444        }
  • trunk/LayoutTests/inspector/file-system-project.html

    r143327 r143448  
    4545        addMockFileSystem: function(path, files)
    4646        {
    47             var id = this.fileSystemMapping.addFileSystemMapping(path);
     47            var id = InspectorTest.testFileSystemMapping.addFileSystemMapping(path);
    4848            var fileSystem = new MockIsolatedFileSystem(id, path, files);
    4949            this._fileSystems = this._fileSystems || {};
     
    5656            var fileSystem = this._fileSystems[path];
    5757            delete this._fileSystems[path];
     58            InspectorTest.testFileSystemMapping.removeFileSystemMapping(path);
    5859            this.dispatchEventToListeners(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, fileSystem);
    5960        },
     
    6667        InspectorTest.createWorkspace();
    6768        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);
    7370        return manager;
    7471    }
     
    9693            var entry1 = new WebInspector.FileMapping.Entry("http://localhost/", "/var/www/localhost/");
    9794            var entry2 = new WebInspector.FileMapping.Entry("http://www.example.com/", "/foo/bar/");
    98             manager.fileMapping.setMappingEntries([entry1, entry2]);
     95            InspectorTest.testFileMapping.setMappingEntries([entry1, entry2]);
    9996            InspectorTest.waitForWorkspaceUISourceCodeAddedEvent(uiSourceCodeAdded, 3);
    10097            InspectorTest.addResult("Adding first file system.");
     
    124121                    if (!url)
    125122                        continue;
    126                     var uri = manager.fileMapping.uriForURL(url);
     123                    var uri = InspectorTest.testWorkspace.uiSourceCodeForURL(url).uri();
    127124                    InspectorTest.addResult("    " + url + " -> " + uri);
    128125                }
  • trunk/Source/WebCore/ChangeLog

    r143443 r143448  
     12013-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
    1662013-02-20  Alexander Pavlov  <apavlov@chromium.org>
    267
  • trunk/Source/WebCore/inspector/front-end/CSSStyleModel.js

    r143333 r143448  
    549549                return uiLocation;
    550550        }
    551         var uri = WebInspector.fileMapping.uriForURL(rawLocation.url);
    552         var uiSourceCode = this._workspace.uiSourceCodeForURI(uri);
     551        var uiSourceCode = this._workspace.uiSourceCodeForURL(rawLocation.url);
    553552        if (!uiSourceCode)
    554553            return null;
  • trunk/Source/WebCore/inspector/front-end/CompilerScriptMapping.js

    r142445 r143448  
    6565            return null;
    6666        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);
    6968        if (!uiSourceCode)
    7069            return null;
     
    110109        for (var i = 0; i < sourceURLs.length; ++i) {
    111110            var sourceURL = sourceURLs[i];
    112             var uri = WebInspector.fileMapping.uriForURL(sourceURL);
    113111            if (this._sourceMapForURL[sourceURL])
    114112                continue;
    115113            this._sourceMapForURL[sourceURL] = sourceMap;
    116             if (!WebInspector.fileMapping.hasMappingForURL(sourceURL) && !this._workspace.uiSourceCodeForURI(uri)) {
     114            if (!this._workspace.hasMappingForURL(sourceURL) && !this._workspace.uiSourceCodeForURL(sourceURL)) {
    117115                var sourceContent = sourceMap.sourceContent(sourceURL);
    118116                var contentProvider;
     
    123121                this._networkWorkspaceProvider.addFileForURL(sourceURL, contentProvider, true);
    124122            }
    125             var uiSourceCode = this._workspace.uiSourceCodeForURI(uri);
     123            var uiSourceCode = this._workspace.uiSourceCodeForURL(sourceURL);
    126124            if (uiSourceCode) {
    127                 this._bindUISourceCode(this._workspace.uiSourceCodeForURI(uri));
     125                this._bindUISourceCode(uiSourceCode);
    128126                uiSourceCode.isContentScript = script.isContentScript;
    129127            }
  • trunk/Source/WebCore/inspector/front-end/FileMapping.js

    r143327 r143448  
    3131/**
    3232 * @constructor
    33  * @param {WebInspector.FileSystemMapping} fileSystemMapping
    3433 */
    35 WebInspector.FileMapping = function(fileSystemMapping)
     34WebInspector.FileMapping = function()
    3635{
    37     this._fileSystemMapping = fileSystemMapping;
    3836    this._mappingEntriesSetting = WebInspector.settings.createSetting("fileMappingEntries", []);
    3937    /** @type {Array.<WebInspector.FileMapping.Entry>} */
     
    4442WebInspector.FileMapping.prototype = {
    4543    /**
    46      * @param {WebInspector.FileMapping.Entry} entry
    4744     * @param {string} url
    48      * @return {boolean}
     45     * @return {?WebInspector.FileMapping.Entry}
    4946     */
    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)
    7848    {
    7949        for (var i = 0; i < this._entries.length; ++i) {
    8050            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;
    8453        }
    8554        return null;
    8655    },
    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
    9757    /**
    9858     * @param {string} path
    99      * @return {string}
     59     * @return {?WebInspector.FileMapping.Entry}
    10060     */
    101     urlForPath: function(path)
     61    mappingEntryForPath: function(path)
    10262    {
    10363        for (var i = 0; i < this._entries.length; ++i) {
    10464            var entry = this._entries[i];
    10565            if (path.startsWith(entry.pathPrefix))
    106                 return entry.urlPrefix + path.substring(entry.pathPrefix.length);
     66                return entry;
    10767        }
    108         return "";
     68        return null;
    10969    },
    11070
  • trunk/Source/WebCore/inspector/front-end/FileSystemMapping.js

    r142867 r143448  
    4141
    4242    /**
    43      * @param {string} pathPrefix
     43     * @param {string} prefix
    4444     * @return {?string}
    4545     */
    46     uriPrefixForPathPrefix: function(pathPrefix) { },
     46    fileSystemPathForPrefix: function(prefix) { }
    4747}
    4848
     
    120120        this._fileSystemPaths[id] = fileSystemPath;
    121121        this._saveToSettings();
    122         delete this._cachedURIPrefixes;
     122        delete this._cachedFileSystemPaths;
    123123        return id;
    124124    },
     
    136136        delete this._fileSystemPaths[id];
    137137        this._saveToSettings();
    138         delete this._cachedURIPrefixes;
     138        delete this._cachedFileSystemPaths;
    139139    },
    140140
     
    148148
    149149    /**
    150      * @param {string} pathPrefix
     150     * @param {string} prefix
    151151     * @return {?string}
    152152     */
    153     uriPrefixForPathPrefix: function(pathPrefix)
     153    fileSystemPathForPrefix: function(prefix)
    154154    {
    155         this._cachedURIPrefixes = this._cachedURIPrefixes || {};
    156         if (this._cachedURIPrefixes.hasOwnProperty(pathPrefix))
    157             return this._cachedURIPrefixes[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;
    159159        for (var id in this._fileSystemPaths) {
    160160            var fileSystemPath = this._fileSystemPaths[id];
    161             if (pathPrefix.startsWith(fileSystemPath + "/")) {
    162                 uriPrefix = id + pathPrefix.substr(fileSystemPath.length);
     161            if (prefix.startsWith(fileSystemPath + "/")) {
     162                result = fileSystemPath;
    163163                break;
    164164            }
    165165        }
    166         this._cachedURIPrefixes[pathPrefix] = uriPrefix;
    167         return uriPrefix;
     166        this._cachedFileSystemPaths[prefix] = result;
     167        return result;
    168168    },
    169169
  • trunk/Source/WebCore/inspector/front-end/FileSystemProjectDelegate.js

    r143327 r143448  
    3434 * @extends {WebInspector.Object}
    3535 * @param {WebInspector.IsolatedFileSystem} isolatedFileSystem
    36  * @param {WebInspector.FileMapping} fileMapping
    37  */
    38 WebInspector.FileSystemProjectDelegate = function(isolatedFileSystem, fileMapping)
     36 * @param {WebInspector.Workspace} workspace
     37 */
     38WebInspector.FileSystemProjectDelegate = function(isolatedFileSystem, workspace)
    3939{
    4040    this._fileSystem = isolatedFileSystem;
    41     this._fileMapping = fileMapping;
     41    this._workspace = workspace;
    4242}
    4343
     
    164164                var fullPath = this._fileSystem.path() + files[i];
    165165                var path = files[i].substr(1);
    166                 var url = this._fileMapping.urlForPath(fullPath);
     166                var url = this._workspace.urlForPath(fullPath);
    167167                var contentType = this._contentTypeForPath(path);
    168168                var fileDescriptor = new WebInspector.FileDescriptor(path, "file://" + fullPath, url, contentType, true);
     
    203203/**
    204204 * @constructor
    205  * @implements {WebInspector.ProjectDelegate}
    206205 * @param {WebInspector.IsolatedFileSystemManager} isolatedFileSystemManager
    207206 * @param {WebInspector.Workspace} workspace
    208  * @param {WebInspector.FileMapping} fileMapping
    209  */
    210 WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemManager, workspace, fileMapping)
     207 */
     208WebInspector.FileSystemWorkspaceProvider = function(isolatedFileSystemManager, workspace)
    211209{
    212210    this._isolatedFileSystemManager = isolatedFileSystemManager;
    213211    this._workspace = workspace;
    214     this._fileMapping = fileMapping;
    215212    this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemAdded, this._fileSystemAdded, this);
    216213    this._isolatedFileSystemManager.addEventListener(WebInspector.IsolatedFileSystemManager.Events.FileSystemRemoved, this._fileSystemRemoved, this);
     
    219216WebInspector.FileSystemWorkspaceProvider.prototype = {
    220217    /**
    221      * @param {WebInspector.event} event
     218     * @param {WebInspector.Event} event
    222219     */
    223220    _fileSystemAdded: function(event)
     
    225222        var fileSystem = /** @type {WebInspector.IsolatedFileSystem} */ (event.data);
    226223        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)
    228225        this._workspace.addProject(projectDelegate);
    229226        projectDelegate.populate();
     
    231228
    232229    /**
    233      * @param {WebInspector.event} event
     230     * @param {WebInspector.Event} event
    234231     */
    235232    _fileSystemRemoved: function(event)
  • trunk/Source/WebCore/inspector/front-end/IsolatedFileSystemManager.js

    r143327 r143448  
    3535WebInspector.IsolatedFileSystemManager = function()
    3636{
    37     /** @type {!Object.<string, WebInspector.IsolatedFileSystemManager.FileSystem>} */
     37    /** @type {!Object.<string, WebInspector.IsolatedFileSystem>} */
    3838    this._fileSystems = {};
    3939    /** @type {Object.<string, Array.<function(DOMFileSystem)>>} */
  • trunk/Source/WebCore/inspector/front-end/NetworkUISourceCodeProvider.js

    r142148 r143448  
    3232 * @constructor
    3333 * @param {WebInspector.SimpleWorkspaceProvider} networkWorkspaceProvider
     34 * @param {WebInspector.Workspace} workspace
    3435 */
    35 WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceProvider)
     36WebInspector.NetworkUISourceCodeProvider = function(networkWorkspaceProvider, workspace)
    3637{
    3738    this._networkWorkspaceProvider = networkWorkspaceProvider;
     39    this._workspace = workspace;
    3840    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
    3941    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this);
     
    113115    _addFile: function(url, contentProvider, isContentScript)
    114116    {
    115         if (WebInspector.fileMapping.hasMappingForURL(url))
     117        if (this._workspace.hasMappingForURL(url))
    116118            return;
    117119
  • trunk/Source/WebCore/inspector/front-end/ResourceScriptMapping.js

    r139885 r143448  
    139139        if (!script.isInlineScript() && this._inlineScriptsForSourceURL[script.sourceURL])
    140140            return null;
    141         var uri = WebInspector.fileMapping.uriForURL(script.sourceURL);
    142         return this._workspace.uiSourceCodeForURI(uri);
     141        return this._workspace.uiSourceCodeForURL(script.sourceURL);
    143142    },
    144143
  • trunk/Source/WebCore/inspector/front-end/ResourceUtils.js

    r142871 r143448  
    5959        return resource.displayName;
    6060
    61     var uri = WebInspector.fileMapping.uriForURL(url);
    62     var uiSourceCode = WebInspector.workspace.uiSourceCodeForURI(uri);
     61    var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
    6362    if (uiSourceCode)
    6463        return uiSourceCode.parsedURL.displayName;
  • trunk/Source/WebCore/inspector/front-end/SASSSourceMapping.js

    r143333 r143448  
    118118    _reloadCSS: function(url)
    119119    {
    120         var uri = WebInspector.fileMapping.uriForURL(url);
    121         var uiSourceCode = this._workspace.uiSourceCodeForURI(uri);
     120        var uiSourceCode = this._workspace.uiSourceCodeForURL(url);
    122121        if (!uiSourceCode)
    123122            return;
     
    231230        for (var i = 0; i < sources.length; ++i) {
    232231            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)) {
    235233                var content = InspectorFrontendHost.loadResourceSynchronously(url);
    236234                var contentProvider = new WebInspector.StaticContentProvider(WebInspector.resourceTypes.Stylesheet, content, "text/x-scss");
     
    252250        var location = /** @type WebInspector.CSSLocation */ (rawLocation);
    253251        var entry;
    254         var uiSourceCode;
    255252        var sourceMap = this._sourceMapByStyleSheetURL[location.url];
    256253        if (!sourceMap)
     
    259256        if (!entry || entry.length === 2)
    260257            return null;
    261         var uri = WebInspector.fileMapping.uriForURL(entry[2]);
    262         uiSourceCode = this._workspace.uiSourceCodeForURI(uri);
     258        var uiSourceCode = this._workspace.uiSourceCodeForURL(entry[2]);
    263259        if (!uiSourceCode)
    264260            return null;
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r143227 r143448  
    373373        if (WebInspector.debuggerModel.debuggerEnabled() && anchor.uiSourceCode)
    374374            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);
    377376        if (uiSourceCode) {
    378377            anchor.uiSourceCode = uiSourceCode;
  • trunk/Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js

    r143202 r143448  
    214214 * @return {string}
    215215 */
    216 WebInspector.SimpleWorkspaceProvider._pathForSplittedURL = function(splittedURL)
     216WebInspector.SimpleWorkspaceProvider.pathForSplittedURL = function(splittedURL)
    217217{
    218218    splittedURL.shift();
    219219    return splittedURL.join("/");
    220220}
    221 
    222 /**
    223  * @param {string} url
    224  * @param {string} type
    225  * @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  }
    234221
    235222WebInspector.SimpleWorkspaceProvider.prototype = {
     
    284271        var splittedURL = WebInspector.SimpleWorkspaceProvider.splitURL(url);
    285272        var projectName = splittedURL[0];
    286         var path = WebInspector.SimpleWorkspaceProvider._pathForSplittedURL(splittedURL);
     273        var path = WebInspector.SimpleWorkspaceProvider.pathForSplittedURL(splittedURL);
    287274        return this._innerAddFile(projectName, path, url, contentProvider, isEditable, forceUnique, isContentScript);
    288275    },
  • trunk/Source/WebCore/inspector/front-end/StylesSourceMapping.js

    r143333 r143448  
    5555    {
    5656        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);
    5958        return new WebInspector.UILocation(uiSourceCode, location.lineNumber, 0);
    6059    },
     
    7877        if (!resource.url)
    7978            return;
    80         var uri = WebInspector.fileMapping.uriForURL(resource.url);
    81         var uiSourceCode = this._workspace.uiSourceCodeForURI(uri);
     79        var uiSourceCode = this._workspace.uiSourceCodeForURL(resource.url);
    8280        if (!uiSourceCode)
    8381            return;
     
    126124    {
    127125        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);
    130127            if (!uiSourceCode)
    131128                continue;
     
    215212}
    216213
    217 
    218214/**
    219215 * @constructor
    220216 * @param {WebInspector.CSSStyleModel} cssModel
    221217 */
    222 WebInspector.StyleContentBinding = function(cssModel)
     218WebInspector.StyleContentBinding = function(cssModel, workspace)
    223219{
    224220    this._cssModel = cssModel;
     221    this._workspace = workspace;
    225222    this._cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetChanged, this._styleSheetChanged, this);
    226223}
     
    311308                return;
    312309
    313             var uri = WebInspector.fileMapping.uriForURL(styleSheetURL);
    314             var uiSourceCode = WebInspector.workspace.uiSourceCodeForURI(uri);
     310            var uiSourceCode = this._workspace.uiSourceCodeForURL(styleSheetURL);
    315311            if (!uiSourceCode)
    316312                return;
  • trunk/Source/WebCore/inspector/front-end/Workspace.js

    r143202 r143448  
    308308 * @implements {WebInspector.UISourceCodeProvider}
    309309 * @extends {WebInspector.Object}
    310  */
    311 WebInspector.Workspace = function()
     310 * @param {WebInspector.FileMapping} fileMapping
     311 * @param {WebInspector.FileSystemMapping} fileSystemMapping
     312 */
     313WebInspector.Workspace = function(fileMapping, fileSystemMapping)
    312314{
     315    this._fileMapping = fileMapping;
     316    this._fileSystemMapping = fileSystemMapping;
    313317    /** @type {!Object.<string, WebInspector.Project>} */
    314318    this._projects = {};
     
    444448    },
    445449
     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
    446505    __proto__: WebInspector.Object.prototype
    447506}
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r143327 r143448  
    416416    InspectorBackend.registerInspectorDispatcher(this);
    417417
    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());
    419422
    420423    this.cssModel = new WebInspector.CSSStyleModel(this.workspace);
     
    439442    this.workspaceController = new WebInspector.WorkspaceController(this.workspace);
    440443
    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);
    445445
    446446    this.networkWorkspaceProvider = new WebInspector.SimpleWorkspaceProvider(this.workspace, WebInspector.projectTypes.Network);
    447     new WebInspector.NetworkUISourceCodeProvider(this.networkWorkspaceProvider);
     447    new WebInspector.NetworkUISourceCodeProvider(this.networkWorkspaceProvider, this.workspace);
    448448
    449449    this.breakpointManager = new WebInspector.BreakpointManager(WebInspector.settings.breakpoints, this.debuggerModel, this.workspace);
     
    453453    new WebInspector.DebuggerScriptMapping(this.workspace, this.networkWorkspaceProvider);
    454454    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);
    456456    new WebInspector.StylesSourceMapping(this.cssModel, this.workspace);
    457457    if (WebInspector.experimentsSettings.sass.isEnabled())
Note: See TracChangeset for help on using the changeset viewer.