Add try-catch around RDP script initialization to catch errors

- Wrapped the initial script execution in try-catch
- Added alert for critical errors to show if script fails
- This will help identify if JavaScript syntax errors are preventing execution
- If alert appears, it means script is running but has errors
- If no alert appears, script is completely blocked
parent a27be89b
...@@ -313,7 +313,11 @@ console.log('RDP page script starting...'); ...@@ -313,7 +313,11 @@ console.log('RDP page script starting...');
// init kbdlayout_input // init kbdlayout_input
let defaultLayoutId; let defaultLayoutId;
for (let i = 0; i < layouts.length; ++i) { try {
if (typeof layouts === 'undefined') {
throw new Error('layouts is not defined - reversed_layouts.js may not have loaded');
}
for (let i = 0; i < layouts.length; ++i) {
const layout = layouts[i]; const layout = layouts[i];
const displayName = layout.displayName; const displayName = layout.displayName;
const opt = document.createElement('option'); const opt = document.createElement('option');
...@@ -324,15 +328,22 @@ for (let i = 0; i < layouts.length; ++i) { ...@@ -324,15 +328,22 @@ for (let i = 0; i < layouts.length; ++i) {
defaultLayoutId = i; defaultLayoutId = i;
} }
// Since we don't have kbdlayout_input in this simplified version, we'll use default // Since we don't have kbdlayout_input in this simplified version, we'll use default
}
console.log('Keyboard layouts initialized, defaultLayoutId:', defaultLayoutId);
} catch (error) {
console.error('Error initializing keyboard layouts:', error);
defaultLayoutId = 0; // fallback
} }
console.log('Keyboard layouts initialized, defaultLayoutId:', defaultLayoutId);
let kbdInputLayoutEvent = () => {}; let kbdInputLayoutEvent = () => {};
let _Module = null; let _Module = null;
console.log('Starting WebAssembly module loading...'); console.log('Starting WebAssembly module loading...');
WallixModule({ if (typeof WallixModule === 'undefined') {
console.error('WallixModule is not defined - rdp.wasm.js may not have loaded');
} else {
WallixModule({
// INITIAL_MEMORY: 16777216, // 16**6 // INITIAL_MEMORY: 16777216, // 16**6
// INITIAL_MEMORY: 268435456, // 16**7 // INITIAL_MEMORY: 268435456, // 16**7
}).then((Module) => { }).then((Module) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment