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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 var htmlErrorPreview = this._htmlErrorPreview(); 137 var htmlErrorPreview = this._htmlErrorPreview();
138 if (htmlErrorPreview) 138 if (htmlErrorPreview)
139 return htmlErrorPreview; 139 return htmlErrorPreview;
140 } 140 }
141 141
142 var xmlView = this._xmlView(); 142 var xmlView = this._xmlView();
143 if (xmlView) 143 if (xmlView)
144 return xmlView; 144 return xmlView;
145 145
146 if (this.request.resourceType() === WebInspector.resourceTypes.XHR) { 146 if (this.request.resourceType() === WebInspector.resourceTypes.XHR) {
147 var jsonView = this._jsonView(); 147 var isHtml = false;
148 if (jsonView) 148 try {
149 return jsonView; 149 isHtml = !!((new DOMParser()).parseFromString(this._requestConte nt(), mimeType)).body;
150 var htmlErrorPreview = this._htmlErrorPreview(); 150 } catch (e) {
151 if (htmlErrorPreview) 151 }
152 return htmlErrorPreview; 152 if (!isHtml) {
153 var jsonView = this._jsonView();
154 if (jsonView)
155 return jsonView;
156 } else {
157 var htmlErrorPreview = this._htmlErrorPreview();
158 if (htmlErrorPreview)
159 return htmlErrorPreview;
160 }
153 } 161 }
154 162
155 if (this._responseView.sourceView) 163 if (this._responseView.sourceView)
156 return this._responseView.sourceView; 164 return this._responseView.sourceView;
157 165
158 if (this.request.resourceType() === WebInspector.resourceTypes.Other) 166 if (this.request.resourceType() === WebInspector.resourceTypes.Other)
159 return this._createEmptyView(); 167 return this._createEmptyView();
160 168
161 return WebInspector.RequestView.nonSourceViewForRequest(this.request); 169 return WebInspector.RequestView.nonSourceViewForRequest(this.request);
162 }, 170 },
163 171
164 __proto__: WebInspector.RequestContentView.prototype 172 __proto__: WebInspector.RequestContentView.prototype
165 } 173 }
OLDNEW
« 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