| 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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 * @return {string|undefined} | 102 * @return {string|undefined} |
| 103 */ | 103 */ |
| 104 sourceContent: function(sourceURL) | 104 sourceContent: function(sourceURL) |
| 105 { | 105 { |
| 106 return this._sourceContentByURL[sourceURL]; | 106 return this._sourceContentByURL[sourceURL]; |
| 107 }, | 107 }, |
| 108 | 108 |
| 109 /** | 109 /** |
| 110 * @param {string} sourceURL | 110 * @param {string} sourceURL |
| 111 * @param {WebInspector.ResourceType} contentType | 111 * @param {WebInspector.ResourceType} contentType |
| 112 * @param {string=} mimeType | |
| 113 * @return {WebInspector.ContentProvider} | 112 * @return {WebInspector.ContentProvider} |
| 114 */ | 113 */ |
| 115 sourceContentProvider: function(sourceURL, contentType, mimeType) | 114 sourceContentProvider: function(sourceURL, contentType) |
| 116 { | 115 { |
| 117 // FIXME: We should detect mime type automatically (e.g. based on file e
xtension) | 116 var lastIndexOfDot = sourceURL.lastIndexOf("."); |
| 117 var extension = lastIndexOfDot !== -1 ? sourceURL.substr(lastIndexOfDot
+ 1) : ""; |
| 118 var mimeType = WebInspector.ResourceType.mimeTypesForExtensions[extensio
n.toLowerCase()]; |
| 118 var sourceContent = this.sourceContent(sourceURL); | 119 var sourceContent = this.sourceContent(sourceURL); |
| 119 var contentProvider; | |
| 120 if (sourceContent) | 120 if (sourceContent) |
| 121 return new WebInspector.StaticContentProvider(contentType, sourceCon
tent); | 121 return new WebInspector.StaticContentProvider(contentType, sourceCon
tent, mimeType); |
| 122 return new WebInspector.CompilerSourceMappingContentProvider(sourceURL,
contentType, mimeType); | 122 return new WebInspector.CompilerSourceMappingContentProvider(sourceURL,
contentType, mimeType); |
| 123 }, | 123 }, |
| 124 | 124 |
| 125 /** | 125 /** |
| 126 * @param {SourceMapV3} mappingPayload | 126 * @param {SourceMapV3} mappingPayload |
| 127 */ | 127 */ |
| 128 _parseMappingPayload: function(mappingPayload) | 128 _parseMappingPayload: function(mappingPayload) |
| 129 { | 129 { |
| 130 if (mappingPayload.sections) | 130 if (mappingPayload.sections) |
| 131 this._parseSections(mappingPayload.sections); | 131 this._parseSections(mappingPayload.sections); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 }, | 325 }, |
| 326 | 326 |
| 327 /** | 327 /** |
| 328 * @return {boolean} | 328 * @return {boolean} |
| 329 */ | 329 */ |
| 330 hasNext: function() | 330 hasNext: function() |
| 331 { | 331 { |
| 332 return this._position < this._string.length; | 332 return this._position < this._string.length; |
| 333 } | 333 } |
| 334 } | 334 } |
| OLD | NEW |