Title: [95797] trunk
Revision
95797
Author
[email protected]
Date
2011-09-23 06:17:49 -0700 (Fri, 23 Sep 2011)

Log Message

Web Inspector: skip overlapping scripts when displaying concatenated content.
https://bugs.webkit.org/show_bug.cgi?id=68144

Source/WebCore:

Dynamically appended script tags have wrong offsets and cause troubles building concatenated content.

Reviewed by Pavel Feldman.

* inspector/front-end/SourceFile.js:
(WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent.appendChunk):
(WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent):

LayoutTests:

Reviewed by Pavel Feldman.

* inspector/debugger/content-providers-expected.txt:
* inspector/debugger/content-providers.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (95796 => 95797)


--- trunk/LayoutTests/ChangeLog	2011-09-23 13:04:46 UTC (rev 95796)
+++ trunk/LayoutTests/ChangeLog	2011-09-23 13:17:49 UTC (rev 95797)
@@ -1,3 +1,13 @@
+2011-09-15  Pavel Podivilov  <[email protected]>
+
+        Web Inspector: skip overlapping scripts when displaying concatenated content.
+        https://bugs.webkit.org/show_bug.cgi?id=68144
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/content-providers-expected.txt:
+        * inspector/debugger/content-providers.html:
+
 2011-09-23  Xan Lopez  <[email protected]>
 
         [GTK] Rebaseline following r95745, r95725

Modified: trunk/LayoutTests/inspector/debugger/content-providers-expected.txt (95796 => 95797)


--- trunk/LayoutTests/inspector/debugger/content-providers-expected.txt	2011-09-23 13:04:46 UTC (rev 95796)
+++ trunk/LayoutTests/inspector/debugger/content-providers-expected.txt	2011-09-23 13:17:49 UTC (rev 95797)
@@ -2,15 +2,11 @@
 
 
 Running: testScriptContentProvider
-Request foo.js source.
 
 Running: testConcatenatedScriptsContentProvider
-Request foo.js source.
-Request bar.js source.
-Request baz.js source.
+  <script>function foo() { return 0; }</script>
+                                                              <script>function bar() { return 0; }</script>
 
-  <script>function foo() { return 0; }</script>               <script>function bar() { return 0; }</script>
-
             <script>
 function baz()
 {

Modified: trunk/LayoutTests/inspector/debugger/content-providers.html (95796 => 95797)


--- trunk/LayoutTests/inspector/debugger/content-providers.html	2011-09-23 13:04:46 UTC (rev 95796)
+++ trunk/LayoutTests/inspector/debugger/content-providers.html	2011-09-23 13:17:49 UTC (rev 95797)
@@ -12,7 +12,6 @@
         return {
             requestSource: function(callback)
             {
-                InspectorTest.addResult("Request " + id + " source.");
                 callback(source);
             },
             get lineOffset() { return range[0]; },
@@ -38,9 +37,10 @@
         function testConcatenatedScriptsContentProvider(next)
         {
             var scripts = [];
-            scripts.push(createMockScript("baz.js", "\nfunction baz()\n{\n  return 0;\n}\n", [3, 20]));
-            scripts.push(createMockScript("foo.js", "function foo() { return 0; }", [1, 10]));
-            scripts.push(createMockScript("bar.js", "function bar() { return 0; }", [1, 70]));
+            scripts.push(createMockScript("1", "\nfunction baz()\n{\n  return 0;\n}\n", [3, 20]));
+            scripts.push(createMockScript("2", "function foo() { return 0; }", [0, 10]));
+            scripts.push(createMockScript("3", "function bar() { return 0; }", [1, 70]));
+            scripts.push(createMockScript("4", "this should not appear in displayed content", [0, 20]));
             var contentProvider = new WebInspector.ConcatenatedScriptsContentProvider(scripts);
             function didRequestContent(mimeType, content)
             {

Modified: trunk/Source/WebCore/ChangeLog (95796 => 95797)


--- trunk/Source/WebCore/ChangeLog	2011-09-23 13:04:46 UTC (rev 95796)
+++ trunk/Source/WebCore/ChangeLog	2011-09-23 13:17:49 UTC (rev 95797)
@@ -1,3 +1,16 @@
+2011-09-15  Pavel Podivilov  <[email protected]>
+
+        Web Inspector: skip overlapping scripts when displaying concatenated content.
+        https://bugs.webkit.org/show_bug.cgi?id=68144
+
+        Dynamically appended script tags have wrong offsets and cause troubles building concatenated content.
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/SourceFile.js:
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent.appendChunk):
+        (WebInspector.ConcatenatedScriptsContentProvider.prototype._concatenateScriptsContent):
+
 2011-09-23  Ilya Tikhonovsky  <[email protected]>
 
         Web Inspector: file open dialog appears when user clicks on the timeline bar in timeline panel.

Modified: trunk/Source/WebCore/inspector/front-end/SourceFile.js (95796 => 95797)


--- trunk/Source/WebCore/inspector/front-end/SourceFile.js	2011-09-23 13:04:46 UTC (rev 95796)
+++ trunk/Source/WebCore/inspector/front-end/SourceFile.js	2011-09-23 13:17:49 UTC (rev 95797)
@@ -318,7 +318,6 @@
 
        function appendChunk(chunk)
        {
-           var start = { lineNumber: lineNumber, columnNumber: columnNumber };
            content += chunk;
            var lineEndings = chunk.lineEndings();
            var lineCount = lineEndings.length;
@@ -328,12 +327,14 @@
                lineNumber += lineCount - 1;
                columnNumber = lineEndings[lineCount - 1] - lineEndings[lineCount - 2] - 1;
            }
-           var end = { lineNumber: lineNumber, columnNumber: columnNumber };
        }
 
        var scriptOpenTag = "<script>";
        var scriptCloseTag = "</script>";
        for (var i = 0; i < scripts.length; ++i) {
+           if (lineNumber > scripts[i].lineOffset || (lineNumber === scripts[i].lineOffset && columnNumber > scripts[i].columnOffset - scriptOpenTag.length))
+               continue;
+
            // Fill the gap with whitespace characters.
            while (lineNumber < scripts[i].lineOffset)
                appendChunk("\n");
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to