| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). | 3 * Copyright (C) 2007 Matt Lilek (pewtermoose@gmail.com). |
| 4 * Copyright (C) 2009 Joseph Pecoraro | 4 * Copyright (C) 2009 Joseph Pecoraro |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * | 9 * |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @param {string} url | 32 * @param {string} url |
| 33 * @return {?WebInspector.Resource} | 33 * @return {?WebInspector.Resource} |
| 34 */ | 34 */ |
| 35 WebInspector.resourceForURL = function(url) | 35 WebInspector.resourceForURL = function(url) |
| 36 { | 36 { |
| 37 var targets = WebInspector.targetManager.targets(); | 37 var targets = WebInspector.targetManager.targets(WebInspector.Target.Capabil
ity.DOM); |
| 38 for (var i = 0; i < targets.length; ++i) { | 38 for (var i = 0; i < targets.length; ++i) { |
| 39 var resource = targets[i].resourceTreeModel.resourceForURL(url); | 39 var resource = WebInspector.ResourceTreeModel.fromTarget(targets[i]).res
ourceForURL(url); |
| 40 if (resource) | 40 if (resource) |
| 41 return resource; | 41 return resource; |
| 42 } | 42 } |
| 43 return null; | 43 return null; |
| 44 } | 44 } |
| 45 | 45 |
| 46 /** | 46 /** |
| 47 * @param {function(!WebInspector.Resource)} callback | 47 * @param {function(!WebInspector.Resource)} callback |
| 48 */ | 48 */ |
| 49 WebInspector.forAllResources = function(callback) | 49 WebInspector.forAllResources = function(callback) |
| 50 { | 50 { |
| 51 var targets = WebInspector.targetManager.targets(); | 51 var targets = WebInspector.targetManager.targets(WebInspector.Target.Capabil
ity.DOM); |
| 52 for (var i = 0; i < targets.length; ++i) | 52 for (var i = 0; i < targets.length; ++i) |
| 53 targets[i].resourceTreeModel.forAllResources(callback); | 53 WebInspector.ResourceTreeModel.fromTarget(targets[i]).forAllResources(ca
llback); |
| 54 } | 54 } |
| 55 | 55 |
| 56 /** | 56 /** |
| 57 * @param {string} url | 57 * @param {string} url |
| 58 * @return {string} | 58 * @return {string} |
| 59 */ | 59 */ |
| 60 WebInspector.displayNameForURL = function(url) | 60 WebInspector.displayNameForURL = function(url) |
| 61 { | 61 { |
| 62 if (!url) | 62 if (!url) |
| 63 return ""; | 63 return ""; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 83 if (url.startsWith(baseURL)) | 83 if (url.startsWith(baseURL)) |
| 84 return url.substring(index); | 84 return url.substring(index); |
| 85 } | 85 } |
| 86 | 86 |
| 87 if (!parsedURL) | 87 if (!parsedURL) |
| 88 return url; | 88 return url; |
| 89 | 89 |
| 90 var displayName = url.trimURL(parsedURL.host); | 90 var displayName = url.trimURL(parsedURL.host); |
| 91 return displayName === "/" ? parsedURL.host + "/" : displayName; | 91 return displayName === "/" ? parsedURL.host + "/" : displayName; |
| 92 } | 92 } |
| OLD | NEW |