| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 * @param {string} url | 131 * @param {string} url |
| 132 * @param {!WebInspector.ContentProvider} contentProvider | 132 * @param {!WebInspector.ContentProvider} contentProvider |
| 133 * @param {boolean=} isContentScript | 133 * @param {boolean=} isContentScript |
| 134 * @return {!WebInspector.UISourceCode} | 134 * @return {!WebInspector.UISourceCode} |
| 135 */ | 135 */ |
| 136 addFileForURL: function(url, contentProvider, isContentScript) | 136 addFileForURL: function(url, contentProvider, isContentScript) |
| 137 { | 137 { |
| 138 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); | 138 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
| 139 var projectName = splitURL[0]; | 139 var projectName = splitURL[0]; |
| 140 var parentPath = splitURL.slice(1, -1).join("/"); | 140 var parentPath = splitURL.slice(1, -1).join("/"); |
| 141 try { | |
| 142 parentPath = parentPath; | |
| 143 } catch (e) { } | |
| 144 var name = splitURL.peekLast() || ""; | 141 var name = splitURL.peekLast() || ""; |
| 145 try { | |
| 146 name = name; | |
| 147 } catch (e) { } | |
| 148 var projectDelegate = this._projectDelegate(projectName, isContentScript
|| false); | 142 var projectDelegate = this._projectDelegate(projectName, isContentScript
|| false); |
| 149 var path = projectDelegate.addFile(parentPath, name, url, contentProvide
r); | 143 var path = projectDelegate.addFile(parentPath, name, url, contentProvide
r); |
| 150 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._work
space.uiSourceCode(projectDelegate.id(), path)); | 144 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._work
space.uiSourceCode(projectDelegate.id(), path)); |
| 151 console.assert(uiSourceCode); | 145 console.assert(uiSourceCode); |
| 152 return uiSourceCode; | 146 return uiSourceCode; |
| 153 }, | 147 }, |
| 154 | 148 |
| 155 /** | 149 /** |
| 156 * @param {string} url | 150 * @param {string} url |
| 157 */ | 151 */ |
| 158 removeFileForURL: function(url) | 152 removeFileForURL: function(url) |
| 159 { | 153 { |
| 160 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); | 154 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); |
| 161 var projectName = splitURL[0]; | 155 var projectName = splitURL[0]; |
| 162 var projectDelegate = this._projectDelegates[projectName]; | 156 var projectDelegate = this._projectDelegates[projectName]; |
| 163 projectDelegate.removeFile(url); | 157 projectDelegate.removeFile(url); |
| 164 }, | 158 }, |
| 165 | 159 |
| 166 reset: function() | 160 reset: function() |
| 167 { | 161 { |
| 168 for (var projectId in this._projectDelegates) | 162 for (var projectId in this._projectDelegates) |
| 169 this._projectDelegates[projectId].reset(); | 163 this._projectDelegates[projectId].reset(); |
| 170 this._projectDelegates = {}; | 164 this._projectDelegates = {}; |
| 171 }, | 165 }, |
| 172 | 166 |
| 173 __proto__: WebInspector.Object.prototype | 167 __proto__: WebInspector.Object.prototype |
| 174 } | 168 } |
| OLD | NEW |