Commit 1147ea0f authored by Ingvar Stepanyan's avatar Ingvar Stepanyan Committed by Commit Bot

Remove preview fallback to source view

 - Errors are handled as part of _htmlPreview.
 - image/svg is already handled as an image as part of PreviewFactory.createPreview.
 - Text types are already handled as source as part of PreviewFactory.createPreview (and with better defaults like auto-formatting).

The only branch in which case this was still hit is Other resource type with non-encoded content, but it's best not to use that as heuristic since backend might encode text content as well and vice versa, so it's better not to show any preview in that case at all. Note that user can still check raw Response tab if they wish.

Change-Id: Icb76f2d54641a73aeef62d3e1c98c731ee894ab5
Reviewed-on: https://chromium-review.googlesource.com/1216303Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Ingvar Stepanyan <ingvar@cloudflare.com>
Cr-Commit-Position: refs/heads/master@{#593673}
parent dd7865c4
......@@ -86,14 +86,10 @@ Network.RequestPreviewView = class extends Network.RequestResponseView {
if (htmlErrorPreview)
return htmlErrorPreview;
// Try provider before the source view - so JSON and XML are not shown in generic editor
const provided = await SourceFrame.PreviewFactory.createPreview(this.request, this.request.mimeType);
if (provided)
return provided;
const sourceView = await Network.RequestResponseView.sourceViewForRequest(this.request);
if (sourceView)
return sourceView;
return new UI.EmptyWidget(Common.UIString('Preview not available'));
}
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment