]> git.proxmox.com Git - pve-xtermjs.git/commitdiff
fix #5063: load WebGL addon in try block
authorDominik Csapak <d.csapak@proxmox.com>
Mon, 11 Dec 2023 10:19:56 +0000 (11:19 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 11 Dec 2023 12:35:31 +0000 (13:35 +0100)
since under certain circumstances (e.g. using safari < 16) the addon
constructor already throws an exception, not only the loading later.

To allow falling back to the canvas renderer, move it into the try
block after WebGL detection.

This should fix the xterm.js console on Apple's iOS.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
xterm.js/src/main.js

index 15756970413f1df711fdfa8cb3dd03fca6cfb2a1..289032c3152ad569142501bb8c059a9936e87d97 100644 (file)
@@ -99,7 +99,6 @@ var terminalContainer = document.getElementById('terminal-container');
 document.getElementById('status_bar').addEventListener('click', hideMsg);
 document.getElementById('connect_btn').addEventListener('click', startGuest);
 const fitAddon = new FitAddon.FitAddon();
-const webglAddon = new WebglAddon.WebglAddon();
 
 createTerminal();
 
@@ -157,6 +156,7 @@ function createTerminal() {
     let loadedWebgl = false;
     try {
        if (detectWebgl()) {
+           const webglAddon = new WebglAddon.WebglAddon();
            term.loadAddon(webglAddon);
            loadedWebgl = true;
        }