* @param {?Protocol.Error} error * @param {number} statusCode * @param {NetworkAgent.Headers} headers * @param {string} content
(error, statusCode, headers, content)
| 105 | * @param {string} content |
| 106 | */ |
| 107 | function contentLoaded(error, statusCode, headers, content) |
| 108 | { |
| 109 | if (error || !content || statusCode >= 400) { |
| 110 | console.error(`Could not load content for ${sourceMapURL} : ${error || (`HTTP status code: ${statusCode}`)}`); |
| 111 | callback(null); |
| 112 | return; |
| 113 | } |
| 114 | |
| 115 | if (content.slice(0, 3) === ")]}") |
| 116 | content = content.substring(content.indexOf('\n')); |
| 117 | try { |
| 118 | const payload = /** @type {SourceMapV3} */ (JSON.parse(content)); |
| 119 | const baseURL = sourceMapURL.startsWith("data:") ? compiledURL : sourceMapURL; |
| 120 | callback(new WebInspector.SourceMap(baseURL, payload)); |
| 121 | } catch(e) { |
| 122 | console.error(e.message); |
| 123 | callback(null); |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | WebInspector.SourceMap.prototype = { |