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 23 matching lines...) Expand all Loading... |
34 */ | 34 */ |
35 WebInspector.resourceForURL = function(url) | 35 WebInspector.resourceForURL = function(url) |
36 { | 36 { |
37 var targets = WebInspector.targetManager.targets(WebInspector.Target.Capabil
ity.DOM); | 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 = WebInspector.ResourceTreeModel.fromTarget(targets[i]).res
ourceForURL(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(WebInspector.Target.Capabil
ity.DOM); | 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 WebInspector.ResourceTreeModel.fromTarget(targets[i]).forAllResources(ca
llback); | 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 ""; |
64 | 64 |
(...skipping 17 matching lines...) Expand all Loading... |
82 var baseURL = inspectedURL.substring(0, index); | 82 var baseURL = inspectedURL.substring(0, index); |
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 |