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

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

Issue 2893523002: DevTools: make StyleSourceMapping in charge of managing UISourceCodes (Closed)
Patch Set: update test Created 3 years, 7 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
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 79 }
80 80
81 if (!parsedURL) 81 if (!parsedURL)
82 return url; 82 return url;
83 83
84 var displayName = url.trimURL(parsedURL.host); 84 var displayName = url.trimURL(parsedURL.host);
85 return displayName === '/' ? parsedURL.host + '/' : displayName; 85 return displayName === '/' ? parsedURL.host + '/' : displayName;
86 }; 86 };
87 87
88 /** 88 /**
89 * @param {!SDK.Target} target
90 * @param {string} frameId
91 * @param {string} url
92 * @return {?Workspace.UISourceCodeMetadata}
93 */
94 Bindings.metadataForURL = function(target, frameId, url) {
dgozman 2017/05/17 16:46:20 resourceMetadataForURL?
95 var resourceTreeModel = target.model(SDK.ResourceTreeModel);
96 if (!resourceTreeModel)
97 return null;
98 var frame = resourceTreeModel.frameForId(frameId);
99 if (!frame)
100 return null;
101 return Bindings.resourceMetadata(frame.resourceForURL(url));
102 };
103
104 /**
89 * @param {?SDK.Resource} resource 105 * @param {?SDK.Resource} resource
90 * @return {?Workspace.UISourceCodeMetadata} 106 * @return {?Workspace.UISourceCodeMetadata}
91 */ 107 */
92 Bindings.resourceMetadata = function(resource) { 108 Bindings.resourceMetadata = function(resource) {
93 if (!resource || (typeof resource.contentSize() !== 'number' && !resource.last Modified())) 109 if (!resource || (typeof resource.contentSize() !== 'number' && !resource.last Modified()))
94 return null; 110 return null;
95 return new Workspace.UISourceCodeMetadata(resource.lastModified(), resource.co ntentSize()); 111 return new Workspace.UISourceCodeMetadata(resource.lastModified(), resource.co ntentSize());
96 }; 112 };
97 113
98 /** 114 /**
99 * @param {!SDK.Script} script 115 * @param {!SDK.Script} script
100 * @return {string} 116 * @return {string}
101 */ 117 */
102 Bindings.frameIdForScript = function(script) { 118 Bindings.frameIdForScript = function(script) {
103 var executionContext = script.executionContext(); 119 var executionContext = script.executionContext();
104 if (executionContext) 120 if (executionContext)
105 return executionContext.frameId || ''; 121 return executionContext.frameId || '';
106 // This is to overcome compilation cache which doesn't get reset. 122 // This is to overcome compilation cache which doesn't get reset.
107 var resourceTreeModel = script.debuggerModel.target().model(SDK.ResourceTreeMo del); 123 var resourceTreeModel = script.debuggerModel.target().model(SDK.ResourceTreeMo del);
108 if (!resourceTreeModel || !resourceTreeModel.mainFrame) 124 if (!resourceTreeModel || !resourceTreeModel.mainFrame)
109 return ''; 125 return '';
110 return resourceTreeModel.mainFrame.id; 126 return resourceTreeModel.mainFrame.id;
111 }; 127 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698