Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 95 * @return {string} | 95 * @return {string} |
| 96 */ | 96 */ |
| 97 _requestContent: function() | 97 _requestContent: function() |
| 98 { | 98 { |
| 99 var content = this.request.content; | 99 var content = this.request.content; |
| 100 return this.request.contentEncoded ? window.atob(content || "") : (conte nt || ""); | 100 return this.request.contentEncoded ? window.atob(content || "") : (conte nt || ""); |
| 101 }, | 101 }, |
| 102 | 102 |
| 103 /** | 103 /** |
| 104 * @param {?WebInspector.ParsedJSON} parsedJSON | 104 * @param {?WebInspector.ParsedJSON} parsedJSON |
| 105 * @return {?WebInspector.JSONView} | 105 * @return {?WebInspector.SearchableView} |
| 106 */ | 106 */ |
| 107 _jsonView: function(parsedJSON) | 107 _jsonView: function(parsedJSON) |
| 108 { | 108 { |
| 109 if (!parsedJSON || typeof parsedJSON.data !== "object") | 109 if (!parsedJSON || typeof parsedJSON.data !== "object") |
| 110 return null; | 110 return null; |
| 111 return new WebInspector.JSONView(/** @type {!WebInspector.ParsedJSON} */ (parsedJSON)); | 111 return WebInspector.JSONView.createSearchableView(/** @type {!WebInspect or.ParsedJSON} */ (parsedJSON)); |
| 112 }, | 112 }, |
| 113 | 113 |
| 114 /** | 114 /** |
| 115 * @return {?WebInspector.XMLView} | 115 * @return {?WebInspector.XMLView} |
| 116 */ | 116 */ |
| 117 _xmlView: function() | 117 _xmlView: function() |
| 118 { | 118 { |
| 119 var content = this._requestContent(); | 119 var content = this._requestContent(); |
| 120 var parsedXML = WebInspector.XMLView.parseXML(content, this.request.mime Type); | 120 var parsedXML = WebInspector.XMLView.parseXML(content, this.request.mime Type); |
| 121 return parsedXML ? new WebInspector.XMLView(parsedXML) : null; | 121 return parsedXML ? new WebInspector.XMLView(parsedXML) : null; |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 141 * @param {function(!WebInspector.Widget)} callback | 141 * @param {function(!WebInspector.Widget)} callback |
| 142 */ | 142 */ |
| 143 _createPreviewView: function(callback) | 143 _createPreviewView: function(callback) |
| 144 { | 144 { |
| 145 if (this.request.contentError()) { | 145 if (this.request.contentError()) { |
| 146 callback(this._createMessageView(WebInspector.UIString("Failed to lo ad response data"))); | 146 callback(this._createMessageView(WebInspector.UIString("Failed to lo ad response data"))); |
| 147 return; | 147 return; |
| 148 } | 148 } |
| 149 | 149 |
| 150 var xmlView = this._xmlView(); | 150 var xmlView = this._xmlView(); |
| 151 if (xmlView) | 151 if (xmlView) { |
| 152 return xmlView; | 152 callback(xmlView); |
|
lushnikov
2016/04/26 19:22:03
looks like a fix for a regression! Let's land this
allada
2016/04/27 21:19:57
Done.
| |
| 153 return; | |
| 154 } | |
| 153 | 155 |
| 154 WebInspector.JSONView.parseJSON(this._requestContent()).then(chooseView. bind(this)).then(callback); | 156 WebInspector.JSONView.parseJSON(this._requestContent()).then(chooseView. bind(this)).then(callback); |
| 155 | 157 |
| 156 /** | 158 /** |
| 157 * @this {WebInspector.RequestPreviewView} | 159 * @this {WebInspector.RequestPreviewView} |
| 158 * @param {?WebInspector.ParsedJSON} jsonData | 160 * @param {?WebInspector.ParsedJSON} jsonData |
| 159 * @return {!WebInspector.Widget} | 161 * @return {!WebInspector.Widget} |
| 160 */ | 162 */ |
| 161 function chooseView(jsonData) | 163 function chooseView(jsonData) |
| 162 { | 164 { |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 177 | 179 |
| 178 if (this.request.resourceType() === WebInspector.resourceTypes.Other ) | 180 if (this.request.resourceType() === WebInspector.resourceTypes.Other ) |
| 179 return this._createEmptyWidget(); | 181 return this._createEmptyWidget(); |
| 180 | 182 |
| 181 return WebInspector.RequestView.nonSourceViewForRequest(this.request ); | 183 return WebInspector.RequestView.nonSourceViewForRequest(this.request ); |
| 182 } | 184 } |
| 183 }, | 185 }, |
| 184 | 186 |
| 185 __proto__: WebInspector.RequestContentView.prototype | 187 __proto__: WebInspector.RequestContentView.prototype |
| 186 } | 188 } |
| OLD | NEW |