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

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

Issue 1147093007: Devtools[ResourceScriptMapping]: Ignore uiSourceCodes originated by other target's network project (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase test Created 5 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 * @constructor 110 * @constructor
111 * @param {!WebInspector.TargetManager} targetManager 111 * @param {!WebInspector.TargetManager} targetManager
112 * @param {!WebInspector.Workspace} workspace 112 * @param {!WebInspector.Workspace} workspace
113 * @param {!WebInspector.NetworkMapping} networkMapping 113 * @param {!WebInspector.NetworkMapping} networkMapping
114 * @implements {WebInspector.TargetManager.Observer} 114 * @implements {WebInspector.TargetManager.Observer}
115 */ 115 */
116 WebInspector.NetworkProjectManager = function(targetManager, workspace, networkM apping) 116 WebInspector.NetworkProjectManager = function(targetManager, workspace, networkM apping)
117 { 117 {
118 this._workspace = workspace; 118 this._workspace = workspace;
119 this._networkMapping = networkMapping; 119 this._networkMapping = networkMapping;
120 this._projectSymbol = Symbol("networkProject");
121 targetManager.observeTargets(this); 120 targetManager.observeTargets(this);
122 } 121 }
123 122
124 WebInspector.NetworkProjectManager.prototype = { 123 WebInspector.NetworkProjectManager.prototype = {
125 /** 124 /**
126 * @override 125 * @override
127 * @param {!WebInspector.Target} target 126 * @param {!WebInspector.Target} target
128 */ 127 */
129 targetAdded: function(target) 128 targetAdded: function(target)
130 { 129 {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedT oParseScriptSource, this._parsedScriptSource, this); 165 debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.FailedT oParseScriptSource, this._parsedScriptSource, this);
167 } 166 }
168 var cssModel = WebInspector.CSSStyleModel.fromTarget(target); 167 var cssModel = WebInspector.CSSStyleModel.fromTarget(target);
169 if (cssModel) { 168 if (cssModel) {
170 cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAd ded, this._styleSheetAdded, this); 169 cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetAd ded, this._styleSheetAdded, this);
171 cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRe moved, this._styleSheetRemoved, this); 170 cssModel.addEventListener(WebInspector.CSSStyleModel.Events.StyleSheetRe moved, this._styleSheetRemoved, this);
172 } 171 }
173 } 172 }
174 173
175 WebInspector.NetworkProject._networkProjectSymbol = Symbol("networkProject"); 174 WebInspector.NetworkProject._networkProjectSymbol = Symbol("networkProject");
176 WebInspector.NetworkProject._targetSymbol = Symbol("target");
177 WebInspector.NetworkProject._contentTypeSymbol = Symbol("networkContentType"); 175 WebInspector.NetworkProject._contentTypeSymbol = Symbol("networkContentType");
178 176
179 /** 177 /**
180 * @param {!WebInspector.Target} target 178 * @param {!WebInspector.Target} target
181 * @param {string} projectURL 179 * @param {string} projectURL
182 * @param {boolean} isContentScripts 180 * @param {boolean} isContentScripts
183 * @return {string} 181 * @return {string}
184 */ 182 */
185 WebInspector.NetworkProject.projectId = function(target, projectURL, isContentSc ripts) 183 WebInspector.NetworkProject.projectId = function(target, projectURL, isContentSc ripts)
186 { 184 {
187 return target.id() + ":" + (isContentScripts ? "contentscripts:" : "") + pro jectURL; 185 return target.id() + ":" + (isContentScripts ? "contentscripts:" : "") + pro jectURL;
188 } 186 }
189 187
190 /** 188 /**
191 * @param {!WebInspector.Target} target 189 * @param {!WebInspector.Target} target
192 * @return {!WebInspector.NetworkProject} 190 * @return {!WebInspector.NetworkProject}
193 */ 191 */
194 WebInspector.NetworkProject.forTarget = function(target) 192 WebInspector.NetworkProject.forTarget = function(target)
195 { 193 {
196 return target[WebInspector.NetworkProject._networkProjectSymbol]; 194 return target[WebInspector.NetworkProject._networkProjectSymbol];
197 } 195 }
198 196
199 /** 197 /**
200 * @param {!WebInspector.UISourceCode} uiSourceCode 198 * @param {!WebInspector.UISourceCode} uiSourceCode
201 * @return {?WebInspector.Target} target 199 * @return {?WebInspector.Target} target
202 */ 200 */
203 WebInspector.NetworkProject.targetForUISourceCode = function(uiSourceCode) 201 WebInspector.NetworkProject.targetForUISourceCode = function(uiSourceCode)
204 { 202 {
205 return uiSourceCode[WebInspector.NetworkProject._targetSymbol]; 203 if (uiSourceCode.project().type() !== WebInspector.projectTypes.ContentScrip ts && uiSourceCode.project().type() !== WebInspector.projectTypes.Network)
204 return null;
205
206 var projectId = uiSourceCode.project().id();
pfeldman 2015/05/26 13:03:33 extract WebInspector.NetworkProject.targetForProje
sergeyv 2015/05/26 13:53:17 Done.
207 var targetId = parseInt(projectId.substring(0, projectId.indexOf(":")), 10);
pfeldman 2015/05/26 13:03:33 no need to substring.
sergeyv 2015/05/26 13:53:17 Done.
208 return WebInspector.targetManager.targetById(targetId);
206 } 209 }
207 210
208 /** 211 /**
209 * @param {!WebInspector.UISourceCode} uiSourceCode 212 * @param {!WebInspector.UISourceCode} uiSourceCode
210 * @return {(!WebInspector.ResourceType|undefined)} 213 * @return {(!WebInspector.ResourceType|undefined)}
211 */ 214 */
212 WebInspector.NetworkProject.uiSourceCodeContentType = function(uiSourceCode) 215 WebInspector.NetworkProject.uiSourceCodeContentType = function(uiSourceCode)
213 { 216 {
214 return uiSourceCode[WebInspector.NetworkProject._contentTypeSymbol]; 217 return uiSourceCode[WebInspector.NetworkProject._contentTypeSymbol];
215 } 218 }
(...skipping 24 matching lines...) Expand all
240 */ 243 */
241 addFileForURL: function(url, contentProvider, isContentScript) 244 addFileForURL: function(url, contentProvider, isContentScript)
242 { 245 {
243 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); 246 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
244 var projectURL = splitURL[0]; 247 var projectURL = splitURL[0];
245 var parentPath = splitURL.slice(1, -1).join("/"); 248 var parentPath = splitURL.slice(1, -1).join("/");
246 var name = splitURL.peekLast() || ""; 249 var name = splitURL.peekLast() || "";
247 var projectDelegate = this._projectDelegate(projectURL, isContentScript || false); 250 var projectDelegate = this._projectDelegate(projectURL, isContentScript || false);
248 var path = projectDelegate.addFile(parentPath, name, url, contentProvide r); 251 var path = projectDelegate.addFile(parentPath, name, url, contentProvide r);
249 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._work space.uiSourceCode(projectDelegate.id(), path)); 252 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._work space.uiSourceCode(projectDelegate.id(), path));
250 uiSourceCode[WebInspector.NetworkProject._targetSymbol] = this.target();
251 console.assert(uiSourceCode); 253 console.assert(uiSourceCode);
252 return uiSourceCode; 254 return uiSourceCode;
253 }, 255 },
254 256
255 /** 257 /**
256 * @param {string} url 258 * @param {string} url
257 */ 259 */
258 _removeFileForURL: function(url) 260 _removeFileForURL: function(url)
259 { 261 {
260 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url); 262 var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 509 }
508 510
509 if (this.contentType() === WebInspector.resourceTypes.Document) { 511 if (this.contentType() === WebInspector.resourceTypes.Document) {
510 this.requestContent(documentContentLoaded); 512 this.requestContent(documentContentLoaded);
511 return; 513 return;
512 } 514 }
513 515
514 this._resource.searchInContent(query, caseSensitive, isRegex, callback); 516 this._resource.searchInContent(query, caseSensitive, isRegex, callback);
515 } 517 }
516 } 518 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698