The browser is a native app and can use native apis to access screensharing desktop apis. It can then proxy these via some browser plugin api making those available to browser plugins.
Not X11, any app can see or manipulate any other apps screen buffer. It is one reason Wayland is nice.
If your system has MAC you can restrict its file access, but in general you have library support for this stuff built in.
It is also why in most cases it is a PITA to stream 3d rendered screens. Opengl / directX don't provide easy ways like X11 to look at a completed framebuffer and store / broadcast it.
In OpenGL this is fairly easy using FBO's - http://www.songho.ca/opengl/gl_fbo.html .
I have never used DirectX but I would be surprised if it did not allow you to read the framebuffer.
Wayland doesn't provide meaningful security for that case. It's true that there's no protocol support for arbitrary buffer access, but if you're running as the same user (as is the case here) it's comparatively trivial to dup the drm file descriptor and remap the buffers. You may need to be able to guess (or just probe for) the handles though, I'm not sure.
Actually there is a pointer lock api that allows apps to control user's mouse. And it can be added as a permission in chrome manifest. They only need the screen and mouse control. Which essentially means control entire machine.
Edit: never mind, I was thinking of chrome app, not the local plugin that we install for voice and video.
NPAPI plugins, ActiveX controls, etc. are just native libraries that are loaded into the browser's process. So, they can do anything that any other native application can do.
I'm a curmudgeon, but it seems like it's like designing a washing machine attachment that serves as a home security system and pasta maker.
Are there OS or X11 permissions that can restrict userland apps from deviating far from their original use case?