Skip to content

Commit e4611e4

Browse files
szuendDevtools-frontend LUCI CQ
authored andcommitted
[cleanup] Pass StreamingContentData directly to private helper
... and make the helper truly private. This alleviates the need for the helper to be async and also removes one unnecessary check. [email protected] Bug: 375546679 Change-Id: I53241f1488620e05e99ab21465f07bc641b916ac Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5979750 Reviewed-by: Philip Pfaffe <[email protected]> Auto-Submit: Simon Zünd <[email protected]> Commit-Queue: Simon Zünd <[email protected]>
1 parent e34b23c commit e4611e4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

front_end/panels/network/RequestResponseView.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,14 @@ export class RequestResponseView extends UI.Widget.VBox {
6363
this.contentViewPromise = null;
6464
}
6565

66-
static async sourceViewForRequest(request: SDK.NetworkRequest.NetworkRequest): Promise<UI.Widget.Widget|null> {
66+
static #sourceViewForRequest(
67+
request: SDK.NetworkRequest.NetworkRequest,
68+
contentData: TextUtils.StreamingContentData.StreamingContentData): UI.Widget.Widget|null {
6769
let sourceView = requestToSourceView.get(request);
6870
if (sourceView !== undefined) {
6971
return sourceView;
7072
}
7173

72-
const contentData = await request.requestStreamingContent();
73-
if (TextUtils.StreamingContentData.isError(contentData)) {
74-
requestToSourceView.delete(request);
75-
return null;
76-
}
77-
7874
let mimeType;
7975
// If the main document is of type JSON (or any JSON subtype), do not use the more generic canonical MIME type,
8076
// which would prevent the JSON from being pretty-printed. See https://crbug.com/406900
@@ -126,7 +122,7 @@ export class RequestResponseView extends UI.Widget.VBox {
126122
return new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.failedToLoadResponseData) + ': ' + contentData.error);
127123
}
128124

129-
const sourceView = await RequestResponseView.sourceViewForRequest(this.request);
125+
const sourceView = RequestResponseView.#sourceViewForRequest(this.request, contentData);
130126
if (!sourceView || this.request.statusCode === 204) {
131127
return new UI.EmptyWidget.EmptyWidget(i18nString(UIStrings.thisRequestHasNoResponseData));
132128
}

0 commit comments

Comments
 (0)