try/catch guard for QEMU keyboard test
Safari on older iOS doesn't support creating KeyboardEvent objects, so put a guard in to avoid crashes.
This commit is contained in:
parent
7cac5c8e9f
commit
2bf4cf5a20
10
core/rfb.js
10
core/rfb.js
|
@ -2410,9 +2410,13 @@ RFB.encodingHandlers = {
|
|||
QEMUExtendedKeyEvent: function () {
|
||||
this._FBU.rects--;
|
||||
|
||||
var keyboardEvent = document.createEvent("keyboardEvent");
|
||||
if (keyboardEvent.code !== undefined) {
|
||||
this._qemuExtKeyEventSupported = true;
|
||||
// Old Safari doesn't support creating keyboard events
|
||||
try {
|
||||
var keyboardEvent = document.createEvent("keyboardEvent");
|
||||
if (keyboardEvent.code !== undefined) {
|
||||
this._qemuExtKeyEventSupported = true;
|
||||
}
|
||||
} catch (err) {
|
||||
}
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue