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

Unified Diff: third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js

Issue 1523193002: DevTools: merge UISourceCode's parentPath, name, originURL and uri. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
index e5097a9706f4dec6a9b0f7da408debbbd683c599..bdadecd32d452062bb4d0f28bd3c69282c90abf5 100644
--- a/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/NetworkProject.js
@@ -102,13 +102,12 @@ WebInspector.NetworkProject._targetSymbol = Symbol("target");
/**
* @param {!WebInspector.Target} target
- * @param {string} projectURL
* @param {boolean} isContentScripts
* @return {string}
*/
-WebInspector.NetworkProject.projectId = function(target, projectURL, isContentScripts)
+WebInspector.NetworkProject.projectId = function(target, isContentScripts)
{
- return target.id() + ":" + (isContentScripts ? "contentscripts:" : "") + projectURL;
+ return target.id() + ":" + (isContentScripts ? "contentscripts:" : "");
}
/**
@@ -121,6 +120,15 @@ WebInspector.NetworkProject.forTarget = function(target)
}
/**
+ * @param {!WebInspector.Project} project
+ * @return {?WebInspector.Target} target
+ */
+WebInspector.NetworkProject.targetForProject = function(project)
+{
+ return project[WebInspector.NetworkProject._targetSymbol] || null;
+}
+
+/**
* @param {!WebInspector.UISourceCode} uiSourceCode
* @return {?WebInspector.Target} target
*/
@@ -182,45 +190,26 @@ WebInspector.NetworkProject.uiSourceCodeFrame = function(uiSourceCode)
WebInspector.NetworkProject.prototype = {
/**
- * @param {string} projectURL
* @param {boolean} isContentScripts
* @return {!WebInspector.ContentProviderBasedProject}
*/
- _workspaceProject: function(projectURL, isContentScripts)
+ _workspaceProject: function(isContentScripts)
{
- var projectId = WebInspector.NetworkProject.projectId(this.target(), projectURL, isContentScripts);
+ var projectId = WebInspector.NetworkProject.projectId(this.target(), isContentScripts);
var projectType = isContentScripts ? WebInspector.projectTypes.ContentScripts : WebInspector.projectTypes.Network;
var project = this._workspaceProjects.get(projectId);
if (project)
return project;
- project = new WebInspector.ContentProviderBasedProject(this._workspace, projectId, projectType, projectURL, this._computeDisplayName(projectURL));
+ project = new WebInspector.ContentProviderBasedProject(this._workspace, projectId, projectType, "");
+ project[WebInspector.NetworkProject._targetSymbol] = this.target();
this._workspaceProjects.set(projectId, project);
return project;
},
/**
* @param {string} url
- * @return {string}
- */
- _computeDisplayName: function(url)
- {
- for (var context of this.target().runtimeModel.executionContexts()) {
- if (context.name && context.origin && url.startsWith(context.origin))
- return context.name;
- }
-
- var targetSuffix = this.target().isPage() ? "" : " \u2014 " + this.target().name();
- if (!url)
- return WebInspector.UIString("(no domain)") + targetSuffix;
- var parsedURL = new WebInspector.ParsedURL(url);
- var prettyURL = parsedURL.isValid ? parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "") : "";
- return (prettyURL || url) + targetSuffix;
- },
-
- /**
- * @param {string} url
* @param {!WebInspector.ContentProvider} contentProvider
* @param {boolean=} isContentScript
* @return {?WebInspector.UISourceCode}
@@ -235,13 +224,10 @@ WebInspector.NetworkProject.prototype = {
*/
_removeFileForURL: function(url)
{
- var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
- var projectURL = splitURL[0];
- var path = splitURL.slice(1).join("/");
- var project = this._workspaceProjects.get(WebInspector.NetworkProject.projectId(this.target(), projectURL, false));
+ var project = this._workspaceProjects.get(WebInspector.NetworkProject.projectId(this.target(), false));
if (!project)
return;
- project.removeFile(path);
+ project.removeFile(url);
},
_populate: function()
@@ -393,12 +379,8 @@ WebInspector.NetworkProject.prototype = {
if (this._networkMapping.hasMappingForURL(url))
return null;
- var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
- var projectURL = splitURL[0];
- var parentPath = splitURL.slice(1, -1).join("/");
- var name = splitURL.peekLast() || "";
- var project = this._workspaceProject(projectURL, isContentScript);
- var uiSourceCode = project.createUISourceCode(parentPath, name, url, contentProvider.contentType());
+ var project = this._workspaceProject(isContentScript);
+ var uiSourceCode = project.createUISourceCode(url, contentProvider.contentType());
uiSourceCode[WebInspector.NetworkProject._targetSymbol] = this.target();
if (addIntoProject)
project.addUISourceCodeWithProvider(uiSourceCode, contentProvider);

Powered by Google App Engine
This is Rietveld 408576698