Title: [243452] trunk
Revision
243452
Author
[email protected]
Date
2019-03-25 13:45:37 -0700 (Mon, 25 Mar 2019)

Log Message

Web Inspector: Page Weight indicator clears on pages with zero length resources (macrumors.com)
https://bugs.webkit.org/show_bug.cgi?id=196170

Reviewed by Timothy Hatcher.

Source/WebInspectorUI:

* UserInterface/Models/DefaultDashboard.js:
(WI.DefaultDashboard.prototype._resourceSizeDidChange):
Catch NaN earlier.

* UserInterface/Models/Resource.js:
(WI.Resource.prototype.updateWithMetrics):
When we receive exact metrics transition the estimated size to zero,
since we won't receive any more updates for the resource.

LayoutTests:

* http/tests/inspector/network/resource-sizes-network.html:
* http/tests/inspector/network/resources/empty.txt: Added.
* platform/mac/http/tests/inspector/network/resource-sizes-network-expected.txt:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243451 => 243452)


--- trunk/LayoutTests/ChangeLog	2019-03-25 20:43:47 UTC (rev 243451)
+++ trunk/LayoutTests/ChangeLog	2019-03-25 20:45:37 UTC (rev 243452)
@@ -1,3 +1,14 @@
+2019-03-25  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Page Weight indicator clears on pages with zero length resources (macrumors.com)
+        https://bugs.webkit.org/show_bug.cgi?id=196170
+
+        Reviewed by Timothy Hatcher.
+
+        * http/tests/inspector/network/resource-sizes-network.html:
+        * http/tests/inspector/network/resources/empty.txt: Added.
+        * platform/mac/http/tests/inspector/network/resource-sizes-network-expected.txt:
+
 2019-03-25  Eric Carlson  <[email protected]>
 
         Delete MetadataPreloadingNotPermitted, it is unused

Modified: trunk/LayoutTests/http/tests/inspector/network/resource-sizes-network.html (243451 => 243452)


--- trunk/LayoutTests/http/tests/inspector/network/resource-sizes-network.html	2019-03-25 20:43:47 UTC (rev 243451)
+++ trunk/LayoutTests/http/tests/inspector/network/resource-sizes-network.html	2019-03-25 20:45:37 UTC (rev 243452)
@@ -43,6 +43,19 @@
     });
 
     addResourceSizeTest(suite, {
+        name: "Resource.Size.Network.text",
+        description: "Sizes of an empty text resource",
+        url: "resources/empty.txt?" + Math.random(),
+        statusCode: 200,
+        compressed: false,
+        responseSource: WI.Resource.ResponseSource.Network,
+        headers: true,
+        requestBodyTransferSize: 0,
+        responseBodyTransferSize: 0,
+        size: 0,
+    });
+
+    addResourceSizeTest(suite, {
         name: "Resource.Size.Network.text.gzipped",
         description: "Sizes of a gzipped text resource",
         url: "resources/gzipped-lorem.php?" + Math.random(),

Added: trunk/LayoutTests/http/tests/inspector/network/resources/empty.txt ( => )


Modified: trunk/LayoutTests/platform/mac/http/tests/inspector/network/resource-sizes-network-expected.txt
===================================================================
--- trunk/LayoutTests/platform/mac/http/tests/inspector/network/resource-sizes-network-expected.txt	2019-03-25 20:43:47 UTC (rev 243451)
+++ trunk/LayoutTests/platform/mac/http/tests/inspector/network/resource-sizes-network-expected.txt	2019-03-25 20:45:37 UTC (rev 243452)
@@ -16,6 +16,20 @@
 PASS: requestHeadersTransferSize should be non-empty.
 PASS: responseHeadersTransferSize should be non-empty.
 
+-- Running test case: Resource.Size.Network.text
+PASS: statusCode should be 200.
+PASS: compressed should be false.
+PASS: responseSource should be Symbol(network).
+PASS: estimatedNetworkEncodedSize should be exactly 0 bytes.
+PASS: estimatedTotalTransferSize should be >= (encoded body size + headers).
+PASS: size should be exactly 0 bytes.
+PASS: networkEncodedSize should be exactly 0 bytes.
+PASS: networkTotalTransferSize should be >= (encoded body size + headers).
+PASS: requestBodyTransferSize should be exactly 0 bytes.
+PASS: responseBodyTransferSize should be exactly 0 bytes.
+PASS: requestHeadersTransferSize should be non-empty.
+PASS: responseHeadersTransferSize should be non-empty.
+
 -- Running test case: Resource.Size.Network.text.gzipped
 PASS: statusCode should be 200.
 PASS: compressed should be true.

Modified: trunk/Source/WebInspectorUI/ChangeLog (243451 => 243452)


--- trunk/Source/WebInspectorUI/ChangeLog	2019-03-25 20:43:47 UTC (rev 243451)
+++ trunk/Source/WebInspectorUI/ChangeLog	2019-03-25 20:45:37 UTC (rev 243452)
@@ -1,3 +1,19 @@
+2019-03-25  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Page Weight indicator clears on pages with zero length resources (macrumors.com)
+        https://bugs.webkit.org/show_bug.cgi?id=196170
+
+        Reviewed by Timothy Hatcher.
+
+        * UserInterface/Models/DefaultDashboard.js:
+        (WI.DefaultDashboard.prototype._resourceSizeDidChange):
+        Catch NaN earlier.
+
+        * UserInterface/Models/Resource.js:
+        (WI.Resource.prototype.updateWithMetrics):
+        When we receive exact metrics transition the estimated size to zero,
+        since we won't receive any more updates for the resource.
+
 2019-03-24  Devin Rousso  <[email protected]>
 
         Web Inspector: Canvas: WebGL action icon shouldn't invert when selected

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js (243451 => 243452)


--- trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js	2019-03-25 20:43:47 UTC (rev 243451)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/DefaultDashboard.js	2019-03-25 20:45:37 UTC (rev 243452)
@@ -183,7 +183,10 @@
     {
         if (event.target.urlComponents.scheme === "data")
             return;
-        this.resourcesSize += event.target.size - event.data.previousSize;
+
+        let delta = event.target.size - event.data.previousSize;
+        console.assert(!isNaN(delta), "Resource size change should never be NaN.");
+        this.resourcesSize += delta;
     }
 
     _startUpdatingTime()

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (243451 => 243452)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2019-03-25 20:43:47 UTC (rev 243451)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2019-03-25 20:45:37 UTC (rev 243452)
@@ -789,6 +789,10 @@
             console.assert(this._responseBodyTransferSize >= 0);
             console.assert(this._responseBodySize >= 0);
 
+            // There may have been no size updates received during load if Content-Length was 0.
+            if (isNaN(this._estimatedSize))
+                this._estimatedSize = 0;
+
             this.dispatchEventToListeners(WI.Resource.Event.SizeDidChange, {previousSize: this._estimatedSize});
             this.dispatchEventToListeners(WI.Resource.Event.TransferSizeDidChange);
         }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to