| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 if (!cssURLs) | 157 if (!cssURLs) |
| 158 return; | 158 return; |
| 159 if (!WebInspector.settings.cssReloadEnabled.get()) | 159 if (!WebInspector.settings.cssReloadEnabled.get()) |
| 160 return; | 160 return; |
| 161 | 161 |
| 162 var sassFile = this._networkMapping.uiSourceCodeForURL(sassURL); | 162 var sassFile = this._networkMapping.uiSourceCodeForURL(sassURL); |
| 163 console.assert(sassFile); | 163 console.assert(sassFile); |
| 164 if (wasLoadedFromFileSystem) | 164 if (wasLoadedFromFileSystem) |
| 165 sassFile.requestMetadata(metadataReceived.bind(this)); | 165 sassFile.requestMetadata(metadataReceived.bind(this)); |
| 166 else | 166 else |
| 167 this._target.networkAgent().loadResourceForFrontend(WebInspector.res
ourceTreeModel.mainFrame.id, sassURL, undefined, sassLoadedViaNetwork.bind(this)
); | 167 this._target.networkAgent().loadResourceForFrontend(this._target.res
ourceTreeModel.mainFrame.id, sassURL, undefined, sassLoadedViaNetwork.bind(this)
); |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * @param {?Protocol.Error} error | 170 * @param {?Protocol.Error} error |
| 171 * @param {number} statusCode | 171 * @param {number} statusCode |
| 172 * @param {!NetworkAgent.Headers} headers | 172 * @param {!NetworkAgent.Headers} headers |
| 173 * @param {string} content | 173 * @param {string} content |
| 174 * @this {WebInspector.SASSSourceMapping} | 174 * @this {WebInspector.SASSSourceMapping} |
| 175 */ | 175 */ |
| 176 function sassLoadedViaNetwork(error, statusCode, headers, content) | 176 function sassLoadedViaNetwork(error, statusCode, headers, content) |
| 177 { | 177 { |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 */ | 278 */ |
| 279 _reloadCSSFromNetwork: function(cssUISourceCode, sassURL, callback) | 279 _reloadCSSFromNetwork: function(cssUISourceCode, sassURL, callback) |
| 280 { | 280 { |
| 281 var cssURL = this._networkMapping.networkURL(cssUISourceCode); | 281 var cssURL = this._networkMapping.networkURL(cssUISourceCode); |
| 282 var data = this._pollDataForSASSURL[sassURL]; | 282 var data = this._pollDataForSASSURL[sassURL]; |
| 283 if (!data) { | 283 if (!data) { |
| 284 callback(cssURL, sassURL, true); | 284 callback(cssURL, sassURL, true); |
| 285 return; | 285 return; |
| 286 } | 286 } |
| 287 var headers = { "if-modified-since": new Date(data.sassTimestamp.getTime
() - 1000).toUTCString() }; | 287 var headers = { "if-modified-since": new Date(data.sassTimestamp.getTime
() - 1000).toUTCString() }; |
| 288 this._target.networkAgent().loadResourceForFrontend(WebInspector.resourc
eTreeModel.mainFrame.id, cssURL, headers, contentLoaded.bind(this)); | 288 this._target.networkAgent().loadResourceForFrontend(this._target.resourc
eTreeModel.mainFrame.id, cssURL, headers, contentLoaded.bind(this)); |
| 289 | 289 |
| 290 /** | 290 /** |
| 291 * @param {?Protocol.Error} error | 291 * @param {?Protocol.Error} error |
| 292 * @param {number} statusCode | 292 * @param {number} statusCode |
| 293 * @param {!NetworkAgent.Headers} headers | 293 * @param {!NetworkAgent.Headers} headers |
| 294 * @param {string} content | 294 * @param {string} content |
| 295 * @this {WebInspector.SASSSourceMapping} | 295 * @this {WebInspector.SASSSourceMapping} |
| 296 */ | 296 */ |
| 297 function contentLoaded(error, statusCode, headers, content) | 297 function contentLoaded(error, statusCode, headers, content) |
| 298 { | 298 { |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 this._cssURLsForSASSURL = {}; | 652 this._cssURLsForSASSURL = {}; |
| 653 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>}
*/ | 653 /** @type {!Object.<string, !Array.<function(?WebInspector.SourceMap)>>}
*/ |
| 654 this._pendingSourceMapLoadingCallbacks = {}; | 654 this._pendingSourceMapLoadingCallbacks = {}; |
| 655 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st
ring, !{timer: number, previousPoll: number}>}>} */ | 655 /** @type {!Object.<string, !{deadlineMs: number, dataByURL: !Object.<st
ring, !{timer: number, previousPoll: number}>}>} */ |
| 656 this._pollDataForSASSURL = {}; | 656 this._pollDataForSASSURL = {}; |
| 657 /** @type {!Object.<string, !WebInspector.SourceMap>} */ | 657 /** @type {!Object.<string, !WebInspector.SourceMap>} */ |
| 658 this._sourceMapByURL = {}; | 658 this._sourceMapByURL = {}; |
| 659 this._sourceMapByStyleSheetURL = {}; | 659 this._sourceMapByStyleSheetURL = {}; |
| 660 } | 660 } |
| 661 } | 661 } |
| OLD | NEW |