OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 | 299 |
300 if (sourceFrame) | 300 if (sourceFrame) |
301 sourceFrame.addBreakpoint(breakpoint); | 301 sourceFrame.addBreakpoint(breakpoint); |
302 }, | 302 }, |
303 | 303 |
304 canEditScripts: function() | 304 canEditScripts: function() |
305 { | 305 { |
306 return Preferences.canEditScriptSource; | 306 return Preferences.canEditScriptSource; |
307 }, | 307 }, |
308 | 308 |
309 editScriptSource: function(sourceID, newContent, line, linesCountToShift, co
mmitEditingCallback, cancelEditingCallback) | 309 editScriptSource: function(editData, commitEditingCallback, cancelEditingCal
lback) |
310 { | 310 { |
311 if (!this.canEditScripts()) | 311 if (!this.canEditScripts()) |
312 return; | 312 return; |
313 | 313 |
314 // Need to clear breakpoints and re-create them later when editing sourc
e. | 314 // Need to clear breakpoints and re-create them later when editing sourc
e. |
315 var breakpoints = WebInspector.breakpointManager.breakpointsForSourceID(
sourceID); | 315 var breakpoints = WebInspector.breakpointManager.breakpointsForSourceID(
sourceID); |
316 for (var i = 0; i < breakpoints.length; ++i) | 316 for (var i = 0; i < breakpoints.length; ++i) |
317 breakpoints[i].remove(); | 317 breakpoints[i].remove(); |
318 | 318 |
319 function mycallback(success, newBodyOrErrorMessage, callFrames) | 319 function mycallback(success, newBodyOrErrorMessage, callFrames) |
320 { | 320 { |
321 if (success) { | 321 if (success) { |
322 commitEditingCallback(newBodyOrErrorMessage); | 322 commitEditingCallback(newBodyOrErrorMessage); |
323 if (callFrames && callFrames.length) | 323 if (callFrames && callFrames.length) |
324 this.debuggerPaused(callFrames); | 324 this.debuggerPaused(callFrames); |
325 } else { | 325 } else { |
326 cancelEditingCallback(); | 326 if (cancelEditingCallback) |
| 327 cancelEditingCallback(); |
327 WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMess
age.MessageLevel.Warning); | 328 WebInspector.log(newBodyOrErrorMessage, WebInspector.ConsoleMess
age.MessageLevel.Warning); |
328 } | 329 } |
329 for (var i = 0; i < breakpoints.length; ++i) { | 330 for (var i = 0; i < breakpoints.length; ++i) { |
330 var breakpoint = breakpoints[i]; | 331 var breakpoint = breakpoints[i]; |
331 var newLine = breakpoint.line; | 332 var newLine = breakpoint.line; |
332 if (success && breakpoint.line >= line) | 333 if (success && breakpoint.line >= editData.line) |
333 newLine += linesCountToShift; | 334 newLine += editData.linesCountToShift; |
334 WebInspector.breakpointManager.setBreakpoint(sourceID, breakpoin
t.url, newLine, breakpoint.enabled, breakpoint.condition); | 335 WebInspector.breakpointManager.setBreakpoint(editData.sourceID,
breakpoint.url, newLine, breakpoint.enabled, breakpoint.condition); |
335 } | 336 } |
336 }; | 337 }; |
337 InspectorBackend.editScriptSource(sourceID, newContent, mycallback.bind(
this)); | 338 InspectorBackend.editScriptSource(editData.sourceID, editData.content, m
ycallback.bind(this)); |
338 }, | 339 }, |
339 | 340 |
340 selectedCallFrameId: function() | 341 selectedCallFrameId: function() |
341 { | 342 { |
342 var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; | 343 var selectedCallFrame = this.sidebarPanes.callstack.selectedCallFrame; |
343 if (!selectedCallFrame) | 344 if (!selectedCallFrame) |
344 return null; | 345 return null; |
345 return selectedCallFrame.id; | 346 return selectedCallFrame.id; |
346 }, | 347 }, |
347 | 348 |
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 showGoToLineDialog: function(e) | 1086 showGoToLineDialog: function(e) |
1086 { | 1087 { |
1087 var view = this.visibleView; | 1088 var view = this.visibleView; |
1088 if (view) | 1089 if (view) |
1089 WebInspector.GoToLineDialog.show(view); | 1090 WebInspector.GoToLineDialog.show(view); |
1090 } | 1091 } |
1091 } | 1092 } |
1092 | 1093 |
1093 WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype; | 1094 WebInspector.ScriptsPanel.prototype.__proto__ = WebInspector.Panel.prototype; |
1094 | 1095 |
OLD | NEW |