Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1079)

Unified Diff: Source/devtools/front_end/network/RequestPreviewView.js

Issue 973813003: DevTools: NetworkPanel: Preview: do not try to show HTML as JSONP. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/network/RequestPreviewView.js
diff --git a/Source/devtools/front_end/network/RequestPreviewView.js b/Source/devtools/front_end/network/RequestPreviewView.js
index be57b3e7098551fcca3925b3f998a2629247f8e0..da6e8a8b4422eab4ec714e5207ec77595afcebbd 100644
--- a/Source/devtools/front_end/network/RequestPreviewView.js
+++ b/Source/devtools/front_end/network/RequestPreviewView.js
@@ -144,12 +144,20 @@ WebInspector.RequestPreviewView.prototype = {
return xmlView;
if (this.request.resourceType() === WebInspector.resourceTypes.XHR) {
- var jsonView = this._jsonView();
- if (jsonView)
- return jsonView;
- var htmlErrorPreview = this._htmlErrorPreview();
- if (htmlErrorPreview)
- return htmlErrorPreview;
+ var isHtml = false;
+ try {
+ isHtml = !!((new DOMParser()).parseFromString(this._requestContent(), mimeType)).body;
+ } catch (e) {
+ }
+ if (!isHtml) {
+ var jsonView = this._jsonView();
+ if (jsonView)
+ return jsonView;
+ } else {
+ var htmlErrorPreview = this._htmlErrorPreview();
+ if (htmlErrorPreview)
+ return htmlErrorPreview;
+ }
}
if (this._responseView.sourceView)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698