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

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

Issue 1303073002: DevTools: Format JSON even if it has with trailing whitespace (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 4 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 // Return on blank payloads or on payloads significantly smaller than origin al text. 146 // Return on blank payloads or on payloads significantly smaller than origin al text.
147 if (inner.length === -1 || text.length - inner.length > 80) 147 if (inner.length === -1 || text.length - inner.length > 80)
148 return null; 148 return null;
149 149
150 var prefix = text.substring(0, inner.start); 150 var prefix = text.substring(0, inner.start);
151 var suffix = text.substring(inner.end + 1); 151 var suffix = text.substring(inner.end + 1);
152 text = text.substring(inner.start, inner.end + 1); 152 text = text.substring(inner.start, inner.end + 1);
153 153
154 // Only process valid JSONP. 154 // Only process valid JSONP.
155 if (suffix.length && !(suffix.trim().startsWith(")") && prefix.trim().endsWi th("("))) 155 if (suffix.trim().length && !(suffix.trim().startsWith(")") && prefix.trim() .endsWith("(")))
156 return null; 156 return null;
157 157
158 try { 158 try {
159 return new WebInspector.ParsedJSON(WebInspector.RequestJSONView._buildOb jectFromJSON(text), prefix, suffix); 159 return new WebInspector.ParsedJSON(WebInspector.RequestJSONView._buildOb jectFromJSON(text), prefix, suffix);
160 } catch (e) { 160 } catch (e) {
161 return null; 161 return null;
162 } 162 }
163 } 163 }
164 164
165 /** 165 /**
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 /** 204 /**
205 * @constructor 205 * @constructor
206 */ 206 */
207 WebInspector.ParsedJSON = function(data, prefix, suffix) 207 WebInspector.ParsedJSON = function(data, prefix, suffix)
208 { 208 {
209 this.data = data; 209 this.data = data;
210 this.prefix = prefix; 210 this.prefix = prefix;
211 this.suffix = suffix; 211 this.suffix = suffix;
212 } 212 }
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