docs/security/handling-messages-from-web-content.md
(drawing source here)
Sometimes features are proposed in which the Chrome user interface (in the
browser process) handles messages directly from web content (JavaScript, HTML
etc.). For example, this could be done using the postMessage APIs which have
been put in place for Android WebView apps. This is not allowed, because:
mojom interface definition files go through
our IPC security review process (and will benefit from other future
Mojo security improvements).In order to support WebView and CCT, APIs exist in Chrome to establish web message channels between the embedding application and web page. These exist only to support these "embedding the web" scenarios, which are often used to build site- or purpose-specific browsers. General browser features should not use them because of the reasons stated above.
Other mechanisms of bypassing normal processes might include exposing unreviewed APIs to a component extension, and making its APIs available to web content. These are similarly not allowed.