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

Unified Diff: Source/devtools/front_end/common/ParsedURL.js

Issue 475073002: DevTools: normalize sourceURL paths in importScript function (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/devtools/front_end/Runtime.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/front_end/common/ParsedURL.js
diff --git a/Source/devtools/front_end/common/ParsedURL.js b/Source/devtools/front_end/common/ParsedURL.js
index c98a54c542775be3bc412faaa05f6d8da7d9dab7..7e9c73af7706b3287916f403edf0a93f434393b7 100644
--- a/Source/devtools/front_end/common/ParsedURL.js
+++ b/Source/devtools/front_end/common/ParsedURL.js
@@ -121,39 +121,6 @@ WebInspector.ParsedURL.splitURL = function(url)
}
/**
- * http://tools.ietf.org/html/rfc3986#section-5.2.4
- * @param {string} path
- * @return {string}
- */
-
-WebInspector.ParsedURL.normalizePath = function(path)
-{
- if (path.indexOf("..") === -1 && path.indexOf('.') === -1)
- return path;
-
- var normalizedSegments = [];
- var segments = path.split("/");
- for (var i = 0; i < segments.length; i++) {
- var segment = segments[i];
- if (segment === ".")
- continue;
- else if (segment === "..")
- normalizedSegments.pop();
- else if (segment)
- normalizedSegments.push(segment);
- }
- var normalizedPath = normalizedSegments.join("/");
- if (normalizedPath[normalizedPath.length - 1] === "/")
- return normalizedPath;
- if (path[0] === "/" && normalizedPath)
- normalizedPath = "/" + normalizedPath;
- if ((path[path.length - 1] === "/") || (segments[segments.length - 1] === ".") || (segments[segments.length - 1] === ".."))
- normalizedPath = normalizedPath + "/";
-
- return normalizedPath;
-}
-
-/**
* @param {string} baseURL
* @param {string} href
* @return {?string}
@@ -214,7 +181,7 @@ WebInspector.ParsedURL.completeURL = function(baseURL, href)
// href starts with "//" which is a full URL with the protocol dropped (use the baseURL protocol).
return parsedURL.scheme + ":" + path + postfix;
} // else absolute path
- return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "") + WebInspector.ParsedURL.normalizePath(path) + postfix;
+ return parsedURL.scheme + "://" + parsedURL.host + (parsedURL.port ? (":" + parsedURL.port) : "") + normalizePath(path) + postfix;
}
return null;
}
« no previous file with comments | « Source/devtools/front_end/Runtime.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698