Skip to content

Commit 18d381b

Browse files
committed
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 microsoft#94233
1 parent c7fec92 commit 18d381b

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/vs/base/browser/ui/aria/aria.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ import 'vs/css!./aria';
77
import { isMacintosh } from 'vs/base/common/platform';
88
import * as dom from 'vs/base/browser/dom';
99

10+
// 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
11+
const MAX_MESSAGE_LENGTH = 20000;
1012
let ariaContainer: HTMLElement;
1113
let alertContainer: HTMLElement;
1214
let statusContainer: HTMLElement;
@@ -54,6 +56,9 @@ function insertMessage(target: HTMLElement, msg: string): void {
5456
}
5557

5658
dom.clearNode(target);
59+
if (msg.length > MAX_MESSAGE_LENGTH) {
60+
msg = msg.substr(0, MAX_MESSAGE_LENGTH);
61+
}
5762
target.textContent = msg;
5863

5964
// See https://www.paciellogroup.com/blog/2012/06/html5-accessibility-chops-aria-rolealert-browser-support/

0 commit comments

Comments
 (0)