Added try catch for CustomEvent treated as MouseEvent

This commit is contained in:
skprabhanjan 2019-08-20 21:16:13 +05:30
parent 0cec0816d0
commit f9ee50e910

View file

@ -327,12 +327,19 @@ export class ElectronWebviewBasedWebview extends Disposable implements Webview {
{
const rawEvent = event.args[0];
const bounds = this._webview.getBoundingClientRect();
window.dispatchEvent(new MouseEvent(rawEvent.type, {
...rawEvent,
clientX: rawEvent.clientX + bounds.left,
clientY: rawEvent.clientY + bounds.top,
}));
return;
try {
window.dispatchEvent(new MouseEvent(rawEvent.type, {
...rawEvent,
clientX: rawEvent.clientX + bounds.left,
clientY: rawEvent.clientY + bounds.top,
}));
return;
}
catch (TypeError) {
//CustomEvent was treated as MouseEvent - https://github.com/microsoft/vscode/issues/78915
return;
}
}
case 'did-set-content':