OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 * @param {string} content | 200 * @param {string} content |
201 */ | 201 */ |
202 function contentLoaded(statusCode, headers, content) | 202 function contentLoaded(statusCode, headers, content) |
203 { | 203 { |
204 if (!content || statusCode >= 400) { | 204 if (!content || statusCode >= 400) { |
205 callback(null); | 205 callback(null); |
206 return; | 206 return; |
207 } | 207 } |
208 | 208 |
209 if (content.slice(0, 3) === ")]}") | 209 if (content.slice(0, 3) === ")]}") |
210 content = content.substring(content.indexOf('\n')); | 210 content = content.substring(content.indexOf("\n")); |
211 try { | 211 try { |
212 var payload = /** @type {!SourceMapV3} */ (JSON.parse(content)); | 212 var payload = /** @type {!SourceMapV3} */ (JSON.parse(content)); |
213 var baseURL = sourceMapURL.startsWith("data:") ? compiledURL : sourc
eMapURL; | 213 var baseURL = sourceMapURL.startsWith("data:") ? compiledURL : sourc
eMapURL; |
214 | 214 |
215 callback(new WebInspector.TextSourceMap(compiledURL, baseURL, payloa
d)); | 215 callback(new WebInspector.TextSourceMap(compiledURL, baseURL, payloa
d)); |
216 } catch(e) { | 216 } catch (e) { |
217 console.error(e); | 217 console.error(e); |
218 WebInspector.console.error("Failed to parse SourceMap: " + sourceMap
URL); | 218 WebInspector.console.error("Failed to parse SourceMap: " + sourceMap
URL); |
219 callback(null); | 219 callback(null); |
220 } | 220 } |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 WebInspector.TextSourceMap.prototype = { | 224 WebInspector.TextSourceMap.prototype = { |
225 /** | 225 /** |
226 * @override | 226 * @override |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 }, | 567 }, |
568 | 568 |
569 /** | 569 /** |
570 * @return {boolean} | 570 * @return {boolean} |
571 */ | 571 */ |
572 hasNext: function() | 572 hasNext: function() |
573 { | 573 { |
574 return this._position < this._string.length; | 574 return this._position < this._string.length; |
575 } | 575 } |
576 } | 576 } |
OLD | NEW |