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

Side by Side Diff: Source/devtools/front_end/network/RequestPreviewView.js

Issue 1148133004: Revert of 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, 6 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 isHtml = false; 147 var jsonView = this._jsonView();
148 try { 148 if (jsonView)
149 isHtml = !!((new DOMParser()).parseFromString(this._requestConte nt(), mimeType)).body; 149 return jsonView;
150 } catch (e) { 150 var htmlErrorPreview = this._htmlErrorPreview();
151 } 151 if (htmlErrorPreview)
152 if (!isHtml) { 152 return htmlErrorPreview;
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 }
161 } 153 }
162 154
163 if (this._responseView.sourceView) 155 if (this._responseView.sourceView)
164 return this._responseView.sourceView; 156 return this._responseView.sourceView;
165 157
166 if (this.request.resourceType() === WebInspector.resourceTypes.Other) 158 if (this.request.resourceType() === WebInspector.resourceTypes.Other)
167 return this._createEmptyView(); 159 return this._createEmptyView();
168 160
169 return WebInspector.RequestView.nonSourceViewForRequest(this.request); 161 return WebInspector.RequestView.nonSourceViewForRequest(this.request);
170 }, 162 },
171 163
172 __proto__: WebInspector.RequestContentView.prototype 164 __proto__: WebInspector.RequestContentView.prototype
173 } 165 }
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