| 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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 /** | 89 /** |
| 90 * @return {!WebInspector.Project} | 90 * @return {!WebInspector.Project} |
| 91 */ | 91 */ |
| 92 project: function() | 92 project: function() |
| 93 { | 93 { |
| 94 return this._project; | 94 return this._project; |
| 95 }, | 95 }, |
| 96 | 96 |
| 97 _loadSnippets: function() | 97 _loadSnippets: function() |
| 98 { | 98 { |
| 99 var snippets = this._snippetStorage.snippets(); | 99 for (var snippet of this._snippetStorage.snippets()) |
| 100 for (var i = 0; i < snippets.length; ++i) | 100 this._addScriptSnippet(snippet); |
| 101 this._addScriptSnippet(snippets[i]); | |
| 102 }, | 101 }, |
| 103 | 102 |
| 104 /** | 103 /** |
| 105 * @param {string} content | 104 * @param {string} content |
| 106 * @return {!WebInspector.UISourceCode} | 105 * @return {!WebInspector.UISourceCode} |
| 107 */ | 106 */ |
| 108 createScriptSnippet: function(content) | 107 createScriptSnippet: function(content) |
| 109 { | 108 { |
| 110 var snippet = this._snippetStorage.createSnippet(); | 109 var snippet = this._snippetStorage.createSnippet(); |
| 111 snippet.content = content; | 110 snippet.content = content; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 139 /** | 138 /** |
| 140 * @param {string} url | 139 * @param {string} url |
| 141 */ | 140 */ |
| 142 deleteScriptSnippet: function(url) | 141 deleteScriptSnippet: function(url) |
| 143 { | 142 { |
| 144 var uiSourceCode = this._project.uiSourceCodeForURL(url); | 143 var uiSourceCode = this._project.uiSourceCodeForURL(url); |
| 145 if (!uiSourceCode) | 144 if (!uiSourceCode) |
| 146 return; | 145 return; |
| 147 var snippetId = this._snippetIdForUISourceCode.get(uiSourceCode) || ""; | 146 var snippetId = this._snippetIdForUISourceCode.get(uiSourceCode) || ""; |
| 148 var snippet = this._snippetStorage.snippetForId(snippetId); | 147 var snippet = this._snippetStorage.snippetForId(snippetId); |
| 148 if (!snippet) |
| 149 return; |
| 149 this._snippetStorage.deleteSnippet(snippet); | 150 this._snippetStorage.deleteSnippet(snippet); |
| 150 this._removeBreakpoints(uiSourceCode); | 151 this._removeBreakpoints(uiSourceCode); |
| 151 this._releaseSnippetScript(uiSourceCode); | 152 this._releaseSnippetScript(uiSourceCode); |
| 152 delete this._uiSourceCodeForSnippetId[snippet.id]; | 153 delete this._uiSourceCodeForSnippetId[snippet.id]; |
| 153 this._snippetIdForUISourceCode.remove(uiSourceCode); | 154 this._snippetIdForUISourceCode.remove(uiSourceCode); |
| 154 this._project.removeFile(snippet.name); | 155 this._project.removeFile(snippet.name); |
| 155 }, | 156 }, |
| 156 | 157 |
| 157 /** | 158 /** |
| 158 * @param {string} name | 159 * @param {string} name |
| (...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 this._model.deleteScriptSnippet(url); | 668 this._model.deleteScriptSnippet(url); |
| 668 }, | 669 }, |
| 669 | 670 |
| 670 __proto__: WebInspector.ContentProviderBasedProject.prototype | 671 __proto__: WebInspector.ContentProviderBasedProject.prototype |
| 671 } | 672 } |
| 672 | 673 |
| 673 /** | 674 /** |
| 674 * @type {!WebInspector.ScriptSnippetModel} | 675 * @type {!WebInspector.ScriptSnippetModel} |
| 675 */ | 676 */ |
| 676 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); | 677 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); |
| OLD | NEW |