diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/devtools/front_end')
-rw-r--r-- | chromium/third_party/blink/renderer/devtools/front_end/ui/XLink.js | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/chromium/third_party/blink/renderer/devtools/front_end/ui/XLink.js b/chromium/third_party/blink/renderer/devtools/front_end/ui/XLink.js index a29a72afdc3..548944b569a 100644 --- a/chromium/third_party/blink/renderer/devtools/front_end/ui/XLink.js +++ b/chromium/third_party/blink/renderer/devtools/front_end/ui/XLink.js @@ -31,7 +31,8 @@ UI.XLink = class extends UI.XElement { this.style.setProperty('display', 'inline'); UI.ARIAUtils.markAsLink(this); this.tabIndex = 0; - this.setAttribute('target', '_blank'); + this.target = '_blank'; + this.rel = 'noopener'; /** @type {?string} */ this._href = null; @@ -71,11 +72,20 @@ UI.XLink = class extends UI.XElement { } if (attr === 'href') { - let href = newValue; - if (newValue.trim().toLowerCase().startsWith('javascript:')) - href = null; - if (Common.ParsedURL.isRelativeURL(newValue)) + // For invalid or non-absolute URLs, `href` should remain `null`. + if (!newValue) { + newValue = ''; + } + let href = null; + let url = null; + try { + url = new URL(newValue); + href = url.toString(); + } catch (error) { + } + if (url && url.protocol === 'javascript:') { href = null; + } this._href = href; this.title = newValue; |