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

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

Issue 94893003: Support for json media types as (non-image) mime types. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Test via synthetic NetworkRequest Created 7 years 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 | « Source/core/inspector/NetworkResourcesData.cpp ('k') | 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 _htmlView: function() 76 _htmlView: function()
77 { 77 {
78 var dataURL = this.request.asDataURL(); 78 var dataURL = this.request.asDataURL();
79 if (dataURL !== null) 79 if (dataURL !== null)
80 return new WebInspector.RequestHTMLView(this.request, dataURL); 80 return new WebInspector.RequestHTMLView(this.request, dataURL);
81 }, 81 },
82 82
83 _createPreviewView: function() 83 _createPreviewView: function()
84 { 84 {
85 if (this.request.content) { 85 if (this.request.content) {
86 if (this.request.mimeType === "application/json") { 86 var jsonMediaTypeRE = /^application\/[^;]*\+json/;
87 if (this.request.mimeType === "application/json" || jsonMediaTypeRE. test(this.request.mimeType)) {
87 var jsonView = this._jsonView(); 88 var jsonView = this._jsonView();
88 if (jsonView) 89 if (jsonView)
89 return jsonView; 90 return jsonView;
90 } 91 }
91 92
92 if (this.request.hasErrorStatusCode()) { 93 if (this.request.hasErrorStatusCode()) {
93 var htmlView = this._htmlView(); 94 var htmlView = this._htmlView();
94 if (htmlView) 95 if (htmlView)
95 return htmlView; 96 return htmlView;
96 } 97 }
(...skipping 15 matching lines...) Expand all
112 return this._responseView.sourceView; 113 return this._responseView.sourceView;
113 114
114 if (this.request.type === WebInspector.resourceTypes.Other) 115 if (this.request.type === WebInspector.resourceTypes.Other)
115 return this._createEmptyView(); 116 return this._createEmptyView();
116 117
117 return WebInspector.RequestView.nonSourceViewForRequest(this.request); 118 return WebInspector.RequestView.nonSourceViewForRequest(this.request);
118 }, 119 },
119 120
120 __proto__: WebInspector.RequestContentView.prototype 121 __proto__: WebInspector.RequestContentView.prototype
121 } 122 }
OLDNEW
« no previous file with comments | « Source/core/inspector/NetworkResourcesData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698