Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(251)

Side by Side Diff: Source/devtools/front_end/sources/JavaScriptSourceFrame.js

Issue 464963002: DevTools: Make UISourceCode Target-agnostic (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Address comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceM appingChanged, this._onSourceMappingChanged, this); 60 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.SourceM appingChanged, this._onSourceMappingChanged, this);
61 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._workingCopyChanged, this); 61 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyChanged, this._workingCopyChanged, this);
62 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._workingCopyCommitted, this); 62 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.Working CopyCommitted, this._workingCopyCommitted, this);
63 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleCh anged, this._showBlackboxInfobarIfNeeded, this); 63 this._uiSourceCode.addEventListener(WebInspector.UISourceCode.Events.TitleCh anged, this._showBlackboxInfobarIfNeeded, this);
64 64
65 /** @type {!Map.<!WebInspector.Target, !WebInspector.ResourceScriptFile>}*/ 65 /** @type {!Map.<!WebInspector.Target, !WebInspector.ResourceScriptFile>}*/
66 this._scriptFileForTarget = new Map(); 66 this._scriptFileForTarget = new Map();
67 this._registerShortcuts(); 67 this._registerShortcuts();
68 var targets = WebInspector.targetManager.targets(); 68 var targets = WebInspector.targetManager.targets();
69 for (var i = 0; i < targets.length; ++i) { 69 for (var i = 0; i < targets.length; ++i) {
70 var scriptFile = uiSourceCode.scriptFileForTarget(targets[i]); 70 var scriptFile = WebInspector.debuggerWorkspaceBinding.scriptFile(uiSour ceCode, targets[i]);
71 if (scriptFile) 71 if (scriptFile)
72 this._updateScriptFile(targets[i]); 72 this._updateScriptFile(targets[i]);
73 } 73 }
74 74
75 WebInspector.settings.skipStackFramesPattern.addChangeListener(this._showBla ckboxInfobarIfNeeded, this); 75 WebInspector.settings.skipStackFramesPattern.addChangeListener(this._showBla ckboxInfobarIfNeeded, this);
76 this._showBlackboxInfobarIfNeeded(); 76 this._showBlackboxInfobarIfNeeded();
77 } 77 }
78 78
79 WebInspector.JavaScriptSourceFrame.prototype = { 79 WebInspector.JavaScriptSourceFrame.prototype = {
80 _updateInfobars: function() 80 _updateInfobars: function()
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 contextMenu.appendSeparator(); 279 contextMenu.appendSeparator();
280 } 280 }
281 281
282 /** 282 /**
283 * @this {WebInspector.JavaScriptSourceFrame} 283 * @this {WebInspector.JavaScriptSourceFrame}
284 * @param {!WebInspector.LiveEditSupport} liveEditSupport 284 * @param {!WebInspector.LiveEditSupport} liveEditSupport
285 */ 285 */
286 function liveEdit(liveEditSupport) 286 function liveEdit(liveEditSupport)
287 { 287 {
288 var liveEditUISourceCode = liveEditSupport.uiSourceCodeForLiveEdit(t his._uiSourceCode); 288 var liveEditUISourceCode = liveEditSupport.uiSourceCodeForLiveEdit(t his._uiSourceCode);
289 if (!liveEditUISourceCode)
290 return;
289 WebInspector.Revealer.reveal(liveEditUISourceCode.uiLocation(lineNum ber)); 291 WebInspector.Revealer.reveal(liveEditUISourceCode.uiLocation(lineNum ber));
290 } 292 }
291 293
292 /** 294 /**
293 * @this {WebInspector.JavaScriptSourceFrame} 295 * @this {WebInspector.JavaScriptSourceFrame}
294 * @param {!WebInspector.ResourceScriptFile} scriptFile 296 * @param {!WebInspector.ResourceScriptFile} scriptFile
295 */ 297 */
296 function addSourceMapURL(scriptFile) 298 function addSourceMapURL(scriptFile)
297 { 299 {
298 WebInspector.AddSourceMapURLDialog.show(this.element, addSourceMapUR LDialogCallback.bind(null, scriptFile)); 300 WebInspector.AddSourceMapURLDialog.show(this.element, addSourceMapUR LDialogCallback.bind(null, scriptFile));
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 { 762 {
761 var data = /** @type {{target: !WebInspector.Target}} */ (event.data); 763 var data = /** @type {{target: !WebInspector.Target}} */ (event.data);
762 this._updateScriptFile(data.target); 764 this._updateScriptFile(data.target);
763 this._updateLinesWithoutMappingHighlight(); 765 this._updateLinesWithoutMappingHighlight();
764 }, 766 },
765 767
766 _updateLinesWithoutMappingHighlight: function() 768 _updateLinesWithoutMappingHighlight: function()
767 { 769 {
768 var linesCount = this.textEditor.linesCount; 770 var linesCount = this.textEditor.linesCount;
769 for (var i = 0; i < linesCount; ++i) 771 for (var i = 0; i < linesCount; ++i)
770 this.textEditor.toggleLineClass(i, "cm-line-without-source-mapping", !this._uiSourceCode.uiLineHasMapping(i)); 772 this.textEditor.toggleLineClass(i, "cm-line-without-source-mapping", !WebInspector.debuggerWorkspaceBinding.uiLineHasMapping(this._uiSourceCode, i)) ;
771 }, 773 },
772 774
773 /** 775 /**
774 * @param {!WebInspector.Target} target 776 * @param {!WebInspector.Target} target
775 */ 777 */
776 _updateScriptFile: function(target) 778 _updateScriptFile: function(target)
777 { 779 {
778 var oldScriptFile = this._scriptFileForTarget.get(target); 780 var oldScriptFile = this._scriptFileForTarget.get(target);
779 var newScriptFile = this._uiSourceCode.scriptFileForTarget(target); 781 var newScriptFile = WebInspector.debuggerWorkspaceBinding.scriptFile(thi s._uiSourceCode, target);
780 this._scriptFileForTarget.remove(target); 782 this._scriptFileForTarget.remove(target);
781 if (oldScriptFile) { 783 if (oldScriptFile) {
782 oldScriptFile.removeEventListener(WebInspector.ResourceScriptFile.Ev ents.DidMergeToVM, this._didMergeToVM, this); 784 oldScriptFile.removeEventListener(WebInspector.ResourceScriptFile.Ev ents.DidMergeToVM, this._didMergeToVM, this);
783 oldScriptFile.removeEventListener(WebInspector.ResourceScriptFile.Ev ents.DidDivergeFromVM, this._didDivergeFromVM, this); 785 oldScriptFile.removeEventListener(WebInspector.ResourceScriptFile.Ev ents.DidDivergeFromVM, this._didDivergeFromVM, this);
784 if (this._muted && !this._uiSourceCode.isDirty()) 786 if (this._muted && !this._uiSourceCode.isDirty())
785 this._restoreBreakpointsIfConsistentScripts(); 787 this._restoreBreakpointsIfConsistentScripts();
786 } 788 }
787 if (newScriptFile) 789 if (newScriptFile)
788 this._scriptFileForTarget.put(target, newScriptFile); 790 this._scriptFileForTarget.put(target, newScriptFile);
789 791
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 888
887 /** 889 /**
888 * @param {number} lineNumber 890 * @param {number} lineNumber
889 */ 891 */
890 _continueToLine: function(lineNumber) 892 _continueToLine: function(lineNumber)
891 { 893 {
892 var executionContext = WebInspector.context.flavor(WebInspector.Executio nContext); 894 var executionContext = WebInspector.context.flavor(WebInspector.Executio nContext);
893 if (!executionContext) 895 if (!executionContext)
894 return; 896 return;
895 var rawLocation = WebInspector.debuggerWorkspaceBinding.uiLocationToRawL ocation(executionContext.target(), this._uiSourceCode, lineNumber, 0); 897 var rawLocation = WebInspector.debuggerWorkspaceBinding.uiLocationToRawL ocation(executionContext.target(), this._uiSourceCode, lineNumber, 0);
898 if (!rawLocation)
899 return;
896 this._scriptsPanel.continueToLocation(rawLocation); 900 this._scriptsPanel.continueToLocation(rawLocation);
897 }, 901 },
898 902
899 dispose: function() 903 dispose: function()
900 { 904 {
901 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointAdded, this._breakpointAdded, this); 905 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointAdded, this._breakpointAdded, this);
902 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointRemoved, this._breakpointRemoved, this); 906 this._breakpointManager.removeEventListener(WebInspector.BreakpointManag er.Events.BreakpointRemoved, this._breakpointRemoved, this);
903 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageAdded, this._consoleMessageAdded, this); 907 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageAdded, this._consoleMessageAdded, this);
904 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageRemoved, this._consoleMessageRemoved, this); 908 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessageRemoved, this._consoleMessageRemoved, this);
905 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessagesCleared, this._consoleMessagesCleared, this); 909 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. ConsoleMessagesCleared, this._consoleMessagesCleared, this);
906 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this); 910 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. SourceMappingChanged, this._onSourceMappingChanged, this);
907 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this); 911 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyChanged, this._workingCopyChanged, this);
908 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this); 912 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. WorkingCopyCommitted, this._workingCopyCommitted, this);
909 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. TitleChanged, this._showBlackboxInfobarIfNeeded, this); 913 this._uiSourceCode.removeEventListener(WebInspector.UISourceCode.Events. TitleChanged, this._showBlackboxInfobarIfNeeded, this);
910 WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._ showBlackboxInfobarIfNeeded, this); 914 WebInspector.settings.skipStackFramesPattern.removeChangeListener(this._ showBlackboxInfobarIfNeeded, this);
911 WebInspector.UISourceCodeFrame.prototype.dispose.call(this); 915 WebInspector.UISourceCodeFrame.prototype.dispose.call(this);
912 }, 916 },
913 917
914 __proto__: WebInspector.UISourceCodeFrame.prototype 918 __proto__: WebInspector.UISourceCodeFrame.prototype
915 } 919 }
OLDNEW
« no previous file with comments | « Source/devtools/front_end/sdk/UISourceCode.js ('k') | Source/devtools/front_end/sources/ScriptFormatterEditorAction.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698