While looking into chrome.debugger.sendCommand documentation, I came across an attribute, isSystemKey. I wonder whether this could be used to verify whether a key is typed by a human or program (similar to the isTrusted event attribute), but there doesn't appear to be any documentation on it, in the linked URL or elsewhere. Not a mention of its usage, as far as I can see.
So what does this boolean attribute do?
Some example code to illustrate, given a character c, a tab id tab_id and the debugger currently attached to that same tab:
let options = {
'key': c,
'type': 'keyDown',
'nativeVirtualKeyCode': c.charCodeAt(),
'windowsVirtualKeyCode': c.charCodeAt(),
'macVirtualKeyCode': c.charCodeAt(),
'isSystemKey': true // What does this change, compared to its falsy default?
}
// Pressing key
chrome.debugger.sendCommand({tabId: tab_id}, "Input.dispatchKeyEvent", options, () => {
// Releasing key
options.type = 'keyUp';
chrome.debugger.sendCommand({tabId: tab_id}, "Input.dispatchKeyEvent", options, () => {
// Detaching debugger
chrome.debugger.detach({tabId: tab_id});
});
});