Merge pull request #2688 from Tyriar/2608_safe_links

Handle links safely by removing opener from window
This commit is contained in:
Daniel Imms
2020-02-04 06:51:24 -08:00
committed by GitHub
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));