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

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js

Issue 1805763002: [DevTools] Do not linkify relative urls. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed review comments 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
Index: third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
index 439eefdb3027728d4f6672b172ba6263033e54c6..6e70d88d6ddf833e282990a13c644517cae0f4e9 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/Linkifier.js
@@ -512,14 +512,17 @@ WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal, too
{
if (!linkText)
linkText = url;
- classes = (classes ? classes + " " : "");
- classes += isExternal ? "webkit-html-external-link" : "webkit-html-resource-link";
- var a = createElement("a");
- var href = sanitizeHref(url);
- if (href !== null)
+ var a = createElementWithClass("a", classes);
+ var href = url;
+ if (url.trim().toLowerCase().startsWith("javascript:"))
+ href = null;
+ if (isExternal && WebInspector.ParsedURL.isRelativeURL(url))
+ href = null;
+ if (href !== null) {
a.href = href;
- a.className = classes;
+ a.classList.add(isExternal ? "webkit-html-external-link" : "webkit-html-resource-link");
+ }
if (!tooltipText && linkText !== url)
a.title = url;
else if (tooltipText)

Powered by Google App Engine
This is Rietveld 408576698