From 18d381b7cc4fbb88f303b2344e6ddce7b663a7aa Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 27 Apr 2020 12:28:13 +0200 Subject: [PATCH] Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages fixes #94233 --- src/vs/base/browser/ui/aria/aria.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/vs/base/browser/ui/aria/aria.ts b/src/vs/base/browser/ui/aria/aria.ts index b42fbf94ac2..a971f2f4ce3 100644 --- a/src/vs/base/browser/ui/aria/aria.ts +++ b/src/vs/base/browser/ui/aria/aria.ts @@ -7,6 +7,8 @@ import 'vs/css!./aria'; import { isMacintosh } from 'vs/base/common/platform'; import * as dom from 'vs/base/browser/dom'; +// Use a max length since we are inserting the whole msg in the DOM and that can cause browsers to freeze for long messages #94233 +const MAX_MESSAGE_LENGTH = 20000; let ariaContainer: HTMLElement; let alertContainer: HTMLElement; let statusContainer: HTMLElement; @@ -54,6 +56,9 @@ function insertMessage(target: HTMLElement, msg: string): void { } dom.clearNode(target); + if (msg.length > MAX_MESSAGE_LENGTH) { + msg = msg.substr(0, MAX_MESSAGE_LENGTH); + } target.textContent = msg; // See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/ -- GitLab