| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 */ | 155 */ |
| 156 WebInspector.NetworkProject.uiSourceCodeMimeType = function(uiSourceCode) | 156 WebInspector.NetworkProject.uiSourceCodeMimeType = function(uiSourceCode) |
| 157 { | 157 { |
| 158 if (uiSourceCode[WebInspector.NetworkProject._scriptSymbol] || | 158 if (uiSourceCode[WebInspector.NetworkProject._scriptSymbol] || |
| 159 uiSourceCode[WebInspector.NetworkProject._styleSheetSymbol]) { | 159 uiSourceCode[WebInspector.NetworkProject._styleSheetSymbol]) { |
| 160 return uiSourceCode.contentType().canonicalMimeType(); | 160 return uiSourceCode.contentType().canonicalMimeType(); |
| 161 } | 161 } |
| 162 var resource = uiSourceCode[WebInspector.NetworkProject._resourceSymbol]; | 162 var resource = uiSourceCode[WebInspector.NetworkProject._resourceSymbol]; |
| 163 if (resource) | 163 if (resource) |
| 164 return resource.mimeType; | 164 return resource.mimeType; |
| 165 var mimeType = WebInspector.ResourceType.mimeFromURL(uiSourceCode.originURL(
)); | 165 var mimeType = WebInspector.ResourceType.mimeFromURL(uiSourceCode.url()); |
| 166 return mimeType || uiSourceCode.contentType().canonicalMimeType(); | 166 return mimeType || uiSourceCode.contentType().canonicalMimeType(); |
| 167 } | 167 } |
| 168 | 168 |
| 169 /** | 169 /** |
| 170 * @param {!WebInspector.UISourceCode} uiSourceCode | 170 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 171 * @return {?WebInspector.ResourceTreeFrame} | 171 * @return {?WebInspector.ResourceTreeFrame} |
| 172 */ | 172 */ |
| 173 WebInspector.NetworkProject.uiSourceCodeFrame = function(uiSourceCode) | 173 WebInspector.NetworkProject.uiSourceCodeFrame = function(uiSourceCode) |
| 174 { | 174 { |
| 175 var target = uiSourceCode[WebInspector.NetworkProject._targetSymbol]; | 175 var target = uiSourceCode[WebInspector.NetworkProject._targetSymbol]; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 | 350 |
| 351 // Ignore non-images and non-fonts. | 351 // Ignore non-images and non-fonts. |
| 352 if (resourceType === WebInspector.resourceTypes.Image && resource.mimeTy
pe && !resource.mimeType.startsWith("image")) | 352 if (resourceType === WebInspector.resourceTypes.Image && resource.mimeTy
pe && !resource.mimeType.startsWith("image")) |
| 353 return; | 353 return; |
| 354 if (resourceType === WebInspector.resourceTypes.Font && resource.mimeTyp
e && !resource.mimeType.includes("font")) | 354 if (resourceType === WebInspector.resourceTypes.Font && resource.mimeTyp
e && !resource.mimeType.includes("font")) |
| 355 return; | 355 return; |
| 356 if ((resourceType === WebInspector.resourceTypes.Image || resourceType =
== WebInspector.resourceTypes.Font) && resource.contentURL().startsWith("data:")
) | 356 if ((resourceType === WebInspector.resourceTypes.Image || resourceType =
== WebInspector.resourceTypes.Font) && resource.contentURL().startsWith("data:")
) |
| 357 return; | 357 return; |
| 358 | 358 |
| 359 // Never load document twice. | 359 // Never load document twice. |
| 360 if (this._workspace.uiSourceCodeForOriginURL(resource.url)) | 360 if (this._workspace.uiSourceCodeForURL(resource.url)) |
| 361 return; | 361 return; |
| 362 | 362 |
| 363 var uiSourceCode = this._createFile(resource.url, resource, WebInspector
.ResourceTreeFrame.fromResource(resource), false, false); | 363 var uiSourceCode = this._createFile(resource.url, resource, WebInspector
.ResourceTreeFrame.fromResource(resource), false, false); |
| 364 if (uiSourceCode) { | 364 if (uiSourceCode) { |
| 365 uiSourceCode[WebInspector.NetworkProject._resourceSymbol] = resource
; | 365 uiSourceCode[WebInspector.NetworkProject._resourceSymbol] = resource
; |
| 366 this._addUISourceCodeWithProvider(uiSourceCode, resource); | 366 this._addUISourceCodeWithProvider(uiSourceCode, resource); |
| 367 } | 367 } |
| 368 }, | 368 }, |
| 369 | 369 |
| 370 /** | 370 /** |
| (...skipping 30 matching lines...) Expand all Loading... |
| 401 /** | 401 /** |
| 402 * @param {string} url | 402 * @param {string} url |
| 403 * @param {!WebInspector.ContentProvider} contentProvider | 403 * @param {!WebInspector.ContentProvider} contentProvider |
| 404 * @param {?WebInspector.ResourceTreeFrame} frame | 404 * @param {?WebInspector.ResourceTreeFrame} frame |
| 405 * @param {boolean} isContentScript | 405 * @param {boolean} isContentScript |
| 406 * @param {boolean} addIntoProject | 406 * @param {boolean} addIntoProject |
| 407 * @return {?WebInspector.UISourceCode} | 407 * @return {?WebInspector.UISourceCode} |
| 408 */ | 408 */ |
| 409 _createFile: function(url, contentProvider, frame, isContentScript, addIntoP
roject) | 409 _createFile: function(url, contentProvider, frame, isContentScript, addIntoP
roject) |
| 410 { | 410 { |
| 411 if (this._networkMapping.hasMappingForURL(url)) | 411 if (this._networkMapping.hasMappingForNetworkURL(url)) |
| 412 return null; | 412 return null; |
| 413 | 413 |
| 414 var project = this._workspaceProject(frame, isContentScript); | 414 var project = this._workspaceProject(frame, isContentScript); |
| 415 var uiSourceCode = project.createUISourceCode(url, contentProvider.conte
ntType()); | 415 var uiSourceCode = project.createUISourceCode(url, contentProvider.conte
ntType()); |
| 416 uiSourceCode[WebInspector.NetworkProject._targetSymbol] = this.target(); | 416 uiSourceCode[WebInspector.NetworkProject._targetSymbol] = this.target(); |
| 417 if (addIntoProject) | 417 if (addIntoProject) |
| 418 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider); | 418 project.addUISourceCodeWithProvider(uiSourceCode, contentProvider); |
| 419 return uiSourceCode; | 419 return uiSourceCode; |
| 420 }, | 420 }, |
| 421 | 421 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 440 | 440 |
| 441 _reset: function() | 441 _reset: function() |
| 442 { | 442 { |
| 443 for (var project of this._workspaceProjects.values()) | 443 for (var project of this._workspaceProjects.values()) |
| 444 project.reset(); | 444 project.reset(); |
| 445 this._workspaceProjects.clear(); | 445 this._workspaceProjects.clear(); |
| 446 }, | 446 }, |
| 447 | 447 |
| 448 __proto__: WebInspector.SDKObject.prototype | 448 __proto__: WebInspector.SDKObject.prototype |
| 449 } | 449 } |
| OLD | NEW |