Title: [96319] trunk
Revision
96319
Author
pfeld...@chromium.org
Date
2011-09-29 04:39:11 -0700 (Thu, 29 Sep 2011)

Log Message

Web Inspector: Scripts panel without folders causes errors when creating content scripts section.
https://bugs.webkit.org/show_bug.cgi?id=68827

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.insertOrdered.optionCompare):
(WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.insertOrdered):
(WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):

LayoutTests:

* inspector/debugger/scripts-panel-expected.txt:
* inspector/debugger/scripts-panel.html:
* inspector/debugger/scripts-sorting-expected.txt:
* inspector/debugger/scripts-sorting.html:
* platform/chromium-win/inspector/debugger/scripts-panel-expected.txt: Removed.
* platform/chromium/inspector/debugger/scripts-sorting-expected.txt: Removed.
* platform/mac/inspector/debugger/scripts-panel-expected.txt: Removed.
* platform/win/inspector/debugger/scripts-panel-expected.txt: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (96318 => 96319)


--- trunk/LayoutTests/ChangeLog	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/ChangeLog	2011-09-29 11:39:11 UTC (rev 96319)
@@ -1,3 +1,19 @@
+2011-09-27  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: Scripts panel without folders causes errors when creating content scripts section.
+        https://bugs.webkit.org/show_bug.cgi?id=68827
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/scripts-panel-expected.txt:
+        * inspector/debugger/scripts-panel.html:
+        * inspector/debugger/scripts-sorting-expected.txt:
+        * inspector/debugger/scripts-sorting.html:
+        * platform/chromium-win/inspector/debugger/scripts-panel-expected.txt: Removed.
+        * platform/chromium/inspector/debugger/scripts-sorting-expected.txt: Removed.
+        * platform/mac/inspector/debugger/scripts-panel-expected.txt: Removed.
+        * platform/win/inspector/debugger/scripts-panel-expected.txt: Removed.
+
 2011-09-29  Arun Patole  <bmf...@motorola.com>
 
         LayoutTests: media/video-does-not-loop.html failing on Snow Leopard

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt (96318 => 96319)


--- trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:39:11 UTC (rev 96319)
@@ -28,6 +28,7 @@
 LayoutTests/inspector/debugger/foo/baz
     script.js(<root>/foo/baz/script.js)
 — Content scripts —
+LayoutTests/inspector/debugger/foo/bar
     contentScript.js?a=1(<root>/foo/bar/contentScript.js?a=1)
     contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2)
     contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1)

Modified: trunk/LayoutTests/inspector/debugger/scripts-panel.html (96318 => 96319)


--- trunk/LayoutTests/inspector/debugger/scripts-panel.html	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/inspector/debugger/scripts-panel.html	2011-09-29 11:39:11 UTC (rev 96319)
@@ -6,6 +6,9 @@
 
 function test()
 {
+    // Always use indentation in scripts drop box
+    WebInspector._isMac = false;
+
     function createDebuggerPresentationModelMock()
     {
         var model = new WebInspector.Object();

Modified: trunk/LayoutTests/inspector/debugger/scripts-sorting-expected.txt (96318 => 96319)


--- trunk/LayoutTests/inspector/debugger/scripts-sorting-expected.txt	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/inspector/debugger/scripts-sorting-expected.txt	2011-09-29 11:39:11 UTC (rev 96319)
@@ -3,9 +3,81 @@
 Debugger was enabled.
 
 WebInspector.settings.showScriptFolders = true
+    *Non*URL*path
+— bar.com —
+/foo/path
+    bar.js?file=bar/zzz.js
+    foo.js?file=bar/aaa.js
+— foo.com —
+    block.js?block=foo
+    ga.js
+    lenta.ban?pg=4883&ifr=1
+    lenta.ban?pg=5309&ifr=1
+    top100.jcn?80674
+/_js/production
+    motor.js?1308927432
+/foo/path
+    bar.js?file=bar/zzz.js
+    foo.js?file=bar/aaa.js
+/i
+    xgemius.js
+/i/js
+    jquery-1.5.1.min.js
+    jquery.cookie.js
+— Content scripts —
+    *Non*URL*path
+extension-name
+    bar.js
+extension-name/folder
+    baz.js
 
 WebInspector.settings.showScriptFolders = false
+*Non*URL*path
+bar.js?file=bar/zzz.js
+bar.js?file=bar/zzz.js
+block.js?block=foo
+foo.js?file=bar/aaa.js
+foo.js?file=bar/aaa.js
+ga.js
+jquery-1.5.1.min.js
+jquery.cookie.js
+lenta.ban?pg=4883&ifr=1
+lenta.ban?pg=5309&ifr=1
+motor.js?1308927432
+top100.jcn?80674
+xgemius.js
+— Content scripts —
+*Non*URL*path
+extension-name/bar.js
+extension-name/folder/baz.js
 
 WebInspector.settings.showScriptFolders = true
+    *Non*URL*path
+— bar.com —
+/foo/path
+    bar.js?file=bar/zzz.js
+    foo.js?file=bar/aaa.js
+— foo.com —
+    block.js?block=foo
+    ga.js
+    lenta.ban?pg=4883&ifr=1
+    lenta.ban?pg=5309&ifr=1
+    top100.jcn?80674
+/_js/production
+    motor.js?1308927432
+/foo/path
+    bar.js?file=bar/zzz.js
+    foo.js?file=bar/aaa.js
+/i
+    xgemius.js
+/i/js
+    jquery-1.5.1.min.js
+    jquery.cookie.js
+— Content scripts —
+    *Non*URL*path
+extension-name
+    bar.js
+extension-name/folder
+    baz.js
 Debugger was disabled.
 

Modified: trunk/LayoutTests/inspector/debugger/scripts-sorting.html (96318 => 96319)


--- trunk/LayoutTests/inspector/debugger/scripts-sorting.html	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/inspector/debugger/scripts-sorting.html	2011-09-29 11:39:11 UTC (rev 96319)
@@ -4,34 +4,44 @@
 <script src=""
 
 <script>
-var scripts = [
-    "block.js?block=foo",
-    "ga.js",
-    "lenta.ban?pg=4883&ifr=1",
-    "lenta.ban?pg=5309&ifr=1",
-    "top100.jcn?80674",
-    "_js/production/motor.js?1308927432",
-    "i/xgemius.js",
-    "i/js/jquery-1.5.1.min.js",
-    "i/js/jquery.cookie.js",
-    "foo/path/bar.js?file=bar/zzz.js",
-    "foo/path/foo.js?file=bar/aaa.js" ];
-
-for (var i = 0; i < scripts.length; ++i)
-    window.eval("function func" + i + "() {} //@ sourceURL=http://foo.com/" + scripts[i]);
-
-window.eval("function funcNonURL() {} //@ sourceURL=*Non*URL*path");
-
-</script>
-
-<script>
 function test()
 {
-    var scripts = [];
+    // Always use indentation in scripts drop box
+    WebInspector._isMac = false;
+
     InspectorTest.startDebuggerTest(step1);
 
     function step1()
     {
+        var scripts = [
+            "block.js?block=foo",
+            "ga.js",
+            "lenta.ban?pg=4883&ifr=1",
+            "lenta.ban?pg=5309&ifr=1",
+            "top100.jcn?80674",
+            "_js/production/motor.js?1308927432",
+            "i/xgemius.js",
+            "i/js/jquery-1.5.1.min.js",
+            "i/js/jquery.cookie.js",
+            "foo/path/bar.js?file=bar/zzz.js",
+            "foo/path/foo.js?file=bar/aaa.js" ];
+        for (var i = 0; i < scripts.length; ++i)
+            addOption("http://foo.com/" + scripts[i]);
+
+        var scripts2 = [
+            "foo/path/bar.js?file=bar/zzz.js",
+            "foo/path/foo.js?file=bar/aaa.js" ];
+        for (var i = 0; i < scripts2.length; ++i)
+            addOption("http://bar.com/" + scripts2[i]);
+        addOption("*Non*URL*path");
+
+        var extensions = [
+            "extension-schema://extension-name/bar.js",
+            "extension-schema://extension-name/folder/baz.js" ];
+        for (var i = 0; i < extensions.length; ++i)
+            addOption(extensions[i], true);
+        addOption("*Non*URL*path", true);
+
         try {
             dumpScriptsList();
             WebInspector.settings.showScriptFolders.set(false);
@@ -43,16 +53,24 @@
         InspectorTest.completeDebuggerTest();
     }
 
+    var nextId = 1;
+
+    function addOption(url, isContentScript)
+    {
+        WebInspector.panels.scripts._addOptionToFilesSelect({ id: nextId++, url: url, isContentScript: isContentScript });
+    }
+
     function dumpScriptsList()
     {
         InspectorTest.addResult("");
         InspectorTest.addResult("WebInspector.settings.showScriptFolders = " + WebInspector.settings.showScriptFolders.get());
         var select = WebInspector.panels.scripts._filesSelectElement;
         for (var i = 0; i < select.length; ++i) {
-            var text = select[i].textContent.replace(/\u00a0/g, " ");
-            if (select[i].nameForSorting.indexOf("LayoutTests/") !== -1)
+            if (select[i]._uiSourceCode && select[i]._uiSourceCode.url.indexOf("LayoutTests/") !== -1)
                 continue;
-            InspectorTest.addResult(text);
+            if (select[i].textContent.indexOf("LayoutTests/") !== -1)
+                continue;
+            InspectorTest.addResult(select[i].textContent.replace(/\u00a0/g, " "));
         }
     }
 }

Deleted: trunk/LayoutTests/platform/chromium/inspector/debugger/scripts-sorting-expected.txt (96318 => 96319)


--- trunk/LayoutTests/platform/chromium/inspector/debugger/scripts-sorting-expected.txt	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/platform/chromium/inspector/debugger/scripts-sorting-expected.txt	2011-09-29 11:39:11 UTC (rev 96319)
@@ -1,57 +0,0 @@
-Tests scripts sorting in the scripts panel.
-
-Debugger was enabled.
-
-WebInspector.settings.showScriptFolders = true
-    *Non*URL*path
-— foo.com —
-    block.js?block=foo
-    ga.js
-    lenta.ban?pg=4883&ifr=1
-    lenta.ban?pg=5309&ifr=1
-    top100.jcn?80674
-/_js/production
-    motor.js?1308927432
-/foo/path
-    bar.js?file=bar/zzz.js
-    foo.js?file=bar/aaa.js
-/i
-    xgemius.js
-/i/js
-    jquery-1.5.1.min.js
-    jquery.cookie.js
-
-WebInspector.settings.showScriptFolders = false
-*Non*URL*path
-bar.js?file=bar/zzz.js
-block.js?block=foo
-foo.js?file=bar/aaa.js
-ga.js
-jquery-1.5.1.min.js
-jquery.cookie.js
-lenta.ban?pg=4883&ifr=1
-lenta.ban?pg=5309&ifr=1
-motor.js?1308927432
-top100.jcn?80674
-xgemius.js
-
-WebInspector.settings.showScriptFolders = true
-    *Non*URL*path
-— foo.com —
-    block.js?block=foo
-    ga.js
-    lenta.ban?pg=4883&ifr=1
-    lenta.ban?pg=5309&ifr=1
-    top100.jcn?80674
-/_js/production
-    motor.js?1308927432
-/foo/path
-    bar.js?file=bar/zzz.js
-    foo.js?file=bar/aaa.js
-/i
-    xgemius.js
-/i/js
-    jquery-1.5.1.min.js
-    jquery.cookie.js
-Debugger was disabled.
-

Deleted: trunk/LayoutTests/platform/chromium-win/inspector/debugger/scripts-panel-expected.txt (96318 => 96319)


--- trunk/LayoutTests/platform/chromium-win/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/platform/chromium-win/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:39:11 UTC (rev 96319)
@@ -1,38 +0,0 @@
-Tests that scripts panel UI elements work as intended.
-
-
-Running: testInitialLoad
-Source requested for foo.js
-Dump files select:
-    bar.js
-    baz.js
-    foo.js
-Source requested for baz.js
-
-Running: testHistory
-Source requested for index.html
-Source requested for script1.js
-Source requested for script2.js
-Source requested for script3.js
-
-Running: testFilesSelect
-    ?a=b(?a=b)
-    ...oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url(very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url)
-— example.com —
-    ?a=b(http://example.com/?a=b)
-— localhost —
-LayoutTests/inspector/debugger/foo/bar
-    script.js(<root>/foo/bar/script.js)
-    script.js?a=1(<root>/foo/bar/script.js?a=1)
-    script.js?a=2(<root>/foo/bar/script.js?a=2)
-LayoutTests/inspector/debugger/foo/baz
-    script.js(<root>/foo/baz/script.js)
-— Content scripts —
-    contentScript.js?a=1(<root>/foo/bar/contentScript.js?a=1)
-    contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2)
-    contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1)
-
-Running: testSourceReplaced
-Source requested for foo.js
-Source requested for bar.js
-

Deleted: trunk/LayoutTests/platform/mac/inspector/debugger/scripts-panel-expected.txt (96318 => 96319)


--- trunk/LayoutTests/platform/mac/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/platform/mac/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:39:11 UTC (rev 96319)
@@ -1,38 +0,0 @@
-Tests that scripts panel UI elements work as intended.
-
-
-Running: testInitialLoad
-Source requested for foo.js
-Dump files select:
-bar.js
-baz.js
-foo.js
-Source requested for baz.js
-
-Running: testHistory
-Source requested for index.html
-Source requested for script1.js
-Source requested for script2.js
-Source requested for script3.js
-
-Running: testFilesSelect
-?a=b(?a=b)
-...oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url(very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url)
-— example.com —
-?a=b(http://example.com/?a=b)
-— localhost —
-LayoutTests/inspector/debugger/foo/bar
-script.js(<root>/foo/bar/script.js)
-script.js?a=1(<root>/foo/bar/script.js?a=1)
-script.js?a=2(<root>/foo/bar/script.js?a=2)
-LayoutTests/inspector/debugger/foo/baz
-script.js(<root>/foo/baz/script.js)
-— Content scripts —
-contentScript.js?a=1(<root>/foo/bar/contentScript.js?a=1)
-contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2)
-contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1)
-
-Running: testSourceReplaced
-Source requested for foo.js
-Source requested for bar.js
-

Deleted: trunk/LayoutTests/platform/win/inspector/debugger/scripts-panel-expected.txt (96318 => 96319)


--- trunk/LayoutTests/platform/win/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/LayoutTests/platform/win/inspector/debugger/scripts-panel-expected.txt	2011-09-29 11:39:11 UTC (rev 96319)
@@ -1,38 +0,0 @@
-Tests that scripts panel UI elements work as intended.
-
-
-Running: testInitialLoad
-Source requested for foo.js
-Dump files select:
-    bar.js
-    baz.js
-    foo.js
-Source requested for baz.js
-
-Running: testHistory
-Source requested for index.html
-Source requested for script1.js
-Source requested for script2.js
-Source requested for script3.js
-
-Running: testFilesSelect
-    ?a=b(?a=b)
-    ...oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url(very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url)
-— example.com —
-    ?a=b(http://example.com/?a=b)
-— localhost —
-LayoutTests/inspector/debugger/foo/bar
-    script.js(<root>/foo/bar/script.js)
-    script.js?a=1(<root>/foo/bar/script.js?a=1)
-    script.js?a=2(<root>/foo/bar/script.js?a=2)
-LayoutTests/inspector/debugger/foo/baz
-    script.js(<root>/foo/baz/script.js)
-— Content scripts —
-    contentScript.js?a=1(<root>/foo/bar/contentScript.js?a=1)
-    contentScript.js?a=2(<root>/foo/bar/contentScript.js?a=2)
-    contentScript2.js?a=1(<root>/foo/bar/contentScript2.js?a=1)
-
-Running: testSourceReplaced
-Source requested for foo.js
-Source requested for bar.js
-

Modified: trunk/Source/WebCore/ChangeLog (96318 => 96319)


--- trunk/Source/WebCore/ChangeLog	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/Source/WebCore/ChangeLog	2011-09-29 11:39:11 UTC (rev 96319)
@@ -1,3 +1,15 @@
+2011-09-27  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: Scripts panel without folders causes errors when creating content scripts section.
+        https://bugs.webkit.org/show_bug.cgi?id=68827
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.insertOrdered.optionCompare):
+        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect.insertOrdered):
+        (WebInspector.ScriptsPanel.prototype._addOptionToFilesSelect):
+
 2011-09-28  Andrey Kosyakov  <ca...@chromium.org>
 
         Web Inspector: network log view refresh optimizations

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (96318 => 96319)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-09-29 11:06:15 UTC (rev 96318)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-09-29 11:39:11 UTC (rev 96319)
@@ -284,19 +284,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");
 
@@ -304,10 +318,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));
@@ -333,12 +344,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);
         }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to