Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 415 | 415 |
| 416 _removeAllBreakpoints: function() | 416 _removeAllBreakpoints: function() |
| 417 { | 417 { |
| 418 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(thi s._uiSourceCode); | 418 var breakpoints = this._breakpointManager.breakpointsForUISourceCode(thi s._uiSourceCode); |
| 419 for (var i = 0; i < breakpoints.length; ++i) | 419 for (var i = 0; i < breakpoints.length; ++i) |
| 420 breakpoints[i].remove(); | 420 breakpoints[i].remove(); |
| 421 }, | 421 }, |
| 422 | 422 |
| 423 _getPopoverAnchor: function(element, event) | 423 _getPopoverAnchor: function(element, event) |
| 424 { | 424 { |
| 425 if (!WebInspector.debuggerModel.isPaused()) | 425 var target = WebInspector.context.flavor(WebInspector.Target); |
| 426 if (!target || !target.debuggerModel.isPaused()) | |
| 426 return null; | 427 return null; |
| 427 | 428 |
| 428 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x, event.y); | 429 var textPosition = this.textEditor.coordinatesToCursorPosition(event.x, event.y); |
| 429 if (!textPosition) | 430 if (!textPosition) |
| 430 return null; | 431 return null; |
| 431 var mouseLine = textPosition.startLine; | 432 var mouseLine = textPosition.startLine; |
| 432 var mouseColumn = textPosition.startColumn; | 433 var mouseColumn = textPosition.startColumn; |
| 433 var textSelection = this.textEditor.selection().normalize(); | 434 var textSelection = this.textEditor.selection().normalize(); |
| 434 if (textSelection && !textSelection.isEmpty()) { | 435 if (textSelection && !textSelection.isEmpty()) { |
| 435 if (textSelection.startLine !== textSelection.endLine || textSelecti on.startLine !== mouseLine || mouseColumn < textSelection.startColumn || mouseCo lumn > textSelection.endColumn) | 436 if (textSelection.startLine !== textSelection.endLine || textSelecti on.startLine !== mouseLine || mouseColumn < textSelection.startColumn || mouseCo lumn > textSelection.endColumn) |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 466 lineNumber: lineNumber, | 467 lineNumber: lineNumber, |
| 467 startColumn: token.startColumn, | 468 startColumn: token.startColumn, |
| 468 endColumn: token.endColumn | 469 endColumn: token.endColumn |
| 469 }; | 470 }; |
| 470 | 471 |
| 471 return anchorBox; | 472 return anchorBox; |
| 472 }, | 473 }, |
| 473 | 474 |
| 474 _resolveObjectForPopover: function(anchorBox, showCallback, objectGroupName) | 475 _resolveObjectForPopover: function(anchorBox, showCallback, objectGroupName) |
| 475 { | 476 { |
| 476 if (!WebInspector.debuggerModel.isPaused()) { | 477 var target = WebInspector.context.flavor(WebInspector.Target); |
| 478 if (!target || !target.debuggerModel.isPaused()) { | |
| 477 this._popoverHelper.hidePopover(); | 479 this._popoverHelper.hidePopover(); |
| 478 return; | 480 return; |
| 479 } | 481 } |
| 480 var lineNumber = anchorBox.highlight.lineNumber; | 482 var lineNumber = anchorBox.highlight.lineNumber; |
| 481 var startHighlight = anchorBox.highlight.startColumn; | 483 var startHighlight = anchorBox.highlight.startColumn; |
| 482 var endHighlight = anchorBox.highlight.endColumn; | 484 var endHighlight = anchorBox.highlight.endColumn; |
| 483 var line = this.textEditor.line(lineNumber); | 485 var line = this.textEditor.line(lineNumber); |
| 484 if (!anchorBox.forSelection) { | 486 if (!anchorBox.forSelection) { |
| 485 while (startHighlight > 1 && line.charAt(startHighlight - 1) === '.' ) { | 487 while (startHighlight > 1 && line.charAt(startHighlight - 1) === '.' ) { |
| 486 var token = this.textEditor.tokenAtTextPosition(lineNumber, star tHighlight - 2); | 488 var token = this.textEditor.tokenAtTextPosition(lineNumber, star tHighlight - 2); |
| 487 if (!token) { | 489 if (!token) { |
| 488 this._popoverHelper.hidePopover(); | 490 this._popoverHelper.hidePopover(); |
| 489 return; | 491 return; |
| 490 } | 492 } |
| 491 startHighlight = token.startColumn; | 493 startHighlight = token.startColumn; |
| 492 } | 494 } |
| 493 } | 495 } |
| 494 var evaluationText = line.substring(startHighlight, endHighlight + 1); | 496 var evaluationText = line.substring(startHighlight, endHighlight + 1); |
| 495 var selectedCallFrame = WebInspector.debuggerModel.selectedCallFrame(); | 497 var selectedCallFrame = target.debuggerModel.selectedCallFrame(); |
| 496 selectedCallFrame.evaluate(evaluationText, objectGroupName, false, true, false, false, showObjectPopover.bind(this)); | 498 selectedCallFrame.evaluate(evaluationText, objectGroupName, false, true, false, false, showObjectPopover.bind(this)); |
| 497 | 499 |
| 498 /** | 500 /** |
| 499 * @param {?RuntimeAgent.RemoteObject} result | 501 * @param {?RuntimeAgent.RemoteObject} result |
| 500 * @param {boolean=} wasThrown | 502 * @param {boolean=} wasThrown |
| 501 * @this {WebInspector.JavaScriptSourceFrame} | 503 * @this {WebInspector.JavaScriptSourceFrame} |
| 502 */ | 504 */ |
| 503 function showObjectPopover(result, wasThrown) | 505 function showObjectPopover(result, wasThrown) |
| 504 { | 506 { |
| 505 if (!WebInspector.debuggerModel.isPaused() || !result) { | 507 var target = selectedCallFrame.target(); |
|
vsevik
2014/06/26 07:50:32
The target might have changed, so I suggest doing
sergeyv
2014/06/26 09:21:09
Done.
But I check that target hasn't changed since
| |
| 508 if (!target.debuggerModel.isPaused() || !result) { | |
| 506 this._popoverHelper.hidePopover(); | 509 this._popoverHelper.hidePopover(); |
| 507 return; | 510 return; |
| 508 } | 511 } |
| 509 this._popoverAnchorBox = anchorBox; | 512 this._popoverAnchorBox = anchorBox; |
| 510 showCallback(selectedCallFrame.target().runtimeModel.createRemoteObj ect(result), wasThrown, this._popoverAnchorBox); | 513 showCallback(target.runtimeModel.createRemoteObject(result), wasThro wn, this._popoverAnchorBox); |
| 511 // Popover may have been removed by showCallback(). | 514 // Popover may have been removed by showCallback(). |
| 512 if (this._popoverAnchorBox) { | 515 if (this._popoverAnchorBox) { |
| 513 var highlightRange = new WebInspector.TextRange(lineNumber, star tHighlight, lineNumber, endHighlight); | 516 var highlightRange = new WebInspector.TextRange(lineNumber, star tHighlight, lineNumber, endHighlight); |
| 514 this._popoverAnchorBox._highlightDescriptor = this.textEditor.hi ghlightRange(highlightRange, "source-frame-eval-expression"); | 517 this._popoverAnchorBox._highlightDescriptor = this.textEditor.hi ghlightRange(highlightRange, "source-frame-eval-expression"); |
| 515 } | 518 } |
| 516 } | 519 } |
| 517 }, | 520 }, |
| 518 | 521 |
| 519 _onHidePopover: function() | 522 _onHidePopover: function() |
| 520 { | 523 { |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 836 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageRemoved, this._consoleMessageRemoved, this); | 839 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageRemoved, this._consoleMessageRemoved, this); |
| 837 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessagesCleared, this._consoleMessagesCleared, this); | 840 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessagesCleared, this._consoleMessagesCleared, this); |
| 838 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); | 841 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); |
| 839 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); | 842 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); |
| 840 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); | 843 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); |
| 841 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); | 844 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); |
| 842 }, | 845 }, |
| 843 | 846 |
| 844 __proto__: WebInspector.UISourceCodeFrame.prototype | 847 __proto__: WebInspector.UISourceCodeFrame.prototype |
| 845 } | 848 } |
| OLD | NEW |