Title: [117768] trunk
Revision
117768
Author
[email protected]
Date
2012-05-21 04:55:32 -0700 (Mon, 21 May 2012)

Log Message

Web Inspector: Temporary UISourceCode should be replaced each time another inline script is added in RawSourceCode with pending request.
https://bugs.webkit.org/show_bug.cgi?id=87003

Reviewed by Pavel Feldman.

Source/WebCore:

This is needed to correctly show document content when debugger stops on several breakpoints in different scripts during page load.

* inspector/front-end/RawSourceCode.js:
(WebInspector.RawSourceCode.prototype.addScript):
(WebInspector.RawSourceCode.prototype._finishedLoading):

LayoutTests:

* inspector/debugger/raw-source-code-expected.txt:
* inspector/debugger/raw-source-code.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117767 => 117768)


--- trunk/LayoutTests/ChangeLog	2012-05-21 11:50:23 UTC (rev 117767)
+++ trunk/LayoutTests/ChangeLog	2012-05-21 11:55:32 UTC (rev 117768)
@@ -1,3 +1,13 @@
+2012-05-21  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Temporary UISourceCode should be replaced each time another inline script is added in RawSourceCode with pending request.
+        https://bugs.webkit.org/show_bug.cgi?id=87003
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/debugger/raw-source-code-expected.txt:
+        * inspector/debugger/raw-source-code.html:
+
 2012-05-21  Pavel Feldman  <[email protected]>
 
         inspector/styles/css-live-edit.html times out.

Modified: trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt (117767 => 117768)


--- trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt	2012-05-21 11:50:23 UTC (rev 117767)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code-expected.txt	2012-05-21 11:55:32 UTC (rev 117768)
@@ -8,9 +8,20 @@
 Script source: <script source>
 
 Running: testHTMLWithPendingResource
+Adding first script for pending request.
 UISourceCode: index.html
 UISourceCode is content script: false
 Mime type: text/html
+Script source:   <script><script source 1></script>
+Adding second script for pending request.
+UISourceCode: index.html
+UISourceCode is content script: false
+Mime type: text/html
+Script source:   <script><script source 1></script> <script><script source 2></script>
+Finishing request.
+UISourceCode: index.html
+UISourceCode is content script: false
+Mime type: text/html
 Script source: <resource content>
 
 Running: testHTMLWithFinishedResource

Modified: trunk/LayoutTests/inspector/debugger/raw-source-code.html (117767 => 117768)


--- trunk/LayoutTests/inspector/debugger/raw-source-code.html	2012-05-21 11:50:23 UTC (rev 117767)
+++ trunk/LayoutTests/inspector/debugger/raw-source-code.html	2012-05-21 11:55:32 UTC (rev 117768)
@@ -117,14 +117,14 @@
             var script1 = InspectorTest.createScriptMock("index.html", 0, 10, false, "<script source 1>");
             var script2 = InspectorTest.createScriptMock("index.html", 0, 45, false, "<script source 2>");
             var request = createPendingRequestMock("document", "<resource content>");
+            InspectorTest.addResult("Adding first script for pending request.");
             var rawSourceCode = createRawSourceCode(script1, request);
 
             InspectorTest.assertTrue(!rawSourceCode.uiSourceCode());
 
-            waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeChanged);
-            finishRequest(request);
-
-            function uiSourceCodeChanged(event)
+            waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeAdded);
+            rawSourceCode.rawLocationToUILocation(createRawLocation(0, 10));
+            function uiSourceCodeAdded(event)
             {
                 InspectorTest.assertTrue(!event.data.oldUISourceCode);
                 InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode());
@@ -132,16 +132,55 @@
                 InspectorTest.addResult("UISourceCode: " + uiSourceCode.url);
                 InspectorTest.addResult("UISourceCode is content script: " + uiSourceCode.isContentScript);
                 uiSourceCode.requestContent(didRequestContent);
+
+                function didRequestContent(content, contentEncoded, mimeType)
+                {
+                    InspectorTest.addResult("Mime type: " + mimeType);
+                    InspectorTest.addResult("Script source: " + content);
+
+                    waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeChangedAfterScriptAdded);
+                    InspectorTest.addResult("Adding second script for pending request.");
+                    rawSourceCode.addScript(script2);
+                  }
             }
 
-            function didRequestContent(content, contentEncoded, mimeType)
+            function uiSourceCodeChangedAfterScriptAdded(event)
             {
-                InspectorTest.addResult("Mime type: " + mimeType);
-                InspectorTest.addResult("Script source: " + content);
+                InspectorTest.assertTrue(event.data.oldUISourceCode);
+                InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode());
+                var uiSourceCode = rawSourceCode.uiSourceCode();
+                InspectorTest.addResult("UISourceCode: " + uiSourceCode.url);
+                InspectorTest.addResult("UISourceCode is content script: " + uiSourceCode.isContentScript);
+                uiSourceCode.requestContent(didRequestContent);
 
-                rawSourceCode.addScript(script2);
-                next();
-            }
+                function didRequestContent(content, contentEncoded, mimeType)
+                {
+                    InspectorTest.addResult("Mime type: " + mimeType);
+                    InspectorTest.addResult("Script source: " + content);
+
+                    waitForUISourceCodeChangedEvent(rawSourceCode, uiSourceCodeChangedAfterRequestFinished);
+                    InspectorTest.addResult("Finishing request.");
+                    finishRequest(request);
+                }
+              }
+
+            function uiSourceCodeChangedAfterRequestFinished(event)
+            {
+                InspectorTest.assertTrue(event.data.oldUISourceCode);
+                InspectorTest.assertTrue(!!rawSourceCode.uiSourceCode());
+                var uiSourceCode = rawSourceCode.uiSourceCode();
+                InspectorTest.addResult("UISourceCode: " + uiSourceCode.url);
+                InspectorTest.addResult("UISourceCode is content script: " + uiSourceCode.isContentScript);
+                uiSourceCode.requestContent(didRequestContent);
+
+                function didRequestContent(content, contentEncoded, mimeType)
+                {
+                    InspectorTest.addResult("Mime type: " + mimeType);
+                    InspectorTest.addResult("Script source: " + content);
+
+                    next();
+                }
+              }
         },
 
         function testHTMLWithFinishedResource(next)

Modified: trunk/Source/WebCore/ChangeLog (117767 => 117768)


--- trunk/Source/WebCore/ChangeLog	2012-05-21 11:50:23 UTC (rev 117767)
+++ trunk/Source/WebCore/ChangeLog	2012-05-21 11:55:32 UTC (rev 117768)
@@ -1,3 +1,16 @@
+2012-05-21  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: Temporary UISourceCode should be replaced each time another inline script is added in RawSourceCode with pending request.
+        https://bugs.webkit.org/show_bug.cgi?id=87003
+
+        Reviewed by Pavel Feldman.
+
+        This is needed to correctly show document content when debugger stops on several breakpoints in different scripts during page load.
+
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode.prototype.addScript):
+        (WebInspector.RawSourceCode.prototype._finishedLoading):
+
 2012-05-20  Kinuko Yasuda  <[email protected]>
 
         Cleanup: Remove WebCore::revealFolderInOS() which is no longer used anywhere

Modified: trunk/Source/WebCore/inspector/front-end/RawSourceCode.js (117767 => 117768)


--- trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2012-05-21 11:50:23 UTC (rev 117767)
+++ trunk/Source/WebCore/inspector/front-end/RawSourceCode.js	2012-05-21 11:55:32 UTC (rev 117768)
@@ -68,6 +68,11 @@
     addScript: function(script)
     {
         this._scripts.push(script);
+        if (this._temporaryUISourceCode) {
+            var oldUISourceCode = this._temporaryUISourceCode;
+            this._temporaryUISourceCode = this._createUISourceCode();
+            this.dispatchEventToListeners(WebInspector.RawSourceCode.Events.UISourceCodeChanged, { uiSourceCode: this._temporaryUISourceCode, oldUISourceCode: oldUISourceCode });
+        }
     },
 
     /**
@@ -131,6 +136,7 @@
         this._resource = WebInspector.resourceForURL(this._pendingRequest.url);
         delete this._pendingRequest;
         var oldUISourceCode = this._uiSourceCode || this._temporaryUISourceCode;
+        delete this._temporaryUISourceCode;
         this._uiSourceCode = this._createUISourceCode();
         this.dispatchEventToListeners(WebInspector.RawSourceCode.Events.UISourceCodeChanged, { uiSourceCode: this._uiSourceCode, oldUISourceCode: oldUISourceCode });
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to