Unreviewed, rolling out r143100.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2013 09:30:22 +0000 (09:30 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2013 09:30:22 +0000 (09:30 +0000)
http://trac.webkit.org/changeset/143100
https://bugs.webkit.org/show_bug.cgi?id=110088

Breaks file system support in workspace. (Requested by vsevik
on #webkit).

Patch by Sheriff Bot <webkit.review.bot@gmail.com> on 2013-02-18

Source/WebCore:

* inspector/front-end/ScriptSnippetModel.js:
(WebInspector.ScriptSnippetModel.prototype._addScriptSnippet):
* inspector/front-end/SimpleWorkspaceProvider.js:
(WebInspector.SimpleProjectDelegate):
(WebInspector.SimpleProjectDelegate.prototype.id):
(WebInspector.SimpleProjectDelegate.prototype.displayName):
(WebInspector.SimpleProjectDelegate.prototype.addFile):
(WebInspector.SimpleWorkspaceProvider):
(WebInspector.SimpleWorkspaceProvider.uriForURL):
(WebInspector.SimpleWorkspaceProvider.prototype._innerAddFileForURL):
(WebInspector.SimpleWorkspaceProvider.prototype.removeFile):
(WebInspector.SimpleWorkspaceProvider.prototype.reset):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode.prototype.uri):
* inspector/front-end/Workspace.js:
(WebInspector.Project.prototype._fileAdded):
(WebInspector.Project.prototype._fileRemoved):
(WebInspector.Project.prototype.uiSourceCodeForURI):
(WebInspector.Workspace.prototype.projectForUISourceCode):

LayoutTests:

* inspector/debugger/live-edit-breakpoints-expected.txt:
* inspector/debugger/live-edit-breakpoints.html:
* inspector/uisourcecode-revisions.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143174 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/debugger/live-edit-breakpoints-expected.txt
LayoutTests/inspector/debugger/live-edit-breakpoints.html
LayoutTests/inspector/uisourcecode-revisions.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/ScriptSnippetModel.js
Source/WebCore/inspector/front-end/SimpleWorkspaceProvider.js
Source/WebCore/inspector/front-end/UISourceCode.js
Source/WebCore/inspector/front-end/Workspace.js

index fde1c4c46931a3a8a12dc413e3efb2f2dd80d338..8a9ef4d255bf0e73ea1addef7cd5598c8051e75c 100644 (file)
@@ -1,3 +1,16 @@
+2013-02-18  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r143100.
+        http://trac.webkit.org/changeset/143100
+        https://bugs.webkit.org/show_bug.cgi?id=110088
+
+        Breaks file system support in workspace. (Requested by vsevik
+        on #webkit).
+
+        * inspector/debugger/live-edit-breakpoints-expected.txt:
+        * inspector/debugger/live-edit-breakpoints.html:
+        * inspector/uisourcecode-revisions.html:
+
 2013-02-18  Zan Dobersek  <zdobersek@igalia.com>
 
         Unreviewed gardening.
index ae1e697c3d328210cf8d2bac68a71428504e6205..a69b8a6ff7d6b7e1eddec379455d1fbaa0c3de9f 100644 (file)
@@ -9,7 +9,7 @@ Setting breakpoint:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Editing source:
     TextEditor.removeBreakpoint(lineNumber = 2)
     TextEditor.addBreakpoint(lineNumber = 2, disabled = true)
@@ -17,7 +17,7 @@ Editing source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Undoing source editing:
     OriginalTextEditor.removeBreakpoint(lineNumber = 2)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -26,7 +26,7 @@ Undoing source editing:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Finally removing breakpoint:
     TextEditor.removeBreakpoint(lineNumber = 2)
     Dumping breakpoint storage
@@ -38,7 +38,7 @@ Setting breakpoint:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Editing source:
     OriginalTextEditor.addBreakpoint(lineNumber = 2, disabled = false)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -46,7 +46,7 @@ Editing source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Committing edited source:
     OriginalTextEditor.removeBreakpoint(lineNumber = 2)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -55,7 +55,7 @@ Committing edited source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Finally removing breakpoint:
     TextEditor.removeBreakpoint(lineNumber = 2)
     Dumping breakpoint storage
@@ -67,7 +67,7 @@ Setting breakpoint:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Editing source:
     OriginalTextEditor.addBreakpoint(lineNumber = 2, disabled = false)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -75,17 +75,17 @@ Editing source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Committing edited source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Editing source again so that live edit could succeed:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Committing edited source again:
     OriginalTextEditor.removeBreakpoint(lineNumber = 2)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -94,7 +94,7 @@ Committing edited source again:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Finally removing breakpoint:
     TextEditor.removeBreakpoint(lineNumber = 2)
     Dumping breakpoint storage
@@ -106,7 +106,7 @@ Setting breakpoint:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Editing source:
     OriginalTextEditor.addBreakpoint(lineNumber = 2, disabled = false)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -114,17 +114,17 @@ Editing source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Committing edited source:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Undoing source editing:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: debugger, project id: debugger:file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: debugger
 Committing edited source again:
     OriginalTextEditor.removeBreakpoint(lineNumber = 2)
     TextEditor.removeBreakpoint(lineNumber = 2)
@@ -133,7 +133,7 @@ Committing edited source again:
     Dumping breakpoint storage
         edit-me-breakpoints.js:2, enabled:true
     Dumping breakpoint locations
-        url: edit-me-breakpoints.js, lineNumber: 2, project type: network, project id: file://
+        url: edit-me-breakpoints.js, lineNumber: 2, project name: network
 Finally removing breakpoint:
     TextEditor.removeBreakpoint(lineNumber = 2)
     Dumping breakpoint storage
@@ -148,15 +148,15 @@ Setting breakpoint:
     TextEditor.addBreakpoint(lineNumber = 2, disabled = false)
     Dumping breakpoint storage
     Dumping breakpoint locations
-        url: , lineNumber: 2, project type: debugger, project id: debugger:
+        url: , lineNumber: 2, project name: debugger
 Editing source:
     Dumping breakpoint storage
     Dumping breakpoint locations
-        url: , lineNumber: 2, project type: debugger, project id: debugger:
+        url: , lineNumber: 2, project name: debugger
 Undoing source editing:
     Dumping breakpoint storage
     Dumping breakpoint locations
-        url: , lineNumber: 2, project type: debugger, project id: debugger:
+        url: , lineNumber: 2, project name: debugger
 Finally removing breakpoint:
     TextEditor.removeBreakpoint(lineNumber = 2)
     Dumping breakpoint storage
@@ -171,15 +171,15 @@ Setting breakpoint:
     TextEditor.addBreakpoint(lineNumber = 2, disabled = false)
     Dumping breakpoint storage
     Dumping breakpoint locations
-        url: , lineNumber: 2, project type: debugger, project id: debugger:
+        url: , lineNumber: 2, project name: debugger
 Editing source:
     Dumping breakpoint storage
     Dumping breakpoint locations
-        url: , lineNumber: 2, project type: debugger, project id: debugger:
+        url: , lineNumber: 2, project name: debugger
 Undoing source editing:
     Dumping breakpoint storage
     Dumping breakpoint locations
-        url: , lineNumber: 2, project type: debugger, project id: debugger:
+        url: , lineNumber: 2, project name: debugger
 Finally removing breakpoint:
     TextEditor.removeBreakpoint(lineNumber = 2)
     Dumping breakpoint storage
index 75c1a000f388e9539e060c34b38a28ac18485fd9..a0ebc0c335c9f44db340f3bf639eef12f8a67f77 100644 (file)
@@ -39,8 +39,8 @@ function test()
         for (var i = 0; i < locations.length; ++i) {
             var uiLocation = locations[i].uiLocation;
             var uiSourceCode = uiLocation.uiSourceCode;
-            var project = uiSourceCode.project();
-            InspectorTest.addResult("        url: " + pathToFileName(uiSourceCode.originURL()) + ", lineNumber: " + uiLocation.lineNumber + ", project type: " + project.type() + ", project id: " + project.id());
+            var project = WebInspector.workspace.projectForUISourceCode(uiSourceCode);
+            InspectorTest.addResult("        url: " + pathToFileName(uiSourceCode.originURL()) + ", lineNumber: " + uiLocation.lineNumber + ", project name: " + project.id());
         }
     }
 
index 67cadc62559ec7f85efbe24ad583a0e15363c08c..5a6bac7b945b4f0e121484f58414765d390f6c3e 100644 (file)
@@ -9,7 +9,7 @@ function test()
     function createMockProject()
     {
         var workspace = new WebInspector.Workspace();
-        var projectDelegate = new WebInspector.SimpleProjectDelegate("", WebInspector.projectTypes.Network);
+        var projectDelegate = new WebInspector.SimpleProjectDelegate(WebInspector.projectTypes.Network);
         var project = workspace.addProject(projectDelegate);
         project.requestFileContent = function(uri, callback)
         {
index c9951082f5a132a5072bb93b620996db67ec1fac..f0b2588417cb89c880ceed262fcf65890d7e17e4 100644 (file)
@@ -1,3 +1,32 @@
+2013-02-18  Sheriff Bot  <webkit.review.bot@gmail.com>
+
+        Unreviewed, rolling out r143100.
+        http://trac.webkit.org/changeset/143100
+        https://bugs.webkit.org/show_bug.cgi?id=110088
+
+        Breaks file system support in workspace. (Requested by vsevik
+        on #webkit).
+
+        * inspector/front-end/ScriptSnippetModel.js:
+        (WebInspector.ScriptSnippetModel.prototype._addScriptSnippet):
+        * inspector/front-end/SimpleWorkspaceProvider.js:
+        (WebInspector.SimpleProjectDelegate):
+        (WebInspector.SimpleProjectDelegate.prototype.id):
+        (WebInspector.SimpleProjectDelegate.prototype.displayName):
+        (WebInspector.SimpleProjectDelegate.prototype.addFile):
+        (WebInspector.SimpleWorkspaceProvider):
+        (WebInspector.SimpleWorkspaceProvider.uriForURL):
+        (WebInspector.SimpleWorkspaceProvider.prototype._innerAddFileForURL):
+        (WebInspector.SimpleWorkspaceProvider.prototype.removeFile):
+        (WebInspector.SimpleWorkspaceProvider.prototype.reset):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode.prototype.uri):
+        * inspector/front-end/Workspace.js:
+        (WebInspector.Project.prototype._fileAdded):
+        (WebInspector.Project.prototype._fileRemoved):
+        (WebInspector.Project.prototype.uiSourceCodeForURI):
+        (WebInspector.Workspace.prototype.projectForUISourceCode):
+
 2013-02-15  Eugene Klyuchnikov  <eustas@chromium.org>
 
         Web Inspector: Introduce ProfilesPanelDescriptor.
index 6d81e5a3babf3ed69beb2515b9f9f6face7920a3..f0193172b9134f1f28de757147ecd97789e1df91 100644 (file)
@@ -82,7 +82,7 @@ WebInspector.ScriptSnippetModel.prototype = {
      */
     _addScriptSnippet: function(snippet)
     {
-        var uiSourceCode = this._workspaceProvider.addFileByName("", snippet.name, new WebInspector.SnippetContentProvider(snippet), true);
+        var uiSourceCode = this._workspaceProvider.addFileForURL(snippet.name, new WebInspector.SnippetContentProvider(snippet), true);
         var scriptFile = new WebInspector.SnippetScriptFile(this, uiSourceCode);
         uiSourceCode.setScriptFile(scriptFile);
         this._snippetIdForUISourceCode.put(uiSourceCode, snippet.id);
@@ -103,7 +103,7 @@ WebInspector.ScriptSnippetModel.prototype = {
         this._releaseSnippetScript(uiSourceCode);
         delete this._uiSourceCodeForSnippetId[snippet.id];
         this._snippetIdForUISourceCode.remove(uiSourceCode);
-        this._workspaceProvider.removeFileByName("", snippet.name);
+        this._workspaceProvider.removeFile(snippet.name);
     },
 
     /**
index 0fa7addbd47e9e75d84244153d5809cec40e8342..ac581c8143d609ea5627e74ffe4ebf3174c9ba2c 100644 (file)
  * @implements {WebInspector.ProjectDelegate}
  * @extends {WebInspector.Object}
  */
-WebInspector.SimpleProjectDelegate = function(name, type)
+WebInspector.SimpleProjectDelegate = function(type)
 {
-    this._name = name;
     this._type = type;
     /** @type {Object.<string, WebInspector.ContentProvider>} */
     this._contentProviders = {};
     this._lastUniqueSuffix = 0;
 }
 
-WebInspector.SimpleProjectDelegate.projectId = function(name, type)
-{
-    var typePrefix = type !== WebInspector.projectTypes.Network ? (type + ":") : "";
-    return typePrefix + name;
-}
-
 WebInspector.SimpleProjectDelegate.prototype = {
     /**
      * @return {string}
      */
     id: function()
     {
-        return WebInspector.SimpleProjectDelegate.projectId(this._name, this._type);
+        return this._type;
     },
 
     /**
@@ -70,18 +63,7 @@ WebInspector.SimpleProjectDelegate.prototype = {
      */
     displayName: function()
     {
-        if (typeof this._displayName !== "undefined")
-            return this._displayName;
-        if (!this._name) {
-            this._displayName = "";
-            return this._displayName;
-        }
-        var parsedURL = new WebInspector.ParsedURL(this._name);
-        if (parsedURL.isValid)
-            this._displayName = parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "");
-        else
-            this._displayName = this._name;
-        return this._displayName;
+        return "";
     },
 
     /**
@@ -105,7 +87,6 @@ WebInspector.SimpleProjectDelegate.prototype = {
     },
 
     /**
-     * @param {string} path
      * @param {string} query
      * @param {boolean} caseSensitive
      * @param {boolean} isRegex
@@ -123,12 +104,12 @@ WebInspector.SimpleProjectDelegate.prototype = {
      * @param {WebInspector.ContentProvider} contentProvider
      * @param {boolean} isEditable
      * @param {boolean=} isContentScript
-     * @return {string}
      */
     addFile: function(path, forceUniquePath, url, contentProvider, isEditable, isContentScript)
     {
         if (forceUniquePath)
             path = this._uniquePath(path); 
+        console.assert(!this._contentProviders[path]);
         var fileDescriptor = new WebInspector.FileDescriptor(path, url, url, contentProvider.contentType(), isEditable, isContentScript);
         this._contentProviders[path] = contentProvider;
         this.dispatchEventToListeners(WebInspector.ProjectDelegate.Events.FileAdded, fileDescriptor);
@@ -175,84 +156,27 @@ WebInspector.SimpleWorkspaceProvider = function(workspace, type)
 {
     this._workspace = workspace;
     this._type = type;
-    this._simpleProjectDelegates = {};
-}
-
-/**
- * @param {string} url
- * @return {Array.<string>}
- */
-WebInspector.SimpleWorkspaceProvider.splitURL = function(url)
-{
-    var parsedURL = new WebInspector.ParsedURL(url);
-    var origin;
-    var folderPath;
-    var name;
-    if (parsedURL.isValid) {
-        origin = parsedURL.scheme + "://" + parsedURL.host;
-        if (parsedURL.port)
-            origin += ":" + parsedURL.port;
-        folderPath = parsedURL.folderPathComponents;
-        name = parsedURL.lastPathComponent;
-        if (parsedURL.queryParams)
-            name += "?" + parsedURL.queryParams;
-    } else {
-        origin = "";
-        folderPath = "";
-        name = url;
-    }
-    var result = [origin];
-    var splittedPath = folderPath.split("/");
-    for (var i = 1; i < splittedPath.length; ++i)
-        result.push(splittedPath[i]);
-    result.push(name);
-    return result;
-}
-
-/**
- * @param {Array.<string>} splittedURL
- * @return {string}
- */
-WebInspector.SimpleWorkspaceProvider._pathForSplittedURL = function(splittedURL)
-{
-    splittedURL.shift();
-    return splittedURL.join("/");
+    this._simpleProjectDelegate = new WebInspector.SimpleProjectDelegate(this._type);
+    this._workspace.addProject(this._simpleProjectDelegate);
 }
 
 /**
  * @param {string} url
- * @param {string} type
  * @return {string}
  */
 WebInspector.SimpleWorkspaceProvider.uriForURL = function(url, type)
-{
-    var splittedURL = WebInspector.SimpleWorkspaceProvider.splitURL(url);
-    var projectId = WebInspector.SimpleProjectDelegate.projectId(splittedURL[0], type);
-    var path = WebInspector.SimpleWorkspaceProvider._pathForSplittedURL(splittedURL);
-    return WebInspector.UISourceCode.uri(projectId, path);
- }
+{   
+    var uriTypePrefix = type !== WebInspector.projectTypes.Network ? (type + ":") : "";
+    var uri = uriTypePrefix + url;
+    return uri;
+}
 
 WebInspector.SimpleWorkspaceProvider.prototype = {
-    /**
-     * @param {string} projectName
-     * @return {WebInspector.ProjectDelegate}
-     */
-    _projectDelegate: function(projectName)
-    {
-        if (this._simpleProjectDelegates[projectName])
-            return this._simpleProjectDelegates[projectName];
-        var simpleProjectDelegate = new WebInspector.SimpleProjectDelegate(projectName, this._type);
-        this._simpleProjectDelegates[projectName] = simpleProjectDelegate;
-        this._workspace.addProject(simpleProjectDelegate);
-        return simpleProjectDelegate;
-    },
     /**
      * @param {string} url
      * @param {WebInspector.ContentProvider} contentProvider
      * @param {boolean} isEditable
      * @param {boolean=} isContentScript
-     * @return {WebInspector.UISourceCode}
      */
     addFileForURL: function(url, contentProvider, isEditable, isContentScript)
     {
@@ -264,7 +188,6 @@ WebInspector.SimpleWorkspaceProvider.prototype = {
      * @param {WebInspector.ContentProvider} contentProvider
      * @param {boolean} isEditable
      * @param {boolean=} isContentScript
-     * @return {WebInspector.UISourceCode}
      */
     addUniqueFileForURL: function(url, contentProvider, isEditable, isContentScript)
     {
@@ -275,62 +198,27 @@ WebInspector.SimpleWorkspaceProvider.prototype = {
      * @param {string} url
      * @param {WebInspector.ContentProvider} contentProvider
      * @param {boolean} isEditable
-     * @param {boolean} forceUnique
      * @param {boolean=} isContentScript
-     * @return {WebInspector.UISourceCode}
      */
     _innerAddFileForURL: function(url, contentProvider, isEditable, forceUnique, isContentScript)
     {
-        var splittedURL = WebInspector.SimpleWorkspaceProvider.splitURL(url);
-        var projectName = splittedURL[0];
-        var path = WebInspector.SimpleWorkspaceProvider._pathForSplittedURL(splittedURL);
-        return this._innerAddFile(projectName, path, url, contentProvider, isEditable, forceUnique, isContentScript);
-    },
-
-    /**
-     * @param {string} projectName
-     * @param {string} name
-     * @param {WebInspector.ContentProvider} contentProvider
-     * @param {boolean} isEditable
-     * @param {boolean=} isContentScript
-     * @return {WebInspector.UISourceCode}
-     */
-    addFileByName: function(projectName, name, contentProvider, isEditable, isContentScript)
-    {
-        return this._innerAddFile("", name, name, contentProvider, isEditable, false, isContentScript);
+        var path = WebInspector.SimpleWorkspaceProvider.uriForURL(url, this._type);
+        path = this._simpleProjectDelegate.addFile(path, forceUnique, url, contentProvider, isEditable, isContentScript);
+        return this._workspace.uiSourceCode(this._simpleProjectDelegate.id(), path);
     },
 
     /**
-     * @param {string} projectName
-     * @param {string} path
-     * @param {WebInspector.ContentProvider} contentProvider
-     * @param {boolean} isEditable
-     * @param {boolean} forceUnique
-     * @param {boolean=} isContentScript
-     * @return {WebInspector.UISourceCode}
-     */
-    _innerAddFile: function(projectName, path, url, contentProvider, isEditable, forceUnique, isContentScript)
-    {
-        var projectDelegate = this._projectDelegate(projectName);
-        path = projectDelegate.addFile(path, forceUnique, url, contentProvider, isEditable, isContentScript);
-        return this._workspace.uiSourceCode(projectDelegate.id(), path);
-    },
-
-    /**
-     * @param {string} projectName
-     * @param {string} path
+     * @param {string} url
      */
-    removeFileByName: function(projectName, path)
+    removeFile: function(url)
     {
-        var projectDelegate = this._projectDelegate(projectName);
-        projectDelegate.removeFile(path);
+        var path = WebInspector.SimpleWorkspaceProvider.uriForURL(url, this._type);
+        this._simpleProjectDelegate.removeFile(path);
     },
 
     reset: function()
     {
-        for (var projectName in this._simpleProjectDelegates)
-            this._simpleProjectDelegates[projectName].reset();
-        this._simpleProjectDelegates = {};
+        this._simpleProjectDelegate.reset();
     },
     
     __proto__: WebInspector.Object.prototype
index 72bac8a8182d2987700c11f6544ec101ee61f71f..b14fcaf06bafc737b2a1b8be58b19009ef394b4f 100644 (file)
@@ -81,37 +81,6 @@ WebInspector.UISourceCode.Events = {
     SourceMappingChanged: "SourceMappingChanged",
 }
 
-/**
- * @param {string} projectId
- * @param {string} path
- * @return {string}
- */
-WebInspector.UISourceCode.uri = function(projectId, path)
-{
-    if (!projectId)
-        return path;
-    if (!path)
-        return projectId;
-    return projectId + "/" + path;
-}
-
-/**
- * @param {string} projectId
- * @param {string} uri
- * @return {?string}
- */
-WebInspector.UISourceCode.path = function(projectId, uri)
-{
-    if (!projectId)
-        return uri;
-    if (!uri.startsWith(projectId))
-        return null;
-    var path = uri.substr(projectId.length);
-    if (path.length && path[0] === "/")
-        path = path.substr(1);
-    return path;
-}
-
 WebInspector.UISourceCode.prototype = {
     /**
      * @return {string}
@@ -134,7 +103,7 @@ WebInspector.UISourceCode.prototype = {
      */
     uri: function()
     {
-        return WebInspector.UISourceCode.uri(this._project.id(), this._path);
+        return this._path;
     },
 
     /**
index 7c99680a58b3bc8fef25a2365be43474ad4ebaf2..7002623095597431ef0356d1872d83bbb57cd2a3 100644 (file)
@@ -187,7 +187,7 @@ WebInspector.Project.prototype = {
     _fileAdded: function(event)
     {
         var fileDescriptor = /** @type {WebInspector.FileDescriptor} */ (event.data);
-        var uiSourceCode = this.uiSourceCode(fileDescriptor.path);
+        var uiSourceCode = this.uiSourceCodeForURI(fileDescriptor.path);
         if (uiSourceCode) {
             // FIXME: Implement
             return;
@@ -201,7 +201,7 @@ WebInspector.Project.prototype = {
     _fileRemoved: function(event)
     {
         var path = /** @type {string} */ (event.data);
-        var uiSourceCode = this.uiSourceCode(path);
+        var uiSourceCode = this.uiSourceCodeForURI(path);
         if (!uiSourceCode)
             return;
         delete this._uiSourceCodes[uiSourceCode.path()];
@@ -243,10 +243,7 @@ WebInspector.Project.prototype = {
      */
     uiSourceCodeForURI: function(uri)
     {
-        var path = WebInspector.UISourceCode.path(this.id(), uri);
-        if (typeof path !== "string")
-            return null;
-        return this._uiSourceCodes[path];
+        return this.uiSourceCode(uri);
     },
 
     /**
@@ -298,6 +295,7 @@ WebInspector.Project.prototype = {
 WebInspector.projectTypes = {
     Debugger: "debugger",
     LiveEdit: "liveedit",
+    Compiler: "compiler",
     Network: "network",
     Snippets: "snippets",
     FileSystem: "filesystem"
@@ -443,6 +441,19 @@ WebInspector.Workspace.prototype = {
         return result;
     },
 
+    /**
+     * @return {?WebInspector.Project}
+     */
+    projectForUISourceCode: function(uiSourceCode)
+    {
+        for (var projectId in this._projects) {
+            var project = this._projects[projectId];
+            if (project.uiSourceCodeForURI(uiSourceCode.uri()))
+                return project;
+        }
+        return null;
+    },
+
     __proto__: WebInspector.Object.prototype
 }