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

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

Issue 1805763002: [DevTools] Do not linkify relative urls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | third_party/WebKit/Source/devtools/front_end/components/Linkifier.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 559c5f7c4afcb8a6a1b7f9056b7247393d79a5cf..11486eeb7f1b8d871fc0677a38e011fa67cb640e 100644
--- a/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js
+++ b/third_party/WebKit/Source/devtools/front_end/common/ParsedURL.js
@@ -303,6 +303,24 @@ WebInspector.ParsedURL.splitLineAndColumn = function(string)
}
/**
+ * @param {string} url
+ * @return {boolean}
+ */
+WebInspector.ParsedURL.isRelativeURL = function(url)
+{
+ var hasScheme = /^([A-Za-z][A-Za-z0-9+.-]*):\/\//.test(url);
+ if (hasScheme)
+ return false;
+ var hasPort = /^[^:^\/]*:/.test(url);
caseq 2016/03/16 00:50:32 I think this is wrong both on part of URL grammar.
+ if (hasPort)
+ return false;
+ var hasDomain = /^[^.^\/]*\.[^\/]*\//.test(url);
caseq 2016/03/16 00:50:33 ... and regexp syntax.
+ if (hasDomain)
+ return false;
+ return true;
+}
+
+/**
* @return {?WebInspector.ParsedURL}
*/
String.prototype.asParsedURL = function()
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/components/Linkifier.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698