Bug 1478051 - Skip using stylesheet from Netmonitor if its content size is zero. r=jdescottes draft
authorRazvan Caliman <rcaliman@mozilla.com>
Wed, 25 Jul 2018 16:14:02 +0200
changeset 822654 9c5aba4cf3c81d83172c49c16412613ed8e5eb3e
parent 822473 0b9c0b211eb3d84c5afdb64f4a91d079d0aa4c75
push id117426
push userbmo:rcaliman@mozilla.com
push dateWed, 25 Jul 2018 15:53:51 +0000
reviewersjdescottes
bugs1478051
milestone63.0a1
Bug 1478051 - Skip using stylesheet from Netmonitor if its content size is zero. r=jdescottes MozReview-Commit-ID: 6A1YbwDmBVj
devtools/server/actors/stylesheets.js
--- a/devtools/server/actors/stylesheets.js
+++ b/devtools/server/actors/stylesheets.js
@@ -153,17 +153,19 @@ function fetchStylesheetFromNetworkMonit
   if (!consoleActor) {
     return null;
   }
   const request = consoleActor.getNetworkEventActorForURL(href);
   if (!request) {
     return null;
   }
   const content = request._response.content;
-  if (request._discardResponseBody || request._truncated || !content) {
+  if (request._discardResponseBody || request._truncated || !content || !content.size) {
+    // Do not return the stylesheet text if there is no meaningful content or if it's
+    // still loading. Let the caller handle it by doing its own separate request.
     return null;
   }
 
   if (content.text.type != "longString") {
     // For short strings, the text is available directly.
     return {
       content: content.text,
       contentType: content.mimeType,