Changeset 80356 in webkit
- Timestamp:
- Mar 4, 2011 8:40:58 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r80355 r80356 1 2011-03-04 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: extract all code that depends on source mapping from SourceFrame. 6 https://bugs.webkit.org/show_bug.cgi?id=55464 7 8 * http/tests/inspector/debugger-test.js: 9 (initialize_DebuggerTest): 10 * inspector/debugger/debug-inlined-scripts.html: 11 * inspector/debugger/debugger-breakpoints-not-activated-on-reload.html: 12 * inspector/debugger/debugger-pause-on-breakpoint.html: 13 * inspector/debugger/source-frame.html: 14 1 15 2011-03-04 Andrey Kosyakov <caseq@chromium.org> 2 16 -
trunk/LayoutTests/http/tests/inspector/debugger-test.js
r80338 r80356 183 183 }; 184 184 185 InspectorTest.setBreakpoint = function(sourceFrame, lineNumber, condition, enabled) 186 { 187 sourceFrame._delegate.setBreakpoint(lineNumber, condition, enabled); 188 }; 189 190 185 191 InspectorTest.expandProperties = function(properties, callback) 186 192 { -
trunk/LayoutTests/inspector/debugger/debug-inlined-scripts.html
r79880 r80356 31 31 InspectorTest.addResult("Script source was shown."); 32 32 WebInspector.panels.scripts._resourceForURL = function() { return new WebInspector.Resource(); }; 33 sourceFrame._setBreakpoint(2, "", true);34 sourceFrame._setBreakpoint(9, "", true);33 InspectorTest.setBreakpoint(sourceFrame, 2, "", true); 34 InspectorTest.setBreakpoint(sourceFrame, 9, "", true); 35 35 InspectorTest.waitUntilPaused(step3); 36 36 InspectorTest.reloadPage(InspectorTest.completeDebuggerTest.bind(InspectorTest)); -
trunk/LayoutTests/inspector/debugger/debugger-breakpoints-not-activated-on-reload.html
r78808 r80356 25 25 { 26 26 InspectorTest.addResult("Main resource was shown."); 27 sourceFrame._setBreakpoint(8, "", true);27 InspectorTest.setBreakpoint(sourceFrame, 8, "", true); 28 28 WebInspector.panels.scripts.toggleBreakpointsButton.element.click(); 29 29 InspectorTest.reloadPage(step4); -
trunk/LayoutTests/inspector/debugger/debugger-pause-on-breakpoint.html
r78808 r80356 23 23 { 24 24 InspectorTest.addResult("Script source was shown."); 25 sourceFrame._setBreakpoint(8, "", true);25 InspectorTest.setBreakpoint(sourceFrame, 8, "", true); 26 26 InspectorTest.runTestFunctionAndWaitUntilPaused(step3); 27 27 } -
trunk/LayoutTests/inspector/debugger/source-frame.html
r79311 r80356 22 22 InspectorTest.addResult("Script source was shown."); 23 23 InspectorTest.addSniffer(WebInspector.SourceFrame.prototype, "addBreakpoint", didAddBreakpoint); 24 sourceFrame._setBreakpoint(17, "", true);24 InspectorTest.setBreakpoint(sourceFrame, 17, "", true); 25 25 } 26 26 -
trunk/Source/WebCore/ChangeLog
r80355 r80356 1 2011-03-04 Pavel Podivilov <podivilov@chromium.org> 2 3 Reviewed by Yury Semikhatsky. 4 5 Web Inspector: extract all code that depends on source mapping from SourceFrame. 6 https://bugs.webkit.org/show_bug.cgi?id=55464 7 8 Extract all dependencies on DebuggerModel and ScriptsPanel to a delegate class 9 to encapsulate source mapping aspects from SourceFrame. 10 11 * inspector/front-end/ResourceView.js: 12 (WebInspector.ResourceView.createResourceView): 13 (WebInspector.SourceFrameDelegateForResourcesPanel): 14 (WebInspector.SourceFrameDelegateForResourcesPanel.prototype.requestContent): 15 * inspector/front-end/ScriptsPanel.js: 16 (WebInspector.ScriptsPanel.prototype._createSourceFrame): 17 (WebInspector.SourceFrameDelegateForScriptsPanel): 18 * inspector/front-end/SourceFrame.js: 19 (WebInspector.SourceFrame): 20 (WebInspector.SourceFrame.prototype.show): 21 (WebInspector.SourceFrame.prototype._createTextViewer): 22 (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint.didEditBreakpointCondition): 23 (WebInspector.SourceFrame.prototype._contextMenu.addConditionalBreakpoint): 24 (WebInspector.SourceFrame.prototype._contextMenu.else.editBreakpointCondition.didEditBreakpointCondition): 25 (WebInspector.SourceFrame.prototype._contextMenu.else.editBreakpointCondition): 26 (WebInspector.SourceFrame.prototype._contextMenu.else.setBreakpointEnabled): 27 (WebInspector.SourceFrame.prototype._contextMenu): 28 (WebInspector.SourceFrame.prototype._mouseDown): 29 (WebInspector.SourceFrame.prototype._mouseMove): 30 (WebInspector.SourceFrame.prototype._hidePopup): 31 (WebInspector.SourceFrame.prototype._mouseHover): 32 (WebInspector.SourceFrame.prototype._showPopup.showObjectPopup): 33 (WebInspector.SourceFrame.prototype._showPopup): 34 (WebInspector.SourceFrame.prototype._doubleClick): 35 (WebInspector.SourceFrame.prototype._didEditLine): 36 (WebInspector.SourceFrameDelegate): 37 (WebInspector.SourceFrameDelegate.prototype.requestContent): 38 (WebInspector.SourceFrameDelegate.prototype.debuggingSupported): 39 (WebInspector.SourceFrameDelegate.prototype.setBreakpoint): 40 (WebInspector.SourceFrameDelegate.prototype.removeBreakpoint): 41 (WebInspector.SourceFrameDelegate.prototype.updateBreakpoint): 42 (WebInspector.SourceFrameDelegate.prototype.findBreakpoint): 43 (WebInspector.SourceFrameDelegate.prototype.continueToLine): 44 (WebInspector.SourceFrameDelegate.prototype.canEditScriptSource): 45 (WebInspector.SourceFrameDelegate.prototype.editScriptSource): 46 (WebInspector.SourceFrameDelegate.prototype.debuggerPaused): 47 (WebInspector.SourceFrameDelegate.prototype.evaluate): 48 (WebInspector.SourceFrameDelegate.prototype.releaseEvaluationResult): 49 1 50 2011-03-04 Andrey Kosyakov <caseq@chromium.org> 2 51 -
trunk/Source/WebCore/inspector/front-end/ResourceView.js
r78472 r80356 51 51 case WebInspector.resourceCategories.scripts: 52 52 case WebInspector.resourceCategories.xhr: 53 var contentProvider = new WebInspector.SourceFrameContentProviderForResource(resource); 54 var isScript = resource.type === WebInspector.Resource.Type.Script; 55 var view = new WebInspector.SourceFrame(contentProvider, resource.url, isScript); 53 var delegate = new WebInspector.SourceFrameDelegateForResourcesPanel(resource); 54 var view = new WebInspector.SourceFrame(delegate, resource.url); 56 55 view.resource = resource; 57 56 return view; … … 121 120 122 121 123 WebInspector.SourceFrame ContentProviderForResource= function(resource)122 WebInspector.SourceFrameDelegateForResourcesPanel = function(resource) 124 123 { 125 WebInspector.SourceFrame ContentProvider.call(this);124 WebInspector.SourceFrameDelegate.call(this); 126 125 this._resource = resource; 127 126 } … … 129 128 //This is a map from resource.type to mime types 130 129 //found in WebInspector.SourceTokenizer.Registry. 131 WebInspector.SourceFrame ContentProviderForResource.DefaultMIMETypeForResourceType = {130 WebInspector.SourceFrameDelegateForResourcesPanel.DefaultMIMETypeForResourceType = { 132 131 0: "text/html", 133 132 1: "text/css", … … 135 134 } 136 135 137 WebInspector.SourceFrame ContentProviderForResource.prototype = {136 WebInspector.SourceFrameDelegateForResourcesPanel.prototype = { 138 137 requestContent: function(callback) 139 138 { 140 139 function contentLoaded(text) 141 140 { 142 var mimeType = WebInspector.SourceFrameContentProviderForResource.DefaultMIMETypeForResourceType[this._resource.type] || this._resource.mimeType; 143 if (this._resource.type !== WebInspector.Resource.Type.Script) { 144 // WebKit html lexer normalizes line endings and scripts are passed to VM with "\n" line endings. 145 // However, resource content has original line endings, so we have to normalize line endings here. 146 text = text.replace(/\r\n/g, "\n"); 147 } 141 var mimeType = WebInspector.SourceFrameDelegateForResourcesPanel.DefaultMIMETypeForResourceType[this._resource.type] || this._resource.mimeType; 148 142 var sourceMapping = new WebInspector.IdenticalSourceMapping(); 149 var scripts = WebInspector.debuggerModel.scriptsForURL(this._resource.url); 150 var scriptRanges = WebInspector.ScriptFormatter.findScriptRanges(text.lineEndings(), scripts); 151 callback(mimeType, new WebInspector.SourceFrameContent(text, sourceMapping, scriptRanges)); 143 callback(mimeType, new WebInspector.SourceFrameContent(text, sourceMapping, [])); 152 144 } 153 145 this._resource.requestContent(contentLoaded.bind(this)); … … 155 147 } 156 148 157 WebInspector.SourceFrame ContentProviderForResource.prototype.__proto__ = WebInspector.SourceFrameContentProvider.prototype;149 WebInspector.SourceFrameDelegateForResourcesPanel.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype; -
trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js
r80342 r80356 581 581 { 582 582 var script = this._scriptForSourceFileId(sourceFileId); 583 var contentProvider; 584 var isScript; 585 if (script.resource) { 586 contentProvider = new WebInspector.SourceFrameContentProviderForResource(script.resource); 587 isScript = script.resource.type === WebInspector.Resource.Type.Script; 588 } else { 589 contentProvider = new WebInspector.SourceFrameContentProviderForScript(script); 590 isScript = !script.lineOffset && !script.columnOffset; 591 } 592 sourceFrame = new WebInspector.SourceFrame(contentProvider, script.sourceURL, isScript); 583 var delegate = new WebInspector.SourceFrameDelegateForScriptsPanel(script); 584 var sourceFrame = new WebInspector.SourceFrame(delegate, script.sourceURL); 593 585 sourceFrame._sourceFileId = sourceFileId; 594 586 sourceFrame.addEventListener(WebInspector.SourceFrame.Events.Loaded, this._sourceFrameLoaded, this); … … 1048 1040 1049 1041 1050 WebInspector.SourceFrame ContentProviderForScript= function(script)1042 WebInspector.SourceFrameDelegateForScriptsPanel = function(script) 1051 1043 { 1052 WebInspector.SourceFrame ContentProvider.call(this);1044 WebInspector.SourceFrameDelegate.call(this); 1053 1045 this._script = script; 1046 this._popoverObjectGroup = "popover"; 1054 1047 } 1055 1048 1056 WebInspector.SourceFrame ContentProviderForScript.prototype = {1049 WebInspector.SourceFrameDelegateForScriptsPanel.prototype = { 1057 1050 requestContent: function(callback) 1058 1051 { 1059 var scripts = [this._script]; 1060 if (this._script.sourceURL) 1061 scripts = WebInspector.debuggerModel.scriptsForURL(this._script.sourceURL); 1062 scripts.sort(function(x, y) { return x.lineOffset - y.lineOffset || x.columnOffset - y.columnOffset; }); 1063 1052 function didGetTextAndScriptRanges(mimeType, text, scriptRanges) 1053 { 1054 this._content = new WebInspector.SourceFrameContent(text, new WebInspector.IdenticalSourceMapping(), scriptRanges); 1055 callback(mimeType, this._content); 1056 } 1057 1058 if (this._script.resource) 1059 this._loadResourceContent(this._script.resource, didGetTextAndScriptRanges.bind(this)); 1060 else 1061 this._loadAndConcatenateScriptsContent(didGetTextAndScriptRanges.bind(this)); 1062 }, 1063 1064 _loadResourceContent: function(resource, callback) 1065 { 1066 function didRequestContent(text) 1067 { 1068 var mimeType = "text/javascript"; 1069 if (resource.type !== WebInspector.Resource.Type.Script) { 1070 mimeType = "text/html"; 1071 // WebKit html lexer normalizes line endings and scripts are passed to VM with "\n" line endings. 1072 // However, resource content has original line endings, so we have to normalize line endings here. 1073 text = text.replace(/\r\n/g, "\n"); 1074 } 1075 var scripts = this._scripts(); 1076 var scriptRanges = WebInspector.ScriptFormatter.findScriptRanges(text.lineEndings(), scripts); 1077 callback(mimeType, text, scriptRanges); 1078 } 1079 resource.requestContent(didRequestContent.bind(this)); 1080 }, 1081 1082 _loadAndConcatenateScriptsContent: function(callback) 1083 { 1084 var scripts = this._scripts(); 1064 1085 var scriptsLeft = scripts.length; 1065 1086 var sources = []; … … 1070 1091 return; 1071 1092 var result = this._buildSource(scripts, sources); 1072 var sourceMapping = new WebInspector.IdenticalSourceMapping(); 1073 callback(result.mimeType, new WebInspector.SourceFrameContent(result.source, sourceMapping, result.scriptRanges)); 1074 1093 callback(result.mimeType, result.source, result.scriptRanges); 1075 1094 } 1076 1095 for (var i = 0; i < scripts.length; ++i) … … 1125 1144 } 1126 1145 return { mimeType: mimeType, source: source, scriptRanges: scriptRanges }; 1146 }, 1147 1148 _scripts: function() 1149 { 1150 var scripts = [this._script]; 1151 if (this._script.sourceURL) 1152 scripts = WebInspector.debuggerModel.scriptsForURL(this._script.sourceURL); 1153 scripts.sort(function(x, y) { return x.lineOffset - y.lineOffset || x.columnOffset - y.columnOffset; }); 1154 return scripts; 1155 }, 1156 1157 debuggingSupported: function() 1158 { 1159 return true; 1160 }, 1161 1162 setBreakpoint: function(lineNumber, condition, enabled) 1163 { 1164 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber); 1165 if (this._script.sourceURL) 1166 WebInspector.debuggerModel.setBreakpoint(this._script.sourceURL, location.lineNumber, location.columnNumber, condition, enabled); 1167 else if (location.sourceID) 1168 WebInspector.debuggerModel.setBreakpointBySourceId(location.sourceID, location.lineNumber, location.columnNumber, condition, enabled); 1169 else 1170 return; 1171 1172 if (!WebInspector.panels.scripts.breakpointsActivated) 1173 WebInspector.panels.scripts.toggleBreakpointsClicked(); 1174 }, 1175 1176 removeBreakpoint: function(breakpointId) 1177 { 1178 WebInspector.debuggerModel.removeBreakpoint(breakpointId); 1179 }, 1180 1181 updateBreakpoint: function(breakpointId, condition, enabled) 1182 { 1183 WebInspector.debuggerModel.updateBreakpoint(breakpointId, condition, enabled); 1184 }, 1185 1186 findBreakpoint: function(lineNumber) 1187 { 1188 var url = this._script.sourceURL; 1189 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber); 1190 function filter(breakpoint) 1191 { 1192 if (breakpoint.url) { 1193 if (breakpoint.url !== url) 1194 return false; 1195 } else { 1196 if (breakpoint.sourceID !== location.sourceID) 1197 return false; 1198 } 1199 var lineNumber = breakpoint.locations.length ? breakpoint.locations[0].lineNumber : breakpoint.lineNumber; 1200 return lineNumber === location.lineNumber; 1201 } 1202 return WebInspector.debuggerModel.queryBreakpoints(filter)[0]; 1203 }, 1204 1205 continueToLine: function(lineNumber) 1206 { 1207 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber); 1208 if (location.sourceID) 1209 WebInspector.debuggerModel.continueToLocation(location.sourceID, location.lineNumber, location.columnNumber); 1210 }, 1211 1212 canEditScriptSource: function() 1213 { 1214 return Preferences.canEditScriptSource && !this._script.lineOffset && !this._script.columnOffset; 1215 }, 1216 1217 editScriptSource: function(text) 1218 { 1219 WebInspector.debuggerModel.editScriptSource(this._script.sourceID, text); 1220 }, 1221 1222 debuggerPaused: function() 1223 { 1224 return WebInspector.panels.scripts.paused; 1225 }, 1226 1227 evaluateInSelectedCallFrame: function(string, callback) 1228 { 1229 function didEvaluateInSelectedCallFrame(result) 1230 { 1231 if (!result.isError() && this.debuggerPaused()) 1232 callback(result); 1233 } 1234 WebInspector.panels.scripts.evaluateInSelectedCallFrame(string, this._popoverObjectGroup, false, didEvaluateInSelectedCallFrame.bind(this)); 1235 }, 1236 1237 releaseEvaluationResult: function() 1238 { 1239 RuntimeAgent.releaseObjectGroup(0, this._popoverObjectGroup); 1127 1240 } 1128 1241 } 1129 1242 1130 WebInspector.SourceFrame ContentProviderForScript.prototype.__proto__ = WebInspector.SourceFrameContentProvider.prototype;1243 WebInspector.SourceFrameDelegateForScriptsPanel.prototype.__proto__ = WebInspector.SourceFrameDelegate.prototype; -
trunk/Source/WebCore/inspector/front-end/SourceFrame.js
r80349 r80356 29 29 */ 30 30 31 WebInspector.SourceFrame = function( contentProvider, url, isScript)31 WebInspector.SourceFrame = function(delegate, url) 32 32 { 33 33 WebInspector.View.call(this); … … 35 35 this.element.addStyleClass("script-view"); 36 36 37 this._ contentProvider = contentProvider;37 this._delegate = delegate; 38 38 this._url = url; 39 this._isScript = isScript;40 39 41 40 this._textModel = new WebInspector.TextEditorModel(); … … 48 47 this._rowMessages = {}; 49 48 this._messageBubbles = {}; 50 51 this._popoverObjectGroup = "popover";52 49 } 53 50 … … 64 61 if (!this._contentRequested) { 65 62 this._contentRequested = true; 66 this._ contentProvider.requestContent(this._createTextViewer.bind(this));63 this._delegate.requestContent(this._createTextViewer.bind(this)); 67 64 } 68 65 … … 196 193 197 194 var element = this._textViewer.element; 198 element.addEventListener("contextmenu", this._contextMenu.bind(this), true); 199 element.addEventListener("mousedown", this._mouseDown.bind(this), true); 200 element.addEventListener("mousemove", this._mouseMove.bind(this), true); 201 element.addEventListener("scroll", this._scroll.bind(this), true); 202 element.addEventListener("dblclick", this._doubleClick.bind(this), true); 195 if (this._delegate.debuggingSupported()) { 196 element.addEventListener("contextmenu", this._contextMenu.bind(this), true); 197 element.addEventListener("mousedown", this._mouseDown.bind(this), true); 198 element.addEventListener("mousemove", this._mouseMove.bind(this), true); 199 element.addEventListener("dblclick", this._doubleClick.bind(this), true); 200 element.addEventListener("scroll", this._scroll.bind(this), true); 201 } 203 202 this.element.appendChild(element); 204 203 … … 479 478 _contextMenu: function(event) 480 479 { 481 if (!WebInspector.panels.scripts)482 return;483 484 480 var target = event.target.enclosingNodeOrSelfWithClass("webkit-line-number"); 485 481 if (!target) 486 482 return; 487 var textViewerLineNumber = target.lineNumber;483 var lineNumber = target.lineNumber; 488 484 489 485 var contextMenu = new WebInspector.ContextMenu(); 490 486 491 contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._ continueToLine.bind(this, textViewerLineNumber));492 493 var breakpoint = this._ findBreakpoint(textViewerLineNumber);487 contextMenu.appendItem(WebInspector.UIString("Continue to Here"), this._delegate.continueToLine.bind(this._delegate, lineNumber)); 488 489 var breakpoint = this._delegate.findBreakpoint(lineNumber); 494 490 if (!breakpoint) { 495 491 // This row doesn't have a breakpoint: We want to show Add Breakpoint and Add and Edit Breakpoint. 496 contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._ setBreakpoint.bind(this, textViewerLineNumber, "", true));492 contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), this._delegate.setBreakpoint.bind(this._delegate, lineNumber, "", true)); 497 493 498 494 function addConditionalBreakpoint() 499 495 { 500 this.addBreakpoint( textViewerLineNumber, true, true, true);496 this.addBreakpoint(lineNumber, true, true, true); 501 497 function didEditBreakpointCondition(committed, condition) 502 498 { 503 this.removeBreakpoint( textViewerLineNumber);499 this.removeBreakpoint(lineNumber); 504 500 if (committed) 505 this._ setBreakpoint(textViewerLineNumber, condition, true);501 this._delegate.setBreakpoint(lineNumber, condition, true); 506 502 } 507 this._editBreakpointCondition( textViewerLineNumber, "", didEditBreakpointCondition.bind(this));503 this._editBreakpointCondition(lineNumber, "", didEditBreakpointCondition.bind(this)); 508 504 } 509 505 contextMenu.appendItem(WebInspector.UIString("Add Conditional Breakpoint…"), addConditionalBreakpoint.bind(this)); 510 506 } else { 511 507 // This row has a breakpoint, we want to show edit and remove breakpoint, and either disable or enable. 512 function removeBreakpoint() 513 { 514 WebInspector.debuggerModel.removeBreakpoint(breakpoint.id); 515 } 516 contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), removeBreakpoint); 508 contextMenu.appendItem(WebInspector.UIString("Remove Breakpoint"), this._delegate.removeBreakpoint.bind(this._delegate, breakpoint.id)); 517 509 function editBreakpointCondition() 518 510 { … … 520 512 { 521 513 if (committed) 522 WebInspector.debuggerModel.updateBreakpoint(breakpoint.id, condition, breakpoint.enabled);514 this._delegate.updateBreakpoint(breakpoint.id, condition, breakpoint.enabled); 523 515 } 524 this._editBreakpointCondition( textViewerLineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this));516 this._editBreakpointCondition(lineNumber, breakpoint.condition, didEditBreakpointCondition.bind(this)); 525 517 } 526 518 contextMenu.appendItem(WebInspector.UIString("Edit Breakpoint…"), editBreakpointCondition.bind(this)); 527 519 function setBreakpointEnabled(enabled) 528 520 { 529 WebInspector.debuggerModel.updateBreakpoint(breakpoint.id, breakpoint.condition, enabled);521 this._delegate.updateBreakpoint(breakpoint.id, breakpoint.condition, enabled); 530 522 } 531 523 if (breakpoint.enabled) … … 551 543 if (!target) 552 544 return; 553 var textViewerLineNumber = target.lineNumber;554 555 var breakpoint = this._ findBreakpoint(textViewerLineNumber);545 var lineNumber = target.lineNumber; 546 547 var breakpoint = this._delegate.findBreakpoint(lineNumber); 556 548 if (breakpoint) { 557 549 if (event.shiftKey) 558 WebInspector.debuggerModel.updateBreakpoint(breakpoint.id, breakpoint.condition, !breakpoint.enabled);550 this._delegate.updateBreakpoint(breakpoint.id, breakpoint.condition, !breakpoint.enabled); 559 551 else 560 WebInspector.debuggerModel.removeBreakpoint(breakpoint.id);552 this._delegate.removeBreakpoint(breakpoint.id); 561 553 } else 562 this._ setBreakpoint(textViewerLineNumber, "", true);554 this._delegate.setBreakpoint(lineNumber, "", true); 563 555 event.preventDefault(); 564 556 }, … … 586 578 587 579 // Now that cleanup routines are set up above, leave this in case we are not on a break. 588 if (! WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)580 if (!this._delegate.debuggerPaused()) 589 581 return; 590 582 … … 625 617 this._popup.hide(); 626 618 delete this._popup; 627 RuntimeAgent.releaseObjectGroup(0, this._popoverObjectGroup);619 this._delegate.releaseEvaluationResult(); 628 620 }, 629 621 … … 631 623 { 632 624 delete this._hoverTimer; 633 634 if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)635 return;636 625 637 626 var lineRow = element.enclosingNodeOrSelfWithClass("webkit-line-content"); … … 674 663 function showObjectPopup(result) 675 664 { 676 if (!WebInspector.panels.scripts.paused)677 return;678 679 665 var popupContentElement = null; 680 666 if (result.type !== "object" && result.type !== "node" && result.type !== "array") { … … 711 697 } 712 698 713 function evaluateCallback(result) 714 { 715 if (result.isError()) 716 return; 717 if (!WebInspector.panels.scripts.paused) 718 return; 719 showObjectPopup.call(this, result); 720 } 721 WebInspector.panels.scripts.evaluateInSelectedCallFrame(element.textContent, this._popoverObjectGroup, false, evaluateCallback.bind(this)); 699 this._delegate.evaluateInSelectedCallFrame(element.textContent, showObjectPopup.bind(this)); 722 700 }, 723 701 … … 765 743 }, 766 744 767 _evalSelectionInCallFrame: function(event)768 {769 if (!WebInspector.panels.scripts || !WebInspector.panels.scripts.paused)770 return;771 772 var selection = this.element.contentWindow.getSelection();773 if (!selection.rangeCount)774 return;775 776 var expression = selection.getRangeAt(0).toString().trim();777 WebInspector.panels.scripts.evaluateInSelectedCallFrame(expression, "console", function(result) {778 WebInspector.showConsole();779 var commandMessage = new WebInspector.ConsoleCommand(expression);780 WebInspector.console.addMessage(commandMessage);781 WebInspector.console.addMessage(new WebInspector.ConsoleCommandResult(result, commandMessage));782 });783 },784 785 745 resize: function() 786 746 { … … 804 764 }, 805 765 806 _continueToLine: function(lineNumber)807 {808 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber);809 if (location.sourceID)810 WebInspector.debuggerModel.continueToLocation(location.sourceID, location.lineNumber, location.columnNumber);811 },812 813 766 _doubleClick: function(event) 814 767 { 815 if (! Preferences.canEditScriptSource || !this._isScript)768 if (!this._delegate.canEditScriptSource()) 816 769 return; 817 770 … … 833 786 lines.push(oldLines[i]); 834 787 } 835 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber); 836 WebInspector.debuggerModel.editScriptSource(location.sourceID, lines.join("\n")); 837 }, 838 839 _setBreakpoint: function(lineNumber, condition, enabled) 840 { 841 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber); 842 if (this._url) 843 WebInspector.debuggerModel.setBreakpoint(this._url, location.lineNumber, location.columnNumber, condition, enabled); 844 else if (location.sourceID) 845 WebInspector.debuggerModel.setBreakpointBySourceId(location.sourceID, location.lineNumber, location.columnNumber, condition, enabled); 846 else 847 return; 848 849 if (!WebInspector.panels.scripts.breakpointsActivated) 850 WebInspector.panels.scripts.toggleBreakpointsClicked(); 851 }, 852 853 _findBreakpoint: function(lineNumber) 854 { 855 var url = this._url; 856 var location = this._content.sourceFrameLineNumberToActualLocation(lineNumber); 857 function filter(breakpoint) 858 { 859 if (breakpoint.url) { 860 if (breakpoint.url !== url) 861 return false; 862 } else { 863 if (breakpoint.sourceID !== location.sourceID) 864 return false; 865 } 866 var lineNumber = breakpoint.locations.length ? breakpoint.locations[0].lineNumber : breakpoint.lineNumber; 867 return lineNumber === location.lineNumber; 868 } 869 return WebInspector.debuggerModel.queryBreakpoints(filter)[0]; 788 this._delegate.editScriptSource(lines.join("\n")); 870 789 } 871 790 } … … 874 793 875 794 876 WebInspector.SourceFrame ContentProvider= function()795 WebInspector.SourceFrameDelegate = function() 877 796 { 878 797 } 879 798 880 WebInspector.SourceFrame ContentProvider.prototype = {799 WebInspector.SourceFrameDelegate.prototype = { 881 800 requestContent: function(callback) 801 { 802 // Should be implemented by subclasses. 803 }, 804 805 debuggingSupported: function() 806 { 807 return false; 808 }, 809 810 setBreakpoint: function(lineNumber, condition, enabled) 811 { 812 // Should be implemented by subclasses. 813 }, 814 815 removeBreakpoint: function(breakpointId) 816 { 817 // Should be implemented by subclasses. 818 }, 819 820 updateBreakpoint: function(breakpointId, condition, enabled) 821 { 822 // Should be implemented by subclasses. 823 }, 824 825 findBreakpoint: function(lineNumber) 826 { 827 // Should be implemented by subclasses. 828 }, 829 830 continueToLine: function(lineNumber) 831 { 832 // Should be implemented by subclasses. 833 }, 834 835 canEditScriptSource: function() 836 { 837 return false; 838 }, 839 840 editScriptSource: function(text) 841 { 842 // Should be implemented by subclasses. 843 }, 844 845 debuggerPaused: function() 846 { 847 // Should be implemented by subclasses. 848 }, 849 850 evaluateInSelectedCallFrame: function(string) 851 { 852 // Should be implemented by subclasses. 853 }, 854 855 releaseEvaluationResult: function() 882 856 { 883 857 // Should be implemented by subclasses.
Note: See TracChangeset
for help on using the changeset viewer.