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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/ScriptFormatterEditorAction.js
diff --git a/Source/devtools/front_end/ScriptFormatterEditorAction.js b/Source/devtools/front_end/ScriptFormatterEditorAction.js
index 3dd22eab61ef2bf3cb139a107c282bd4871f212c..3f885e7b45a3736553ab4bc78420525fd58ed6c0 100644
--- a/Source/devtools/front_end/ScriptFormatterEditorAction.js
+++ b/Source/devtools/front_end/ScriptFormatterEditorAction.js
@@ -73,25 +73,22 @@ WebInspector.FormatterScriptMapping.prototype = {
*/
_scriptsForUISourceCode: function(uiSourceCode)
{
- var isInlineScript;
- switch (uiSourceCode.contentType()) {
- case WebInspector.resourceTypes.Document:
- isInlineScript = true;
- break;
- case WebInspector.resourceTypes.Script:
- isInlineScript = false;
- break;
- default:
- return [];
- }
- var scripts = this._debuggerModel.scriptsForSourceURL(uiSourceCode.url);
-
- function filterOutIncorrectInlineType(script)
+ /**
+ * @param {!WebInspector.Script} script
+ * @return {boolean}
+ */
+ function isInlineScript(script)
{
- return script.isInlineScript() === isInlineScript;
+ return script.isInlineScript();
}
- return scripts.filter(filterOutIncorrectInlineType);
+ if (uiSourceCode.contentType() === WebInspector.resourceTypes.Document)
+ return this._debuggerModel.scriptsForSourceURL(uiSourceCode.url).filter(isInlineScript);
+ if (uiSourceCode.contentType() === WebInspector.resourceTypes.Script) {
+ var rawLocation = uiSourceCode.uiLocationToRawLocation(0, 0);
+ return rawLocation ? [this._debuggerModel.scriptForId(rawLocation.scriptId)] : [];
+ }
+ return [];
},
_init: function()
« 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