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

Unified Diff: Source/WebCore/inspector/front-end/ScriptsPanel.js

Issue 8222004: Merge 96319 - Web Inspector: Scripts panel without folders causes errors when creating content sc... (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/874/
Patch Set: Created 9 years, 2 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 | « LayoutTests/platform/win/inspector/debugger/scripts-panel-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/inspector/front-end/ScriptsPanel.js
===================================================================
--- Source/WebCore/inspector/front-end/ScriptsPanel.js (revision 97058)
+++ Source/WebCore/inspector/front-end/ScriptsPanel.js (working copy)
@@ -280,19 +280,33 @@
option._uiSourceCode = uiSourceCode;
var parsedURL = uiSourceCode.url.asParsedURL();
+ const indent = WebInspector.isMac() ? "" : "\u00a0\u00a0\u00a0\u00a0";
+
var names = this._folderAndDisplayNameForScriptURL(uiSourceCode.url);
- const indent = (!showScriptFolders || WebInspector.isMac()) ? "" : "\u00a0\u00a0\u00a0\u00a0";
- option.text = indent + (names.displayName ? names.displayName : WebInspector.UIString("(program)"));
option.displayName = names.displayName;
- var folderNameForSorting;
- if (uiSourceCode.isContentScript)
- folderNameForSorting = "2:" + names.folderName;
- else
- folderNameForSorting = "0:" + (names.domain ? names.domain + "\t\t" : "") + names.folderName;
+ var contentScriptPrefix = uiSourceCode.isContentScript ? "2:" : "0:";
- option.nameForSorting = folderNameForSorting + "\t/\t" + names.displayName; // Use '\t' to make files stick to their folder.
+ if (uiSourceCode.isContentScript && names.domain) {
+ // Render extension domain as a path in structured view
+ names.folderName = names.domain + (names.folderName ? names.folderName : "");
+ delete names.domain;
+ }
+
+ var folderNameForSorting = contentScriptPrefix + (names.domain ? names.domain + "\t\t" : "") + names.folderName;
+
+ if (showScriptFolders) {
+ option.text = indent + (names.displayName ? names.displayName : WebInspector.UIString("(program)"));
+ option.nameForSorting = folderNameForSorting + "\t/\t" + names.displayName; // Use '\t' to make files stick to their folder.
+ } else {
+ option.text = names.displayName ? names.displayName : WebInspector.UIString("(program)");
+ // Content script should contain its domain name as a prefix
+ if (uiSourceCode.isContentScript && names.folderName)
+ option.text = names.folderName + "/" + option.text;
+ option.nameForSorting = contentScriptPrefix + option.text;
+ }
option.title = uiSourceCode.url;
+
if (uiSourceCode.isContentScript)
option.addStyleClass("extension-script");
@@ -300,10 +314,7 @@
{
function optionCompare(a, b)
{
- if (showScriptFolders)
- return a.nameForSorting.localeCompare(b.nameForSorting);
- else
- return a.displayName.localeCompare(b.displayName);
+ return a.nameForSorting.localeCompare(b.nameForSorting);
}
var insertionIndex = insertionIndexForObjectInListSortedByFunction(option, select.childNodes, optionCompare);
select.insertBefore(option, insertionIndex < 0 ? null : select.childNodes.item(insertionIndex));
@@ -329,12 +340,12 @@
insertOrdered(domainOption);
}
- if (showScriptFolders && names.folderName && !select.folderOptions[names.folderName]) {
+ if (showScriptFolders && names.folderName && !select.folderOptions[folderNameForSorting]) {
var folderOption = document.createElement("option");
folderOption.text = names.folderName;
folderOption.nameForSorting = folderNameForSorting;
folderOption.disabled = true;
- select.folderOptions[names.folderName] = folderOption;
+ select.folderOptions[folderNameForSorting] = folderOption;
insertOrdered(folderOption);
}
« no previous file with comments | « LayoutTests/platform/win/inspector/debugger/scripts-panel-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698