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

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

Issue 2376583002: DevTools: remove WI.NetworkMapping.networkURL (Closed)
Patch Set: nit Created 4 years, 2 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 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @param {!WebInspector.TargetManager} targetManager 7 * @param {!WebInspector.TargetManager} targetManager
8 * @param {!WebInspector.Workspace} workspace 8 * @param {!WebInspector.Workspace} workspace
9 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding 9 * @param {!WebInspector.FileSystemWorkspaceBinding} fileSystemWorkspaceBinding
10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping 10 * @param {!WebInspector.FileSystemMapping} fileSystemMapping
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 /** 70 /**
71 * @param {!WebInspector.Event} event 71 * @param {!WebInspector.Event} event
72 */ 72 */
73 _fileSystemRemoved: function(event) 73 _fileSystemRemoved: function(event)
74 { 74 {
75 var fileSystem = /** @type {!WebInspector.IsolatedFileSystem} */ (event. data); 75 var fileSystem = /** @type {!WebInspector.IsolatedFileSystem} */ (event. data);
76 this._fileSystemMapping.removeFileSystem(fileSystem.path()); 76 this._fileSystemMapping.removeFileSystem(fileSystem.path());
77 }, 77 },
78 78
79 /** 79 /**
80 * @param {!WebInspector.UISourceCode} uiSourceCode
81 * @return {string}
82 */
83 networkURL: function(uiSourceCode)
84 {
85 if (uiSourceCode.project().type() === WebInspector.projectTypes.FileSyst em)
86 return "";
87 return uiSourceCode.url();
88 },
89
90 /**
91 * @param {!WebInspector.Target} target 80 * @param {!WebInspector.Target} target
92 * @param {?WebInspector.ResourceTreeFrame} frame 81 * @param {?WebInspector.ResourceTreeFrame} frame
93 * @param {string} url 82 * @param {string} url
94 * @return {?WebInspector.UISourceCode} 83 * @return {?WebInspector.UISourceCode}
95 */ 84 */
96 _networkUISourceCodeForURL: function(target, frame, url) 85 _networkUISourceCodeForURL: function(target, frame, url)
97 { 86 {
98 return this._workspace.uiSourceCode(WebInspector.NetworkProject.projectI d(target, frame, false), url); 87 return this._workspace.uiSourceCode(WebInspector.NetworkProject.projectI d(target, frame, false), url);
99 }, 88 },
100 89
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 { 139 {
151 return WebInspector.workspace.uiSourceCodeForURL(url); 140 return WebInspector.workspace.uiSourceCodeForURL(url);
152 }, 141 },
153 142
154 /** 143 /**
155 * @param {!WebInspector.UISourceCode} networkUISourceCode 144 * @param {!WebInspector.UISourceCode} networkUISourceCode
156 * @param {!WebInspector.UISourceCode} uiSourceCode 145 * @param {!WebInspector.UISourceCode} uiSourceCode
157 */ 146 */
158 addMapping: function(networkUISourceCode, uiSourceCode) 147 addMapping: function(networkUISourceCode, uiSourceCode)
159 { 148 {
160 var url = this.networkURL(networkUISourceCode);
161 var path = uiSourceCode.url();
162 var fileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSystemP ath(uiSourceCode.project().id()); 149 var fileSystemPath = WebInspector.FileSystemWorkspaceBinding.fileSystemP ath(uiSourceCode.project().id());
163 this._fileSystemMapping.addMappingForResource(url, fileSystemPath, path) ; 150 this._fileSystemMapping.addMappingForResource(networkUISourceCode.url(), fileSystemPath, uiSourceCode.url());
164 }, 151 },
165 152
166 /** 153 /**
167 * @param {!WebInspector.UISourceCode} uiSourceCode 154 * @param {!WebInspector.UISourceCode} uiSourceCode
168 */ 155 */
169 removeMapping: function(uiSourceCode) 156 removeMapping: function(uiSourceCode)
dgozman 2016/09/27 17:48:24 This could have been a file system one. Please dou
lushnikov 2016/09/28 18:36:02 Done. (@see SourcesPane.js:792)
170 { 157 {
171 var networkURL = this.networkURL(uiSourceCode); 158 this._fileSystemMapping.removeMappingForURL(uiSourceCode.url());
172 this._fileSystemMapping.removeMappingForURL(networkURL);
173 }, 159 },
174 160
175 /** 161 /**
176 * @param {!WebInspector.Event} event 162 * @param {!WebInspector.Event} event
177 */ 163 */
178 _revealSourceLine: function(event) 164 _revealSourceLine: function(event)
179 { 165 {
180 var url = /** @type {string} */ (event.data["url"]); 166 var url = /** @type {string} */ (event.data["url"]);
181 var lineNumber = /** @type {number} */ (event.data["lineNumber"]); 167 var lineNumber = /** @type {number} */ (event.data["lineNumber"]);
182 var columnNumber = /** @type {number} */ (event.data["columnNumber"]); 168 var columnNumber = /** @type {number} */ (event.data["columnNumber"]);
183 169
184 var uiSourceCode = this.uiSourceCodeForURLForAnyTarget(url); 170 var uiSourceCode = this.uiSourceCodeForURLForAnyTarget(url);
185 if (uiSourceCode) { 171 if (uiSourceCode) {
186 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, col umnNumber)); 172 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, col umnNumber));
187 return; 173 return;
188 } 174 }
189 175
190 /** 176 /**
191 * @param {!WebInspector.Event} event 177 * @param {!WebInspector.Event} event
192 * @this {WebInspector.NetworkMapping} 178 * @this {WebInspector.NetworkMapping}
193 */ 179 */
194 function listener(event) 180 function listener(event)
195 { 181 {
196 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event. data); 182 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event. data);
197 if (this.networkURL(uiSourceCode) === url) { 183 if (uiSourceCode.url() === url) {
198 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber)); 184 WebInspector.Revealer.reveal(uiSourceCode.uiLocation(lineNumber, columnNumber));
199 this._workspace.removeEventListener(WebInspector.Workspace.Event s.UISourceCodeAdded, listener, this); 185 this._workspace.removeEventListener(WebInspector.Workspace.Event s.UISourceCodeAdded, listener, this);
200 } 186 }
201 } 187 }
202 188
203 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this); 189 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceC odeAdded, listener, this);
204 }, 190 },
205 191
206 dispose: function() 192 dispose: function()
207 { 193 {
208 WebInspector.EventTarget.removeEventListeners(this._eventListeners); 194 WebInspector.EventTarget.removeEventListeners(this._eventListeners);
209 } 195 }
210 } 196 }
211 197
212 /** 198 /**
213 * @type {!WebInspector.NetworkMapping} 199 * @type {!WebInspector.NetworkMapping}
214 */ 200 */
215 WebInspector.networkMapping; 201 WebInspector.networkMapping;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698