Index: third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js b/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js |
index 3566b3e7894c38311da293c53b9ad892c7c70460..b3fbdf2aba3bbd43ec9f84d4a339c8ac5a4be107 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js |
+++ b/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js |
@@ -74,6 +74,22 @@ WebInspector.ParsedURL = function(url) |
} |
/** |
+ * @param {string} fileSystemPath |
+ * @return {string} |
+ */ |
+WebInspector.ParsedURL.platformPathToURL = function(fileSystemPath) |
+{ |
+ fileSystemPath = fileSystemPath.replace(/\\/g, "/"); |
+ if (!fileSystemPath.startsWith("file://")) { |
+ if (fileSystemPath.startsWith("/")) |
+ fileSystemPath = "file://" + fileSystemPath; |
+ else |
+ fileSystemPath = "file:///" + fileSystemPath; |
+ } |
+ return fileSystemPath; |
+} |
+ |
+/** |
* @return {!RegExp} |
*/ |
WebInspector.ParsedURL._urlRegex = function() |
@@ -100,38 +116,12 @@ WebInspector.ParsedURL._urlRegex = function() |
/** |
* @param {string} url |
- * @return {!Array.<string>} |
+ * @return {string} |
*/ |
-WebInspector.ParsedURL.splitURLIntoPathComponents = function(url) |
+WebInspector.ParsedURL.extractPath = function(url) |
{ |
- if (url.startsWith("/")) |
- url = "file://" + url; |
- var parsedURL = new WebInspector.ParsedURL(url); |
- var origin; |
- var folderPath; |
- var name; |
- if (parsedURL.isValid) { |
- origin = parsedURL.scheme + "://" + parsedURL.host; |
- if (parsedURL.port) |
- origin += ":" + parsedURL.port; |
- folderPath = parsedURL.folderPathComponents; |
- name = parsedURL.lastPathComponent; |
- if (parsedURL.queryParams) |
- name += "?" + parsedURL.queryParams; |
- } else { |
- origin = ""; |
- folderPath = ""; |
- name = url; |
- } |
- var result = [origin]; |
- var splittedPath = folderPath.split("/"); |
- for (var i = 1; i < splittedPath.length; ++i) { |
- if (!splittedPath[i]) |
- continue; |
- result.push(splittedPath[i]); |
- } |
- result.push(name); |
- return result; |
+ var parsedURL = url.asParsedURL(); |
+ return parsedURL ? parsedURL.path : ""; |
} |
/** |
@@ -140,14 +130,8 @@ WebInspector.ParsedURL.splitURLIntoPathComponents = function(url) |
*/ |
WebInspector.ParsedURL.extractOrigin = function(url) |
{ |
- var parsedURL = new WebInspector.ParsedURL(url); |
- if (!parsedURL.isValid) |
- return ""; |
- |
- var origin = parsedURL.scheme + "://" + parsedURL.host; |
- if (parsedURL.port) |
- origin += ":" + parsedURL.port; |
- return origin; |
+ var parsedURL = url.asParsedURL(); |
+ return parsedURL ? parsedURL.securityOrigin() : ""; |
} |
/** |