Handle links safely by removing opener from window

Fixes #2608
This commit is contained in:
Daniel Imms
2020-02-04 06:43:17 -08:00
parent 56ac6f66bf
commit a980b3d132
2 changed files with 14 additions and 2 deletions
+7 -1
View File
@@ -298,7 +298,13 @@ export class Linkifier implements ILinkifier {
if (matcher.handler) {
return matcher.handler(e, uri);
}
window.open(uri, '_blank');
const newWindow = window.open();
if (newWindow) {
newWindow.opener = null;
newWindow.location.href = uri;
} else {
console.warn('Opening link blocked as opener could not be cleared');
}
},
() => {
this._onLinkHover.fire(this._createLinkHoverEvent(x1, y1, x2, y2, fg));