Make error handler's focus changes best-effort
When the error handler itself causes an exception, it falls back to a simple document.write(). This means the proper error dialog isn't shown when this happens. The focus changes that were added to the error handler in e1f8232b are not crucial for its function. If these focus changes causes an exception we can just ignore that.
This commit is contained in:
parent
4ecb44111d
commit
145d235094
@ -51,6 +51,12 @@ function handleError(event, err) {
|
||||
document.getElementById('noVNC_fallback_error')
|
||||
.classList.add("noVNC_open");
|
||||
|
||||
} catch (exc) {
|
||||
document.write("noVNC encountered an error.");
|
||||
}
|
||||
|
||||
// Try to disable keyboard interaction, best effort
|
||||
try {
|
||||
// Remove focus from the currently focused element in order to
|
||||
// prevent keyboard interaction from continuing
|
||||
if (document.activeElement) { document.activeElement.blur(); }
|
||||
@ -61,8 +67,9 @@ function handleError(event, err) {
|
||||
elem.setAttribute("tabindex", "-1");
|
||||
});
|
||||
} catch (exc) {
|
||||
document.write("noVNC encountered an error.");
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
// Don't return true since this would prevent the error
|
||||
// from being printed to the browser console.
|
||||
return false;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user