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

Side by Side Diff: Source/devtools/front_end/ScriptFormatterEditorAction.js

Issue 211243006: DevTools: fix pretty-print functionality for VM scripts (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add inlineScript filter Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.SourceMapping} 7 * @implements {WebInspector.SourceMapping}
8 * @param {!WebInspector.Workspace} workspace 8 * @param {!WebInspector.Workspace} workspace
9 * @param {!WebInspector.DebuggerModel} debuggerModel 9 * @param {!WebInspector.DebuggerModel} debuggerModel
10 */ 10 */
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 { 66 {
67 return false; 67 return false;
68 }, 68 },
69 69
70 /** 70 /**
71 * @param {!WebInspector.UISourceCode} uiSourceCode 71 * @param {!WebInspector.UISourceCode} uiSourceCode
72 * @return {!Array.<!WebInspector.Script>} 72 * @return {!Array.<!WebInspector.Script>}
73 */ 73 */
74 _scriptsForUISourceCode: function(uiSourceCode) 74 _scriptsForUISourceCode: function(uiSourceCode)
75 { 75 {
76 var isInlineScript; 76 /**
77 switch (uiSourceCode.contentType()) { 77 * @param {!WebInspector.Script} script
78 case WebInspector.resourceTypes.Document: 78 * @return {boolean}
79 isInlineScript = true; 79 */
80 break; 80 function isInlineScript(script)
81 case WebInspector.resourceTypes.Script:
82 isInlineScript = false;
83 break;
84 default:
85 return [];
86 }
87 var scripts = this._debuggerModel.scriptsForSourceURL(uiSourceCode.url);
88
89 function filterOutIncorrectInlineType(script)
90 { 81 {
91 return script.isInlineScript() === isInlineScript; 82 return script.isInlineScript();
92 } 83 }
93 84
94 return scripts.filter(filterOutIncorrectInlineType); 85 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document)
86 return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url).fil ter(isInlineScript);
87 if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) {
88 var rawLocation = uiSourceCode.uiLocationToRawLocation(0, 0);
89 return rawLocation ? [this._debuggerModel.scriptForId(rawLocation.sc riptId)] : [];
90 }
91 return [];
95 }, 92 },
96 93
97 _init: function() 94 _init: function()
98 { 95 {
99 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */ 96 /** @type {!Map.<!WebInspector.Script, !WebInspector.UISourceCode>} */
100 this._uiSourceCodes = new Map(); 97 this._uiSourceCodes = new Map();
101 /** @type {!StringMap.<string>} */ 98 /** @type {!StringMap.<string>} */
102 this._formattedPaths = new StringMap(); 99 this._formattedPaths = new StringMap();
103 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScri ptMapping.FormatData>} */ 100 /** @type {!Map.<!WebInspector.UISourceCode, !WebInspector.FormatterScri ptMapping.FormatData>} */
104 this._formatData = new Map(); 101 this._formatData = new Map();
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 }, 377 },
381 378
382 /** 379 /**
383 * @param {!WebInspector.UISourceCode} uiSourceCode 380 * @param {!WebInspector.UISourceCode} uiSourceCode
384 */ 381 */
385 _discardFormattedUISourceCodeScript: function(uiSourceCode) 382 _discardFormattedUISourceCodeScript: function(uiSourceCode)
386 { 383 {
387 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode); 384 this._scriptMapping._discardFormattedUISourceCodeScript(uiSourceCode);
388 } 385 }
389 } 386 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698