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

Unified Diff: third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.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/workspace/FileSystemMapping.js
diff --git a/third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.js b/third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.js
index c5cf47e55119068dd7b553d743277dcd3df31a0f..0bf5d210f34851750c331ff5e5c6f83e9ebf552d 100644
--- a/third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.js
+++ b/third_party/WebKit/Source/devtools/front_end/workspace/FileSystemMapping.js
@@ -53,7 +53,6 @@ WebInspector.FileSystemMapping.prototype = {
this._fileSystemMappings = {};
for (var fileSystemPath in savedMapping) {
var savedFileSystemMappings = savedMapping[fileSystemPath];
-
this._fileSystemMappings[fileSystemPath] = [];
var fileSystemMappings = this._fileSystemMappings[fileSystemPath];
@@ -132,6 +131,12 @@ WebInspector.FileSystemMapping.prototype = {
*/
addFileMapping: function(fileSystemPath, urlPrefix, pathPrefix)
{
+ if (!urlPrefix.endsWith("/"))
+ urlPrefix += "/";
+ if (!pathPrefix.endsWith("/"))
+ pathPrefix += "/";
+ if (!pathPrefix.startsWith("/"))
+ pathPrefix = "/" + pathPrefix;
this._innerAddFileMapping(fileSystemPath, urlPrefix, pathPrefix, true);
this._saveToSettings();
},
@@ -209,7 +214,7 @@ WebInspector.FileSystemMapping.prototype = {
// We are looking for the longest pathPrefix match.
if (entry && entry.pathPrefix.length > pathPrefix.length)
continue;
- if (filePath.startsWith(pathPrefix.substr(1)))
+ if (filePath.startsWith(pathPrefix))
entry = entries[i];
}
return entry;
@@ -250,7 +255,7 @@ WebInspector.FileSystemMapping.prototype = {
/**
* @param {string} url
- * @return {?{fileSystemPath: string, filePath: string}}
+ * @return {?{fileSystemPath: string, fileURL: string}}
*/
fileForURL: function(url)
{
@@ -259,7 +264,7 @@ WebInspector.FileSystemMapping.prototype = {
return null;
var file = {};
file.fileSystemPath = entry.fileSystemPath;
- file.filePath = entry.pathPrefix.substr(1) + url.substr(entry.urlPrefix.length);
+ file.fileURL = "file://" + entry.fileSystemPath + entry.pathPrefix + url.substr(entry.urlPrefix.length);
return file;
},
@@ -270,10 +275,11 @@ WebInspector.FileSystemMapping.prototype = {
*/
urlForPath: function(fileSystemPath, filePath)
{
- var entry = this._mappingEntryForPath(fileSystemPath, filePath);
+ var relativePath = filePath.substring("file://".length + fileSystemPath.length);
+ var entry = this._mappingEntryForPath(fileSystemPath, relativePath);
if (!entry)
return "";
- return entry.urlPrefix + filePath.substring(entry.pathPrefix.length - 1);
+ return entry.urlPrefix + relativePath.substring(entry.pathPrefix.length);
},
/**

Powered by Google App Engine
This is Rietveld 408576698