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,26 +313,37 @@ console.log('RDP page script starting...');
// init kbdlayout_input
let defaultLayoutId;
for (let i = 0; i < layouts.length; ++i) {
const layout = layouts[i];
const displayName = layout.displayName;
const opt = document.createElement('option');
opt.textContent = `${layout.localeName} 0x${layout.klid.toString(16).padStart(5, '0')} (${displayName})`;
opt.value = i;
if (displayName === 'United States - English') {
opt.selected = true;
defaultLayoutId = i;
try {
if (typeof layouts === 'undefined') {
throw new Error('layouts is not defined - reversed_layouts.js may not have loaded');
}
// Since we don't have kbdlayout_input in this simplified version, we'll use default
for (let i = 0; i < layouts.length; ++i) {
const layout = layouts[i];
const displayName = layout.displayName;
const opt = document.createElement('option');
opt.textContent = `${layout.localeName} 0x${layout.klid.toString(16).padStart(5, '0')} (${displayName})`;
opt.value = i;
if (displayName === 'United States - English') {
opt.selected = true;
defaultLayoutId = i;
}
// 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 _Module = null;
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: 268435456, // 16**7
}).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