Set rel="noopener" on gr-linked-text links and similar
Change-Id: Ibabc64b6b26bb9f6221f15eefec1cad14f80cbe0
This commit is contained in:
@@ -152,6 +152,7 @@
|
||||
'height=' + SIGN_IN_HEIGHT_PX,
|
||||
'left=' + left,
|
||||
'top=' + top,
|
||||
'noopener=yes',
|
||||
];
|
||||
window.open('/login/%3FcloseAfterLogin', '_blank', options.join(','));
|
||||
},
|
||||
|
||||
@@ -116,6 +116,8 @@ limitations under the License.
|
||||
assert.isFalse(windowOpen.called);
|
||||
toast.fire('action');
|
||||
assert.isTrue(windowOpen.called);
|
||||
assert.notEqual(windowOpen.lastCall.args[2].indexOf('noopener=yes'),
|
||||
-1);
|
||||
|
||||
var hideToastSpy = sandbox.spy(toast, 'hide');
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@
|
||||
a.href = href;
|
||||
a.textContent = text;
|
||||
a.target = '_blank';
|
||||
a.rel = 'noopener';
|
||||
output.appendChild(a);
|
||||
} else if (fragment) {
|
||||
output.appendChild(fragment);
|
||||
|
||||
@@ -74,6 +74,7 @@ limitations under the License.
|
||||
element.content = url;
|
||||
var linkEl = element.$.output.childNodes[0];
|
||||
assert.equal(linkEl.target, '_blank');
|
||||
assert.equal(linkEl.rel, 'noopener');
|
||||
assert.equal(linkEl.href, url);
|
||||
assert.equal(linkEl.textContent, url);
|
||||
});
|
||||
@@ -91,6 +92,7 @@ limitations under the License.
|
||||
element.content = 'Bug 3650';
|
||||
linkEl = element.$.output.childNodes[0];
|
||||
assert.equal(linkEl.target, '_blank');
|
||||
assert.equal(linkEl.rel, 'noopener');
|
||||
assert.equal(linkEl.href, url);
|
||||
assert.equal(linkEl.textContent, 'Bug 3650');
|
||||
});
|
||||
|
||||
@@ -69,6 +69,7 @@ GrLinkTextParser.prototype.addItem =
|
||||
a.href = href;
|
||||
a.textContent = text;
|
||||
a.target = '_blank';
|
||||
a.rel = 'noopener';
|
||||
htmlOutput = a;
|
||||
} else if (html) {
|
||||
var fragment = document.createDocumentFragment();
|
||||
|
||||
Reference in New Issue
Block a user