| 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 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 /** | 30 /** |
| 31 * @implements {WebInspector.TargetManager.Observer} | 31 * @implements {SDK.TargetManager.Observer} |
| 32 * @unrestricted | 32 * @unrestricted |
| 33 */ | 33 */ |
| 34 WebInspector.ScriptSnippetModel = class extends WebInspector.Object { | 34 Snippets.ScriptSnippetModel = class extends Common.Object { |
| 35 /** | 35 /** |
| 36 * @param {!WebInspector.Workspace} workspace | 36 * @param {!Workspace.Workspace} workspace |
| 37 */ | 37 */ |
| 38 constructor(workspace) { | 38 constructor(workspace) { |
| 39 super(); | 39 super(); |
| 40 this._workspace = workspace; | 40 this._workspace = workspace; |
| 41 /** @type {!Object.<string, !WebInspector.UISourceCode>} */ | 41 /** @type {!Object.<string, !Workspace.UISourceCode>} */ |
| 42 this._uiSourceCodeForSnippetId = {}; | 42 this._uiSourceCodeForSnippetId = {}; |
| 43 /** @type {!Map.<!WebInspector.UISourceCode, string>} */ | 43 /** @type {!Map.<!Workspace.UISourceCode, string>} */ |
| 44 this._snippetIdForUISourceCode = new Map(); | 44 this._snippetIdForUISourceCode = new Map(); |
| 45 | 45 |
| 46 /** @type {!Map.<!WebInspector.Target, !WebInspector.SnippetScriptMapping>}
*/ | 46 /** @type {!Map.<!SDK.Target, !Snippets.SnippetScriptMapping>} */ |
| 47 this._mappingForTarget = new Map(); | 47 this._mappingForTarget = new Map(); |
| 48 this._snippetStorage = new WebInspector.SnippetStorage('script', 'Script sni
ppet #'); | 48 this._snippetStorage = new Snippets.SnippetStorage('script', 'Script snippet
#'); |
| 49 this._lastSnippetEvaluationIndexSetting = WebInspector.settings.createSettin
g('lastSnippetEvaluationIndex', 0); | 49 this._lastSnippetEvaluationIndexSetting = Common.settings.createSetting('las
tSnippetEvaluationIndex', 0); |
| 50 this._project = new WebInspector.SnippetsProject(workspace, this); | 50 this._project = new Snippets.SnippetsProject(workspace, this); |
| 51 this._loadSnippets(); | 51 this._loadSnippets(); |
| 52 WebInspector.targetManager.observeTargets(this); | 52 SDK.targetManager.observeTargets(this); |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * @override | 56 * @override |
| 57 * @param {!WebInspector.Target} target | 57 * @param {!SDK.Target} target |
| 58 */ | 58 */ |
| 59 targetAdded(target) { | 59 targetAdded(target) { |
| 60 var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); | 60 var debuggerModel = SDK.DebuggerModel.fromTarget(target); |
| 61 if (debuggerModel) | 61 if (debuggerModel) |
| 62 this._mappingForTarget.set(target, new WebInspector.SnippetScriptMapping(d
ebuggerModel, this)); | 62 this._mappingForTarget.set(target, new Snippets.SnippetScriptMapping(debug
gerModel, this)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 /** | 65 /** |
| 66 * @override | 66 * @override |
| 67 * @param {!WebInspector.Target} target | 67 * @param {!SDK.Target} target |
| 68 */ | 68 */ |
| 69 targetRemoved(target) { | 69 targetRemoved(target) { |
| 70 if (WebInspector.DebuggerModel.fromTarget(target)) | 70 if (SDK.DebuggerModel.fromTarget(target)) |
| 71 this._mappingForTarget.remove(target); | 71 this._mappingForTarget.remove(target); |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * @param {!WebInspector.Target} target | 75 * @param {!SDK.Target} target |
| 76 * @return {!WebInspector.SnippetScriptMapping|undefined} | 76 * @return {!Snippets.SnippetScriptMapping|undefined} |
| 77 */ | 77 */ |
| 78 snippetScriptMapping(target) { | 78 snippetScriptMapping(target) { |
| 79 return this._mappingForTarget.get(target); | 79 return this._mappingForTarget.get(target); |
| 80 } | 80 } |
| 81 | 81 |
| 82 /** | 82 /** |
| 83 * @return {!WebInspector.Project} | 83 * @return {!Workspace.Project} |
| 84 */ | 84 */ |
| 85 project() { | 85 project() { |
| 86 return this._project; | 86 return this._project; |
| 87 } | 87 } |
| 88 | 88 |
| 89 _loadSnippets() { | 89 _loadSnippets() { |
| 90 for (var snippet of this._snippetStorage.snippets()) | 90 for (var snippet of this._snippetStorage.snippets()) |
| 91 this._addScriptSnippet(snippet); | 91 this._addScriptSnippet(snippet); |
| 92 } | 92 } |
| 93 | 93 |
| 94 /** | 94 /** |
| 95 * @param {string} content | 95 * @param {string} content |
| 96 * @return {!WebInspector.UISourceCode} | 96 * @return {!Workspace.UISourceCode} |
| 97 */ | 97 */ |
| 98 createScriptSnippet(content) { | 98 createScriptSnippet(content) { |
| 99 var snippet = this._snippetStorage.createSnippet(); | 99 var snippet = this._snippetStorage.createSnippet(); |
| 100 snippet.content = content; | 100 snippet.content = content; |
| 101 return this._addScriptSnippet(snippet); | 101 return this._addScriptSnippet(snippet); |
| 102 } | 102 } |
| 103 | 103 |
| 104 /** | 104 /** |
| 105 * @param {!WebInspector.Snippet} snippet | 105 * @param {!Snippets.Snippet} snippet |
| 106 * @return {!WebInspector.UISourceCode} | 106 * @return {!Workspace.UISourceCode} |
| 107 */ | 107 */ |
| 108 _addScriptSnippet(snippet) { | 108 _addScriptSnippet(snippet) { |
| 109 var uiSourceCode = this._project.addSnippet(snippet.name, new WebInspector.S
nippetContentProvider(snippet)); | 109 var uiSourceCode = this._project.addSnippet(snippet.name, new Snippets.Snipp
etContentProvider(snippet)); |
| 110 uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.WorkingCopyCh
anged, this._workingCopyChanged, this); | 110 uiSourceCode.addEventListener(Workspace.UISourceCode.Events.WorkingCopyChang
ed, this._workingCopyChanged, this); |
| 111 this._snippetIdForUISourceCode.set(uiSourceCode, snippet.id); | 111 this._snippetIdForUISourceCode.set(uiSourceCode, snippet.id); |
| 112 var breakpointLocations = this._removeBreakpoints(uiSourceCode); | 112 var breakpointLocations = this._removeBreakpoints(uiSourceCode); |
| 113 this._restoreBreakpoints(uiSourceCode, breakpointLocations); | 113 this._restoreBreakpoints(uiSourceCode, breakpointLocations); |
| 114 this._uiSourceCodeForSnippetId[snippet.id] = uiSourceCode; | 114 this._uiSourceCodeForSnippetId[snippet.id] = uiSourceCode; |
| 115 return uiSourceCode; | 115 return uiSourceCode; |
| 116 } | 116 } |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * @param {!WebInspector.Event} event | 119 * @param {!Common.Event} event |
| 120 */ | 120 */ |
| 121 _workingCopyChanged(event) { | 121 _workingCopyChanged(event) { |
| 122 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.target); | 122 var uiSourceCode = /** @type {!Workspace.UISourceCode} */ (event.target); |
| 123 this._scriptSnippetEdited(uiSourceCode); | 123 this._scriptSnippetEdited(uiSourceCode); |
| 124 } | 124 } |
| 125 | 125 |
| 126 /** | 126 /** |
| 127 * @param {string} url | 127 * @param {string} url |
| 128 */ | 128 */ |
| 129 deleteScriptSnippet(url) { | 129 deleteScriptSnippet(url) { |
| 130 var uiSourceCode = this._project.uiSourceCodeForURL(url); | 130 var uiSourceCode = this._project.uiSourceCodeForURL(url); |
| 131 if (!uiSourceCode) | 131 if (!uiSourceCode) |
| 132 return; | 132 return; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 /** | 167 /** |
| 168 * @param {string} name | 168 * @param {string} name |
| 169 * @param {string} newContent | 169 * @param {string} newContent |
| 170 */ | 170 */ |
| 171 _setScriptSnippetContent(name, newContent) { | 171 _setScriptSnippetContent(name, newContent) { |
| 172 var snippet = this._snippetStorage.snippetForName(name); | 172 var snippet = this._snippetStorage.snippetForName(name); |
| 173 snippet.content = newContent; | 173 snippet.content = newContent; |
| 174 } | 174 } |
| 175 | 175 |
| 176 /** | 176 /** |
| 177 * @param {!WebInspector.UISourceCode} uiSourceCode | 177 * @param {!Workspace.UISourceCode} uiSourceCode |
| 178 */ | 178 */ |
| 179 _scriptSnippetEdited(uiSourceCode) { | 179 _scriptSnippetEdited(uiSourceCode) { |
| 180 var breakpointLocations = this._removeBreakpoints(uiSourceCode); | 180 var breakpointLocations = this._removeBreakpoints(uiSourceCode); |
| 181 this._releaseSnippetScript(uiSourceCode); | 181 this._releaseSnippetScript(uiSourceCode); |
| 182 this._restoreBreakpoints(uiSourceCode, breakpointLocations); | 182 this._restoreBreakpoints(uiSourceCode, breakpointLocations); |
| 183 this._mappingForTarget.valuesArray().forEach(function(mapping) { | 183 this._mappingForTarget.valuesArray().forEach(function(mapping) { |
| 184 mapping._restoreBreakpoints(uiSourceCode, breakpointLocations); | 184 mapping._restoreBreakpoints(uiSourceCode, breakpointLocations); |
| 185 }); | 185 }); |
| 186 } | 186 } |
| 187 | 187 |
| 188 /** | 188 /** |
| 189 * @return {number} | 189 * @return {number} |
| 190 */ | 190 */ |
| 191 _nextEvaluationIndex() { | 191 _nextEvaluationIndex() { |
| 192 var evaluationIndex = this._lastSnippetEvaluationIndexSetting.get() + 1; | 192 var evaluationIndex = this._lastSnippetEvaluationIndexSetting.get() + 1; |
| 193 this._lastSnippetEvaluationIndexSetting.set(evaluationIndex); | 193 this._lastSnippetEvaluationIndexSetting.set(evaluationIndex); |
| 194 return evaluationIndex; | 194 return evaluationIndex; |
| 195 } | 195 } |
| 196 | 196 |
| 197 /** | 197 /** |
| 198 * @param {!WebInspector.ExecutionContext} executionContext | 198 * @param {!SDK.ExecutionContext} executionContext |
| 199 * @param {!WebInspector.UISourceCode} uiSourceCode | 199 * @param {!Workspace.UISourceCode} uiSourceCode |
| 200 */ | 200 */ |
| 201 evaluateScriptSnippet(executionContext, uiSourceCode) { | 201 evaluateScriptSnippet(executionContext, uiSourceCode) { |
| 202 var breakpointLocations = this._removeBreakpoints(uiSourceCode); | 202 var breakpointLocations = this._removeBreakpoints(uiSourceCode); |
| 203 this._releaseSnippetScript(uiSourceCode); | 203 this._releaseSnippetScript(uiSourceCode); |
| 204 this._restoreBreakpoints(uiSourceCode, breakpointLocations); | 204 this._restoreBreakpoints(uiSourceCode, breakpointLocations); |
| 205 | 205 |
| 206 var target = executionContext.target(); | 206 var target = executionContext.target(); |
| 207 var runtimeModel = target.runtimeModel; | 207 var runtimeModel = target.runtimeModel; |
| 208 var evaluationIndex = this._nextEvaluationIndex(); | 208 var evaluationIndex = this._nextEvaluationIndex(); |
| 209 var mapping = this._mappingForTarget.get(target); | 209 var mapping = this._mappingForTarget.get(target); |
| 210 mapping._setEvaluationIndex(evaluationIndex, uiSourceCode); | 210 mapping._setEvaluationIndex(evaluationIndex, uiSourceCode); |
| 211 var evaluationUrl = mapping._evaluationSourceURL(uiSourceCode); | 211 var evaluationUrl = mapping._evaluationSourceURL(uiSourceCode); |
| 212 uiSourceCode.requestContent().then(compileSnippet.bind(this)); | 212 uiSourceCode.requestContent().then(compileSnippet.bind(this)); |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * @this {WebInspector.ScriptSnippetModel} | 215 * @this {Snippets.ScriptSnippetModel} |
| 216 */ | 216 */ |
| 217 function compileSnippet() { | 217 function compileSnippet() { |
| 218 var expression = uiSourceCode.workingCopy(); | 218 var expression = uiSourceCode.workingCopy(); |
| 219 WebInspector.console.show(); | 219 Common.console.show(); |
| 220 runtimeModel.compileScript(expression, '', true, executionContext.id, comp
ileCallback.bind(this)); | 220 runtimeModel.compileScript(expression, '', true, executionContext.id, comp
ileCallback.bind(this)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 /** | 223 /** |
| 224 * @param {!Protocol.Runtime.ScriptId=} scriptId | 224 * @param {!Protocol.Runtime.ScriptId=} scriptId |
| 225 * @param {?Protocol.Runtime.ExceptionDetails=} exceptionDetails | 225 * @param {?Protocol.Runtime.ExceptionDetails=} exceptionDetails |
| 226 * @this {WebInspector.ScriptSnippetModel} | 226 * @this {Snippets.ScriptSnippetModel} |
| 227 */ | 227 */ |
| 228 function compileCallback(scriptId, exceptionDetails) { | 228 function compileCallback(scriptId, exceptionDetails) { |
| 229 var mapping = this._mappingForTarget.get(target); | 229 var mapping = this._mappingForTarget.get(target); |
| 230 if (mapping.evaluationIndex(uiSourceCode) !== evaluationIndex) | 230 if (mapping.evaluationIndex(uiSourceCode) !== evaluationIndex) |
| 231 return; | 231 return; |
| 232 | 232 |
| 233 var script = /** @type {!WebInspector.Script} */ ( | 233 var script = /** @type {!SDK.Script} */ ( |
| 234 executionContext.debuggerModel.scriptForId(/** @type {string} */ (scri
ptId || exceptionDetails.scriptId))); | 234 executionContext.debuggerModel.scriptForId(/** @type {string} */ (scri
ptId || exceptionDetails.scriptId))); |
| 235 mapping._addScript(script, uiSourceCode); | 235 mapping._addScript(script, uiSourceCode); |
| 236 if (!scriptId) { | 236 if (!scriptId) { |
| 237 this._printRunOrCompileScriptResultFailure( | 237 this._printRunOrCompileScriptResultFailure( |
| 238 target, /** @type {!Protocol.Runtime.ExceptionDetails} */ (exception
Details), evaluationUrl); | 238 target, /** @type {!Protocol.Runtime.ExceptionDetails} */ (exception
Details), evaluationUrl); |
| 239 return; | 239 return; |
| 240 } | 240 } |
| 241 | 241 |
| 242 var breakpointLocations = this._removeBreakpoints(uiSourceCode); | 242 var breakpointLocations = this._removeBreakpoints(uiSourceCode); |
| 243 this._restoreBreakpoints(uiSourceCode, breakpointLocations); | 243 this._restoreBreakpoints(uiSourceCode, breakpointLocations); |
| 244 | 244 |
| 245 this._runScript(scriptId, executionContext, evaluationUrl); | 245 this._runScript(scriptId, executionContext, evaluationUrl); |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 | 248 |
| 249 /** | 249 /** |
| 250 * @param {!Protocol.Runtime.ScriptId} scriptId | 250 * @param {!Protocol.Runtime.ScriptId} scriptId |
| 251 * @param {!WebInspector.ExecutionContext} executionContext | 251 * @param {!SDK.ExecutionContext} executionContext |
| 252 * @param {?string=} sourceURL | 252 * @param {?string=} sourceURL |
| 253 */ | 253 */ |
| 254 _runScript(scriptId, executionContext, sourceURL) { | 254 _runScript(scriptId, executionContext, sourceURL) { |
| 255 var target = executionContext.target(); | 255 var target = executionContext.target(); |
| 256 target.runtimeModel.runScript( | 256 target.runtimeModel.runScript( |
| 257 scriptId, executionContext.id, 'console', /* silent */ false, /* include
CommandLineAPI */ true, | 257 scriptId, executionContext.id, 'console', /* silent */ false, /* include
CommandLineAPI */ true, |
| 258 /* returnByValue */ false, /* generatePreview */ true, /* awaitPromise *
/ undefined, | 258 /* returnByValue */ false, /* generatePreview */ true, /* awaitPromise *
/ undefined, |
| 259 runCallback.bind(this, target)); | 259 runCallback.bind(this, target)); |
| 260 | 260 |
| 261 /** | 261 /** |
| 262 * @param {!WebInspector.Target} target | 262 * @param {!SDK.Target} target |
| 263 * @param {?Protocol.Runtime.RemoteObject} result | 263 * @param {?Protocol.Runtime.RemoteObject} result |
| 264 * @param {?Protocol.Runtime.ExceptionDetails=} exceptionDetails | 264 * @param {?Protocol.Runtime.ExceptionDetails=} exceptionDetails |
| 265 * @this {WebInspector.ScriptSnippetModel} | 265 * @this {Snippets.ScriptSnippetModel} |
| 266 */ | 266 */ |
| 267 function runCallback(target, result, exceptionDetails) { | 267 function runCallback(target, result, exceptionDetails) { |
| 268 if (!exceptionDetails) | 268 if (!exceptionDetails) |
| 269 this._printRunScriptResult(target, result, scriptId, sourceURL); | 269 this._printRunScriptResult(target, result, scriptId, sourceURL); |
| 270 else | 270 else |
| 271 this._printRunOrCompileScriptResultFailure(target, exceptionDetails, sou
rceURL); | 271 this._printRunOrCompileScriptResultFailure(target, exceptionDetails, sou
rceURL); |
| 272 } | 272 } |
| 273 } | 273 } |
| 274 | 274 |
| 275 /** | 275 /** |
| 276 * @param {!WebInspector.Target} target | 276 * @param {!SDK.Target} target |
| 277 * @param {?Protocol.Runtime.RemoteObject} result | 277 * @param {?Protocol.Runtime.RemoteObject} result |
| 278 * @param {!Protocol.Runtime.ScriptId} scriptId | 278 * @param {!Protocol.Runtime.ScriptId} scriptId |
| 279 * @param {?string=} sourceURL | 279 * @param {?string=} sourceURL |
| 280 */ | 280 */ |
| 281 _printRunScriptResult(target, result, scriptId, sourceURL) { | 281 _printRunScriptResult(target, result, scriptId, sourceURL) { |
| 282 var consoleMessage = new WebInspector.ConsoleMessage( | 282 var consoleMessage = new SDK.ConsoleMessage( |
| 283 target, WebInspector.ConsoleMessage.MessageSource.JS, WebInspector.Conso
leMessage.MessageLevel.Log, '', | 283 target, SDK.ConsoleMessage.MessageSource.JS, SDK.ConsoleMessage.MessageL
evel.Log, '', |
| 284 undefined, sourceURL, undefined, undefined, undefined, [result], undefin
ed, undefined, undefined, scriptId); | 284 undefined, sourceURL, undefined, undefined, undefined, [result], undefin
ed, undefined, undefined, scriptId); |
| 285 target.consoleModel.addMessage(consoleMessage); | 285 target.consoleModel.addMessage(consoleMessage); |
| 286 } | 286 } |
| 287 | 287 |
| 288 /** | 288 /** |
| 289 * @param {!WebInspector.Target} target | 289 * @param {!SDK.Target} target |
| 290 * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails | 290 * @param {!Protocol.Runtime.ExceptionDetails} exceptionDetails |
| 291 * @param {?string=} sourceURL | 291 * @param {?string=} sourceURL |
| 292 */ | 292 */ |
| 293 _printRunOrCompileScriptResultFailure(target, exceptionDetails, sourceURL) { | 293 _printRunOrCompileScriptResultFailure(target, exceptionDetails, sourceURL) { |
| 294 target.consoleModel.addMessage(WebInspector.ConsoleMessage.fromException( | 294 target.consoleModel.addMessage(SDK.ConsoleMessage.fromException( |
| 295 target, exceptionDetails, undefined, undefined, sourceURL || undefined))
; | 295 target, exceptionDetails, undefined, undefined, sourceURL || undefined))
; |
| 296 } | 296 } |
| 297 | 297 |
| 298 /** | 298 /** |
| 299 * @param {!WebInspector.UISourceCode} uiSourceCode | 299 * @param {!Workspace.UISourceCode} uiSourceCode |
| 300 * @return {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint,
uiLocation: !WebInspector.UILocation}>} | 300 * @return {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLo
cation: !Workspace.UILocation}>} |
| 301 */ | 301 */ |
| 302 _removeBreakpoints(uiSourceCode) { | 302 _removeBreakpoints(uiSourceCode) { |
| 303 var breakpointLocations = WebInspector.breakpointManager.breakpointLocations
ForUISourceCode(uiSourceCode); | 303 var breakpointLocations = Bindings.breakpointManager.breakpointLocationsForU
ISourceCode(uiSourceCode); |
| 304 for (var i = 0; i < breakpointLocations.length; ++i) | 304 for (var i = 0; i < breakpointLocations.length; ++i) |
| 305 breakpointLocations[i].breakpoint.remove(); | 305 breakpointLocations[i].breakpoint.remove(); |
| 306 return breakpointLocations; | 306 return breakpointLocations; |
| 307 } | 307 } |
| 308 | 308 |
| 309 /** | 309 /** |
| 310 * @param {!WebInspector.UISourceCode} uiSourceCode | 310 * @param {!Workspace.UISourceCode} uiSourceCode |
| 311 * @param {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint, u
iLocation: !WebInspector.UILocation}>} breakpointLocations | 311 * @param {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLoc
ation: !Workspace.UILocation}>} breakpointLocations |
| 312 */ | 312 */ |
| 313 _restoreBreakpoints(uiSourceCode, breakpointLocations) { | 313 _restoreBreakpoints(uiSourceCode, breakpointLocations) { |
| 314 for (var i = 0; i < breakpointLocations.length; ++i) { | 314 for (var i = 0; i < breakpointLocations.length; ++i) { |
| 315 var uiLocation = breakpointLocations[i].uiLocation; | 315 var uiLocation = breakpointLocations[i].uiLocation; |
| 316 var breakpoint = breakpointLocations[i].breakpoint; | 316 var breakpoint = breakpointLocations[i].breakpoint; |
| 317 WebInspector.breakpointManager.setBreakpoint( | 317 Bindings.breakpointManager.setBreakpoint( |
| 318 uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, breakpoi
nt.condition(), breakpoint.enabled()); | 318 uiSourceCode, uiLocation.lineNumber, uiLocation.columnNumber, breakpoi
nt.condition(), breakpoint.enabled()); |
| 319 } | 319 } |
| 320 } | 320 } |
| 321 | 321 |
| 322 /** | 322 /** |
| 323 * @param {!WebInspector.UISourceCode} uiSourceCode | 323 * @param {!Workspace.UISourceCode} uiSourceCode |
| 324 */ | 324 */ |
| 325 _releaseSnippetScript(uiSourceCode) { | 325 _releaseSnippetScript(uiSourceCode) { |
| 326 this._mappingForTarget.valuesArray().forEach(function(mapping) { | 326 this._mappingForTarget.valuesArray().forEach(function(mapping) { |
| 327 mapping._releaseSnippetScript(uiSourceCode); | 327 mapping._releaseSnippetScript(uiSourceCode); |
| 328 }); | 328 }); |
| 329 } | 329 } |
| 330 | 330 |
| 331 /** | 331 /** |
| 332 * @param {string} sourceURL | 332 * @param {string} sourceURL |
| 333 * @return {?string} | 333 * @return {?string} |
| 334 */ | 334 */ |
| 335 _snippetIdForSourceURL(sourceURL) { | 335 _snippetIdForSourceURL(sourceURL) { |
| 336 var snippetPrefix = WebInspector.ScriptSnippetModel.snippetSourceURLPrefix; | 336 var snippetPrefix = Snippets.ScriptSnippetModel.snippetSourceURLPrefix; |
| 337 if (!sourceURL.startsWith(snippetPrefix)) | 337 if (!sourceURL.startsWith(snippetPrefix)) |
| 338 return null; | 338 return null; |
| 339 var splitURL = sourceURL.substring(snippetPrefix.length).split('_'); | 339 var splitURL = sourceURL.substring(snippetPrefix.length).split('_'); |
| 340 var snippetId = splitURL[0]; | 340 var snippetId = splitURL[0]; |
| 341 return snippetId; | 341 return snippetId; |
| 342 } | 342 } |
| 343 }; | 343 }; |
| 344 | 344 |
| 345 WebInspector.ScriptSnippetModel.snippetSourceURLPrefix = 'snippets:///'; | 345 Snippets.ScriptSnippetModel.snippetSourceURLPrefix = 'snippets:///'; |
| 346 | 346 |
| 347 /** | 347 /** |
| 348 * @implements {WebInspector.DebuggerSourceMapping} | 348 * @implements {Bindings.DebuggerSourceMapping} |
| 349 * @unrestricted | 349 * @unrestricted |
| 350 */ | 350 */ |
| 351 WebInspector.SnippetScriptMapping = class { | 351 Snippets.SnippetScriptMapping = class { |
| 352 /** | 352 /** |
| 353 * @param {!WebInspector.DebuggerModel} debuggerModel | 353 * @param {!SDK.DebuggerModel} debuggerModel |
| 354 * @param {!WebInspector.ScriptSnippetModel} scriptSnippetModel | 354 * @param {!Snippets.ScriptSnippetModel} scriptSnippetModel |
| 355 */ | 355 */ |
| 356 constructor(debuggerModel, scriptSnippetModel) { | 356 constructor(debuggerModel, scriptSnippetModel) { |
| 357 this._target = debuggerModel.target(); | 357 this._target = debuggerModel.target(); |
| 358 this._debuggerModel = debuggerModel; | 358 this._debuggerModel = debuggerModel; |
| 359 this._scriptSnippetModel = scriptSnippetModel; | 359 this._scriptSnippetModel = scriptSnippetModel; |
| 360 /** @type {!Object.<string, !WebInspector.UISourceCode>} */ | 360 /** @type {!Object.<string, !Workspace.UISourceCode>} */ |
| 361 this._uiSourceCodeForScriptId = {}; | 361 this._uiSourceCodeForScriptId = {}; |
| 362 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.Script>} */ | 362 /** @type {!Map.<!Workspace.UISourceCode, !SDK.Script>} */ |
| 363 this._scriptForUISourceCode = new Map(); | 363 this._scriptForUISourceCode = new Map(); |
| 364 /** @type {!Map.<!WebInspector.UISourceCode, number>} */ | 364 /** @type {!Map.<!Workspace.UISourceCode, number>} */ |
| 365 this._evaluationIndexForUISourceCode = new Map(); | 365 this._evaluationIndexForUISourceCode = new Map(); |
| 366 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.GlobalObjec
tCleared, this._reset, this); | 366 debuggerModel.addEventListener(SDK.DebuggerModel.Events.GlobalObjectCleared,
this._reset, this); |
| 367 } | 367 } |
| 368 | 368 |
| 369 /** | 369 /** |
| 370 * @param {!WebInspector.UISourceCode} uiSourceCode | 370 * @param {!Workspace.UISourceCode} uiSourceCode |
| 371 */ | 371 */ |
| 372 _releaseSnippetScript(uiSourceCode) { | 372 _releaseSnippetScript(uiSourceCode) { |
| 373 var script = this._scriptForUISourceCode.get(uiSourceCode); | 373 var script = this._scriptForUISourceCode.get(uiSourceCode); |
| 374 if (!script) | 374 if (!script) |
| 375 return; | 375 return; |
| 376 | 376 |
| 377 delete this._uiSourceCodeForScriptId[script.scriptId]; | 377 delete this._uiSourceCodeForScriptId[script.scriptId]; |
| 378 this._scriptForUISourceCode.remove(uiSourceCode); | 378 this._scriptForUISourceCode.remove(uiSourceCode); |
| 379 this._evaluationIndexForUISourceCode.remove(uiSourceCode); | 379 this._evaluationIndexForUISourceCode.remove(uiSourceCode); |
| 380 } | 380 } |
| 381 | 381 |
| 382 /** | 382 /** |
| 383 * @param {number} evaluationIndex | 383 * @param {number} evaluationIndex |
| 384 * @param {!WebInspector.UISourceCode} uiSourceCode | 384 * @param {!Workspace.UISourceCode} uiSourceCode |
| 385 */ | 385 */ |
| 386 _setEvaluationIndex(evaluationIndex, uiSourceCode) { | 386 _setEvaluationIndex(evaluationIndex, uiSourceCode) { |
| 387 this._evaluationIndexForUISourceCode.set(uiSourceCode, evaluationIndex); | 387 this._evaluationIndexForUISourceCode.set(uiSourceCode, evaluationIndex); |
| 388 } | 388 } |
| 389 | 389 |
| 390 /** | 390 /** |
| 391 * @param {!WebInspector.UISourceCode} uiSourceCode | 391 * @param {!Workspace.UISourceCode} uiSourceCode |
| 392 * @return {number|undefined} | 392 * @return {number|undefined} |
| 393 */ | 393 */ |
| 394 evaluationIndex(uiSourceCode) { | 394 evaluationIndex(uiSourceCode) { |
| 395 return this._evaluationIndexForUISourceCode.get(uiSourceCode); | 395 return this._evaluationIndexForUISourceCode.get(uiSourceCode); |
| 396 } | 396 } |
| 397 | 397 |
| 398 /** | 398 /** |
| 399 * @param {!WebInspector.UISourceCode} uiSourceCode | 399 * @param {!Workspace.UISourceCode} uiSourceCode |
| 400 * @return {string} | 400 * @return {string} |
| 401 */ | 401 */ |
| 402 _evaluationSourceURL(uiSourceCode) { | 402 _evaluationSourceURL(uiSourceCode) { |
| 403 var evaluationSuffix = '_' + this._evaluationIndexForUISourceCode.get(uiSour
ceCode); | 403 var evaluationSuffix = '_' + this._evaluationIndexForUISourceCode.get(uiSour
ceCode); |
| 404 var snippetId = this._scriptSnippetModel._snippetIdForUISourceCode.get(uiSou
rceCode); | 404 var snippetId = this._scriptSnippetModel._snippetIdForUISourceCode.get(uiSou
rceCode); |
| 405 return WebInspector.ScriptSnippetModel.snippetSourceURLPrefix + snippetId +
evaluationSuffix; | 405 return Snippets.ScriptSnippetModel.snippetSourceURLPrefix + snippetId + eval
uationSuffix; |
| 406 } | 406 } |
| 407 | 407 |
| 408 _reset() { | 408 _reset() { |
| 409 this._uiSourceCodeForScriptId = {}; | 409 this._uiSourceCodeForScriptId = {}; |
| 410 this._scriptForUISourceCode.clear(); | 410 this._scriptForUISourceCode.clear(); |
| 411 this._evaluationIndexForUISourceCode.clear(); | 411 this._evaluationIndexForUISourceCode.clear(); |
| 412 } | 412 } |
| 413 | 413 |
| 414 /** | 414 /** |
| 415 * @override | 415 * @override |
| 416 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 416 * @param {!SDK.DebuggerModel.Location} rawLocation |
| 417 * @return {?WebInspector.UILocation} | 417 * @return {?Workspace.UILocation} |
| 418 */ | 418 */ |
| 419 rawLocationToUILocation(rawLocation) { | 419 rawLocationToUILocation(rawLocation) { |
| 420 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Location}
*/ (rawLocation); | 420 var debuggerModelLocation = /** @type {!SDK.DebuggerModel.Location} */ (rawL
ocation); |
| 421 var uiSourceCode = this._uiSourceCodeForScriptId[debuggerModelLocation.scrip
tId]; | 421 var uiSourceCode = this._uiSourceCodeForScriptId[debuggerModelLocation.scrip
tId]; |
| 422 if (!uiSourceCode) | 422 if (!uiSourceCode) |
| 423 return null; | 423 return null; |
| 424 | 424 |
| 425 return uiSourceCode.uiLocation(debuggerModelLocation.lineNumber, debuggerMod
elLocation.columnNumber || 0); | 425 return uiSourceCode.uiLocation(debuggerModelLocation.lineNumber, debuggerMod
elLocation.columnNumber || 0); |
| 426 } | 426 } |
| 427 | 427 |
| 428 /** | 428 /** |
| 429 * @override | 429 * @override |
| 430 * @param {!WebInspector.UISourceCode} uiSourceCode | 430 * @param {!Workspace.UISourceCode} uiSourceCode |
| 431 * @param {number} lineNumber | 431 * @param {number} lineNumber |
| 432 * @param {number} columnNumber | 432 * @param {number} columnNumber |
| 433 * @return {?WebInspector.DebuggerModel.Location} | 433 * @return {?SDK.DebuggerModel.Location} |
| 434 */ | 434 */ |
| 435 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { | 435 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { |
| 436 var script = this._scriptForUISourceCode.get(uiSourceCode); | 436 var script = this._scriptForUISourceCode.get(uiSourceCode); |
| 437 if (!script) | 437 if (!script) |
| 438 return null; | 438 return null; |
| 439 | 439 |
| 440 return this._debuggerModel.createRawLocation(script, lineNumber, columnNumbe
r); | 440 return this._debuggerModel.createRawLocation(script, lineNumber, columnNumbe
r); |
| 441 } | 441 } |
| 442 | 442 |
| 443 /** | 443 /** |
| 444 * @param {!WebInspector.Script} script | 444 * @param {!SDK.Script} script |
| 445 * @param {!WebInspector.UISourceCode} uiSourceCode | 445 * @param {!Workspace.UISourceCode} uiSourceCode |
| 446 */ | 446 */ |
| 447 _addScript(script, uiSourceCode) { | 447 _addScript(script, uiSourceCode) { |
| 448 console.assert(!this._scriptForUISourceCode.get(uiSourceCode)); | 448 console.assert(!this._scriptForUISourceCode.get(uiSourceCode)); |
| 449 WebInspector.debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourc
eCode, this); | 449 Bindings.debuggerWorkspaceBinding.setSourceMapping(this._target, uiSourceCod
e, this); |
| 450 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode; | 450 this._uiSourceCodeForScriptId[script.scriptId] = uiSourceCode; |
| 451 this._scriptForUISourceCode.set(uiSourceCode, script); | 451 this._scriptForUISourceCode.set(uiSourceCode, script); |
| 452 WebInspector.debuggerWorkspaceBinding.pushSourceMapping(script, this); | 452 Bindings.debuggerWorkspaceBinding.pushSourceMapping(script, this); |
| 453 } | 453 } |
| 454 | 454 |
| 455 /** | 455 /** |
| 456 * @param {!WebInspector.UISourceCode} uiSourceCode | 456 * @param {!Workspace.UISourceCode} uiSourceCode |
| 457 * @param {!Array.<!{breakpoint: !WebInspector.BreakpointManager.Breakpoint, u
iLocation: !WebInspector.UILocation}>} breakpointLocations | 457 * @param {!Array.<!{breakpoint: !Bindings.BreakpointManager.Breakpoint, uiLoc
ation: !Workspace.UILocation}>} breakpointLocations |
| 458 */ | 458 */ |
| 459 _restoreBreakpoints(uiSourceCode, breakpointLocations) { | 459 _restoreBreakpoints(uiSourceCode, breakpointLocations) { |
| 460 var script = this._scriptForUISourceCode.get(uiSourceCode); | 460 var script = this._scriptForUISourceCode.get(uiSourceCode); |
| 461 if (!script) | 461 if (!script) |
| 462 return; | 462 return; |
| 463 var rawLocation = | 463 var rawLocation = |
| 464 /** @type {!WebInspector.DebuggerModel.Location} */ (this._debuggerModel
.createRawLocation(script, 0, 0)); | 464 /** @type {!SDK.DebuggerModel.Location} */ (this._debuggerModel.createRa
wLocation(script, 0, 0)); |
| 465 var scriptUISourceCode = WebInspector.debuggerWorkspaceBinding.rawLocationTo
UILocation(rawLocation).uiSourceCode; | 465 var scriptUISourceCode = Bindings.debuggerWorkspaceBinding.rawLocationToUILo
cation(rawLocation).uiSourceCode; |
| 466 if (scriptUISourceCode) | 466 if (scriptUISourceCode) |
| 467 this._scriptSnippetModel._restoreBreakpoints(scriptUISourceCode, breakpoin
tLocations); | 467 this._scriptSnippetModel._restoreBreakpoints(scriptUISourceCode, breakpoin
tLocations); |
| 468 } | 468 } |
| 469 | 469 |
| 470 /** | 470 /** |
| 471 * @override | 471 * @override |
| 472 * @return {boolean} | 472 * @return {boolean} |
| 473 */ | 473 */ |
| 474 isIdentity() { | 474 isIdentity() { |
| 475 return false; | 475 return false; |
| 476 } | 476 } |
| 477 | 477 |
| 478 /** | 478 /** |
| 479 * @override | 479 * @override |
| 480 * @param {!WebInspector.UISourceCode} uiSourceCode | 480 * @param {!Workspace.UISourceCode} uiSourceCode |
| 481 * @param {number} lineNumber | 481 * @param {number} lineNumber |
| 482 * @return {boolean} | 482 * @return {boolean} |
| 483 */ | 483 */ |
| 484 uiLineHasMapping(uiSourceCode, lineNumber) { | 484 uiLineHasMapping(uiSourceCode, lineNumber) { |
| 485 return true; | 485 return true; |
| 486 } | 486 } |
| 487 }; | 487 }; |
| 488 | 488 |
| 489 /** | 489 /** |
| 490 * @implements {WebInspector.ContentProvider} | 490 * @implements {Common.ContentProvider} |
| 491 * @unrestricted | 491 * @unrestricted |
| 492 */ | 492 */ |
| 493 WebInspector.SnippetContentProvider = class { | 493 Snippets.SnippetContentProvider = class { |
| 494 /** | 494 /** |
| 495 * @param {!WebInspector.Snippet} snippet | 495 * @param {!Snippets.Snippet} snippet |
| 496 */ | 496 */ |
| 497 constructor(snippet) { | 497 constructor(snippet) { |
| 498 this._snippet = snippet; | 498 this._snippet = snippet; |
| 499 } | 499 } |
| 500 | 500 |
| 501 /** | 501 /** |
| 502 * @override | 502 * @override |
| 503 * @return {string} | 503 * @return {string} |
| 504 */ | 504 */ |
| 505 contentURL() { | 505 contentURL() { |
| 506 return ''; | 506 return ''; |
| 507 } | 507 } |
| 508 | 508 |
| 509 /** | 509 /** |
| 510 * @override | 510 * @override |
| 511 * @return {!WebInspector.ResourceType} | 511 * @return {!Common.ResourceType} |
| 512 */ | 512 */ |
| 513 contentType() { | 513 contentType() { |
| 514 return WebInspector.resourceTypes.Snippet; | 514 return Common.resourceTypes.Snippet; |
| 515 } | 515 } |
| 516 | 516 |
| 517 /** | 517 /** |
| 518 * @override | 518 * @override |
| 519 * @return {!Promise<?string>} | 519 * @return {!Promise<?string>} |
| 520 */ | 520 */ |
| 521 requestContent() { | 521 requestContent() { |
| 522 return Promise.resolve(/** @type {?string} */ (this._snippet.content)); | 522 return Promise.resolve(/** @type {?string} */ (this._snippet.content)); |
| 523 } | 523 } |
| 524 | 524 |
| 525 /** | 525 /** |
| 526 * @override | 526 * @override |
| 527 * @param {string} query | 527 * @param {string} query |
| 528 * @param {boolean} caseSensitive | 528 * @param {boolean} caseSensitive |
| 529 * @param {boolean} isRegex | 529 * @param {boolean} isRegex |
| 530 * @param {function(!Array.<!WebInspector.ContentProvider.SearchMatch>)} callb
ack | 530 * @param {function(!Array.<!Common.ContentProvider.SearchMatch>)} callback |
| 531 */ | 531 */ |
| 532 searchInContent(query, caseSensitive, isRegex, callback) { | 532 searchInContent(query, caseSensitive, isRegex, callback) { |
| 533 /** | 533 /** |
| 534 * @this {WebInspector.SnippetContentProvider} | 534 * @this {Snippets.SnippetContentProvider} |
| 535 */ | 535 */ |
| 536 function performSearch() { | 536 function performSearch() { |
| 537 callback( | 537 callback( |
| 538 WebInspector.ContentProvider.performSearchInContent(this._snippet.cont
ent, query, caseSensitive, isRegex)); | 538 Common.ContentProvider.performSearchInContent(this._snippet.content, q
uery, caseSensitive, isRegex)); |
| 539 } | 539 } |
| 540 | 540 |
| 541 // searchInContent should call back later. | 541 // searchInContent should call back later. |
| 542 window.setTimeout(performSearch.bind(this), 0); | 542 window.setTimeout(performSearch.bind(this), 0); |
| 543 } | 543 } |
| 544 }; | 544 }; |
| 545 | 545 |
| 546 /** | 546 /** |
| 547 * @unrestricted | 547 * @unrestricted |
| 548 */ | 548 */ |
| 549 WebInspector.SnippetsProject = class extends WebInspector.ContentProviderBasedPr
oject { | 549 Snippets.SnippetsProject = class extends Bindings.ContentProviderBasedProject { |
| 550 /** | 550 /** |
| 551 * @param {!WebInspector.Workspace} workspace | 551 * @param {!Workspace.Workspace} workspace |
| 552 * @param {!WebInspector.ScriptSnippetModel} model | 552 * @param {!Snippets.ScriptSnippetModel} model |
| 553 */ | 553 */ |
| 554 constructor(workspace, model) { | 554 constructor(workspace, model) { |
| 555 super(workspace, 'snippets:', WebInspector.projectTypes.Snippets, ''); | 555 super(workspace, 'snippets:', Workspace.projectTypes.Snippets, ''); |
| 556 this._model = model; | 556 this._model = model; |
| 557 } | 557 } |
| 558 | 558 |
| 559 /** | 559 /** |
| 560 * @param {string} name | 560 * @param {string} name |
| 561 * @param {!WebInspector.ContentProvider} contentProvider | 561 * @param {!Common.ContentProvider} contentProvider |
| 562 * @return {!WebInspector.UISourceCode} | 562 * @return {!Workspace.UISourceCode} |
| 563 */ | 563 */ |
| 564 addSnippet(name, contentProvider) { | 564 addSnippet(name, contentProvider) { |
| 565 return this.addContentProvider(name, contentProvider); | 565 return this.addContentProvider(name, contentProvider); |
| 566 } | 566 } |
| 567 | 567 |
| 568 /** | 568 /** |
| 569 * @override | 569 * @override |
| 570 * @return {boolean} | 570 * @return {boolean} |
| 571 */ | 571 */ |
| 572 canSetFileContent() { | 572 canSetFileContent() { |
| 573 return true; | 573 return true; |
| 574 } | 574 } |
| 575 | 575 |
| 576 /** | 576 /** |
| 577 * @override | 577 * @override |
| 578 * @param {!WebInspector.UISourceCode} uiSourceCode | 578 * @param {!Workspace.UISourceCode} uiSourceCode |
| 579 * @param {string} newContent | 579 * @param {string} newContent |
| 580 * @param {function(?string)} callback | 580 * @param {function(?string)} callback |
| 581 */ | 581 */ |
| 582 setFileContent(uiSourceCode, newContent, callback) { | 582 setFileContent(uiSourceCode, newContent, callback) { |
| 583 this._model._setScriptSnippetContent(uiSourceCode.url(), newContent); | 583 this._model._setScriptSnippetContent(uiSourceCode.url(), newContent); |
| 584 callback(''); | 584 callback(''); |
| 585 } | 585 } |
| 586 | 586 |
| 587 /** | 587 /** |
| 588 * @override | 588 * @override |
| (...skipping 11 matching lines...) Expand all Loading... |
| 600 */ | 600 */ |
| 601 performRename(url, newName, callback) { | 601 performRename(url, newName, callback) { |
| 602 this._model.renameScriptSnippet(url, newName, callback); | 602 this._model.renameScriptSnippet(url, newName, callback); |
| 603 } | 603 } |
| 604 | 604 |
| 605 /** | 605 /** |
| 606 * @override | 606 * @override |
| 607 * @param {string} url | 607 * @param {string} url |
| 608 * @param {?string} name | 608 * @param {?string} name |
| 609 * @param {string} content | 609 * @param {string} content |
| 610 * @param {function(?WebInspector.UISourceCode)} callback | 610 * @param {function(?Workspace.UISourceCode)} callback |
| 611 */ | 611 */ |
| 612 createFile(url, name, content, callback) { | 612 createFile(url, name, content, callback) { |
| 613 callback(this._model.createScriptSnippet(content)); | 613 callback(this._model.createScriptSnippet(content)); |
| 614 } | 614 } |
| 615 | 615 |
| 616 /** | 616 /** |
| 617 * @override | 617 * @override |
| 618 * @param {string} url | 618 * @param {string} url |
| 619 */ | 619 */ |
| 620 deleteFile(url) { | 620 deleteFile(url) { |
| 621 this._model.deleteScriptSnippet(url); | 621 this._model.deleteScriptSnippet(url); |
| 622 } | 622 } |
| 623 }; | 623 }; |
| 624 | 624 |
| 625 /** | 625 /** |
| 626 * @type {!WebInspector.ScriptSnippetModel} | 626 * @type {!Snippets.ScriptSnippetModel} |
| 627 */ | 627 */ |
| 628 WebInspector.scriptSnippetModel = new WebInspector.ScriptSnippetModel(WebInspect
or.workspace); | 628 Snippets.scriptSnippetModel = new Snippets.ScriptSnippetModel(Workspace.workspac
e); |
| OLD | NEW |