Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: Source/devtools/front_end/bindings/ResourceUtils.js

Issue 485713002: DevTools: Use targetManager.inspectedPageUrl() instead of resourceTreeModel.inspectedPageUrl() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addrss comments Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 return ""; 55 return "";
56 56
57 var resource = WebInspector.resourceForURL(url); 57 var resource = WebInspector.resourceForURL(url);
58 if (resource) 58 if (resource)
59 return resource.displayName; 59 return resource.displayName;
60 60
61 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url); 61 var uiSourceCode = WebInspector.workspace.uiSourceCodeForURL(url);
62 if (uiSourceCode) 62 if (uiSourceCode)
63 return uiSourceCode.displayName(); 63 return uiSourceCode.displayName();
64 64
65 if (!WebInspector.resourceTreeModel.inspectedPageURL()) 65 if (!WebInspector.targetManager.inspectedPageURL())
66 return url.trimURL(""); 66 return url.trimURL("");
67 67
68 var parsedURL = WebInspector.resourceTreeModel.inspectedPageURL().asParsedUR L(); 68 var parsedURL = WebInspector.targetManager.inspectedPageURL().asParsedURL();
69 var lastPathComponent = parsedURL ? parsedURL.lastPathComponent : parsedURL; 69 var lastPathComponent = parsedURL ? parsedURL.lastPathComponent : parsedURL;
70 var index = WebInspector.resourceTreeModel.inspectedPageURL().indexOf(lastPa thComponent); 70 var index = WebInspector.targetManager.inspectedPageURL().indexOf(lastPathCo mponent);
71 if (index !== -1 && index + lastPathComponent.length === WebInspector.resour ceTreeModel.inspectedPageURL().length) { 71 if (index !== -1 && index + lastPathComponent.length === WebInspector.target Manager.inspectedPageURL().length) {
72 var baseURL = WebInspector.resourceTreeModel.inspectedPageURL().substrin g(0, index); 72 var baseURL = WebInspector.targetManager.inspectedPageURL().substring(0, index);
73 if (url.startsWith(baseURL)) 73 if (url.startsWith(baseURL))
74 return url.substring(index); 74 return url.substring(index);
75 } 75 }
76 76
77 if (!parsedURL) 77 if (!parsedURL)
78 return url; 78 return url;
79 79
80 var displayName = url.trimURL(parsedURL.host); 80 var displayName = url.trimURL(parsedURL.host);
81 return displayName === "/" ? parsedURL.host + "/" : displayName; 81 return displayName === "/" ? parsedURL.host + "/" : displayName;
82 } 82 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 /** 220 /**
221 * @param {!WebInspector.NetworkRequest} request 221 * @param {!WebInspector.NetworkRequest} request
222 * @return {!Element} 222 * @return {!Element}
223 */ 223 */
224 WebInspector.linkifyRequestAsNode = function(request) 224 WebInspector.linkifyRequestAsNode = function(request)
225 { 225 {
226 var anchor = WebInspector.linkifyURLAsNode(request.url); 226 var anchor = WebInspector.linkifyURLAsNode(request.url);
227 anchor.requestId = request.requestId; 227 anchor.requestId = request.requestId;
228 return anchor; 228 return anchor;
229 } 229 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698