Bug 1478051 - Skip using stylesheet from Netmonitor if its content size is zero. r=jdescottes
MozReview-Commit-ID: 6A1YbwDmBVj
--- 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,