Web Inspector: do not attempt to load content from resource until request finished...
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 15:41:38 +0000 (15:41 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2012 15:41:38 +0000 (15:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=83896

Reviewed by Yury Semikhatsky.

Source/WebCore:

When we stop in the inline script on reload, we should only show concatenated script content.
When we resume, we should replace UI source code with the actual HTML content. We should not attempt to
fetch resource content until request finished loading. I regressed it in the Request extraction
and now am bringing it back.

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

LayoutTests:

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

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@114135 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/inspector/debugger/raw-source-code.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/front-end/RawSourceCode.js
Source/WebCore/inspector/front-end/ResourceScriptMapping.js

index d8531df..ebefe01 100644 (file)
@@ -1,3 +1,12 @@
+2012-04-13  Pavel Feldman  <pfeldman@chromium.org>
+
+        Web Inspector: do not attempt to load content from resource until request finished loading.
+        https://bugs.webkit.org/show_bug.cgi?id=83896
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/raw-source-code.html:
+
 2012-04-13  Philippe Normand  <pnormand@igalia.com>
 
         Unreviewed, GTK test_expectations update.
index 6a50f4e..6b6f132 100644 (file)
@@ -37,7 +37,7 @@ function test()
         return request;
     }
 
-    function finishRequest(request) { WebInspector.networkManager._dispatcher._finishNetworkRequest(request); }
+    function finishRequest(request) { WebInspector.networkManager._dispatcher._updateNetworkRequest(request); WebInspector.networkManager._dispatcher._finishNetworkRequest(request); }
     function createPendingRequestMock(type, content) { return createRequestMock(type, false, content); }
     function createFinishedRequestMock(type, content) { return createRequestMock(type, true, content); }
 
index 94c63df..f355517 100644 (file)
@@ -1,5 +1,23 @@
 2012-04-13  Pavel Feldman  <pfeldman@chromium.org>
 
+        Web Inspector: do not attempt to load content from resource until request finished loading.
+        https://bugs.webkit.org/show_bug.cgi?id=83896
+
+        Reviewed by Yury Semikhatsky.
+
+        When we stop in the inline script on reload, we should only show concatenated script content.
+        When we resume, we should replace UI source code with the actual HTML content. We should not attempt to
+        fetch resource content until request finished loading. I regressed it in the Request extraction
+        and now am bringing it back.
+
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode):
+        (WebInspector.RawSourceCode.prototype._finishedLoading):
+        * inspector/front-end/ResourceScriptMapping.js:
+        (WebInspector.ResourceScriptMapping.prototype.addScript):
+
+2012-04-13  Pavel Feldman  <pfeldman@chromium.org>
+
         Web Inspector: follow up to r114116 - fixing QT test
         https://bugs.webkit.org/show_bug.cgi?id=83892
 
index 4b95b1c..d76e536 100644 (file)
@@ -55,7 +55,7 @@ WebInspector.RawSourceCode = function(id, script, resource, request, formatter,
     this._hasNewScripts = true;
 
     if (this._pendingRequest)
-        WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.ResourceAdded, this._resourceAdded, this);
+        this._pendingRequest.addEventListener(WebInspector.NetworkRequest.Events.FinishedLoading, this._finishedLoading, this);
     else
         this._updateSourceMapping();
 }
@@ -119,13 +119,9 @@ WebInspector.RawSourceCode.prototype = {
         this._updateSourceMapping();
     },
 
-    _resourceAdded: function(event)
+    _finishedLoading: function(event)
     {
-        var resource = /** @type {WebInspector.Resource} */ event.data;
-        if (resource.request !== this._pendingRequest)
-            return;
-
-        this._resource = resource;
+        this._resource = WebInspector.resourceForURL(this._pendingRequest.url);
         delete this._pendingRequest;
         this._updateSourceMapping();
     },
index ffd6401..bdf38ef 100644 (file)
@@ -93,6 +93,9 @@ WebInspector.ResourceScriptMapping.prototype = {
             resource = WebInspector.resourceForURL(script.sourceURL);
             if (resource && resource.type !== WebInspector.resourceTypes.Document)
                 resource = null;
+            // Ignore resource in case it has not yet finished loading.
+            if (resource && resource.request && !resource.request.finished)
+                resource = null;
             if (!resource) {
                 // When there is no resource, lookup in-flight requests of type Document.
                 request = WebInspector.networkManager.inflightRequestForURL(script.sourceURL);