Fixes#102351
This seems like the most likely cause of #102351 (although it is difficult to confirm this). I'm adding an exception for insiders. If we discover this causing major problems for real world extensions, we can instead try to handle the error more gracefully
Fixes#101946
Webview can currently trigger some keyboard events twice. Sequence of events:
- User presses ctrl+v with a webview focused
- Webview is listening to keyboard events for rebroadcast (so that we can handle normal VS code commands even when focused on webviews)
- We rebroadcast the keypresses back to VS Code
- The webview then triggers the standard copy behavior on its own (I believe this is either chromium or electron)
- VS Code gets the ctrl+v keypress event and resolves it to the 'paste' command
- The paste command triggers the paste method on the webview
- This calls back into the webview content to trigger a second paste
This does not happen in cases where we are using native menus, which can call `setIgnoreMenuShortcuts` to disable the browser geenrated paste event.
## The fix
To fix this, I think we want to completely block the browser generate events in all cases and instead always dispatch the events through VS Code. This should ensure more consistent behavior.
This PR does this by:
- In the webview, add a keypress listener for copy/paste/cut and undo/redo. When we see these events, call `preventDefault` to block them but still dispatch back to VS Code
- In VS Code, more the logic for triggering undo/redo, etc. on webviews out of the electron layer and into the browser layer. iframe based webviews have the exact same problem as electron based webviews, so we need to fix this issue for both of them.
This command should be active if:
- we are on mac
- or we are not using custom title bars
The previous code was incorrectly disabling these commands entirely on mac