| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 this._styleFiles.clear(); | 156 this._styleFiles.clear(); |
| 157 this._urlToHeadersByFrameId = new Map(); | 157 this._urlToHeadersByFrameId = new Map(); |
| 158 }, | 158 }, |
| 159 | 159 |
| 160 /** | 160 /** |
| 161 * @param {!WebInspector.Event} event | 161 * @param {!WebInspector.Event} event |
| 162 */ | 162 */ |
| 163 _uiSourceCodeAddedToWorkspace: function(event) | 163 _uiSourceCodeAddedToWorkspace: function(event) |
| 164 { | 164 { |
| 165 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); | 165 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); |
| 166 var networkURL = this._networkMapping.networkURL(uiSourceCode); | 166 if (!this._urlToHeadersByFrameId.has(uiSourceCode.url())) |
| 167 if (!networkURL || !this._urlToHeadersByFrameId.has(networkURL)) | |
| 168 return; | 167 return; |
| 169 this._bindUISourceCode(uiSourceCode, this._urlToHeadersByFrameId.get(net
workURL).valuesArray()[0].valuesArray()[0]); | 168 this._bindUISourceCode(uiSourceCode, this._urlToHeadersByFrameId.get(uiS
ourceCode.url()).valuesArray()[0].valuesArray()[0]); |
| 170 }, | 169 }, |
| 171 | 170 |
| 172 /** | 171 /** |
| 173 * @param {!WebInspector.UISourceCode} uiSourceCode | 172 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 174 * @param {!WebInspector.CSSStyleSheetHeader} header | 173 * @param {!WebInspector.CSSStyleSheetHeader} header |
| 175 */ | 174 */ |
| 176 _bindUISourceCode: function(uiSourceCode, header) | 175 _bindUISourceCode: function(uiSourceCode, header) |
| 177 { | 176 { |
| 178 if (this._styleFiles.get(uiSourceCode) || (header.isInline && !header.ha
sSourceURL)) | 177 if (this._styleFiles.get(uiSourceCode) || (header.isInline && !header.ha
sSourceURL)) |
| 179 return; | 178 return; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 202 }, | 201 }, |
| 203 | 202 |
| 204 /** | 203 /** |
| 205 * @param {!WebInspector.UISourceCode} uiSourceCode | 204 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 206 * @param {string} content | 205 * @param {string} content |
| 207 * @param {boolean} majorChange | 206 * @param {boolean} majorChange |
| 208 * @return {!Promise<?string>} | 207 * @return {!Promise<?string>} |
| 209 */ | 208 */ |
| 210 _setStyleContent: function(uiSourceCode, content, majorChange) | 209 _setStyleContent: function(uiSourceCode, content, majorChange) |
| 211 { | 210 { |
| 212 var networkURL = this._networkMapping.networkURL(uiSourceCode); | 211 var styleSheetIds = this._cssModel.styleSheetIdsForURL(uiSourceCode.url(
)); |
| 213 var styleSheetIds = this._cssModel.styleSheetIdsForURL(networkURL); | |
| 214 if (!styleSheetIds.length) | 212 if (!styleSheetIds.length) |
| 215 return Promise.resolve(/** @type {?string} */("No stylesheet found:
" + networkURL)); | 213 return Promise.resolve(/** @type {?string} */("No stylesheet found:
" + uiSourceCode.url())); |
| 216 | 214 |
| 217 this._isSettingContent = true; | 215 this._isSettingContent = true; |
| 218 | 216 |
| 219 /** | 217 /** |
| 220 * @param {?string} error | 218 * @param {?string} error |
| 221 * @this {WebInspector.StylesSourceMapping} | 219 * @this {WebInspector.StylesSourceMapping} |
| 222 * @return {?string} | 220 * @return {?string} |
| 223 */ | 221 */ |
| 224 function callback(error) | 222 function callback(error) |
| 225 { | 223 { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 }, | 367 }, |
| 370 | 368 |
| 371 dispose: function() | 369 dispose: function() |
| 372 { | 370 { |
| 373 if (this._terminated) | 371 if (this._terminated) |
| 374 return; | 372 return; |
| 375 this._terminated = true; | 373 this._terminated = true; |
| 376 WebInspector.EventTarget.removeEventListeners(this._eventListeners); | 374 WebInspector.EventTarget.removeEventListeners(this._eventListeners); |
| 377 } | 375 } |
| 378 } | 376 } |
| OLD | NEW |