Sample needed to pass Json object from JS to Renderer and then to browser using MOJO

6 views
Skip to first unread message

Kush Agarwal

unread,
Apr 11, 2021, 6:44:19 PM4/11/21
to dom...@chromium.org, mason...@chromium.org, yuzh...@chromium.org, jar...@chromium.org
Hello,
I have a MOJO pipeline available and I want to use it to send JSON object passed by JS apps from JS to Renderer and then I can stringify to send it to the browser.
The response that i will get is a string and I can again make a json object back in renderer,
Please share an example if you have.
Thanks,
Kush

Joey Arhar

unread,
Apr 12, 2021, 2:38:34 PM4/12/21
to Kush Agarwal, chromi...@chromium.org, dom-dev, Mason Freed, Yu Han
JS in webpages isn’t able to just send mojo ipc messages to the browser, you’d need to add your own JS bindings in the renderer. For example, window.alert uses window.idl to declare a binding and LocalDomWindow implements it.

+chromium-mojo in case there are other ways of accessing mojo interfaces exposed by the browser from script in the renderer which I'm not aware of.

Kush Agarwal

unread,
Apr 12, 2021, 3:16:39 PM4/12/21
to Joey Arhar, chromi...@chromium.org, dom-dev, Mason Freed, Yu Han
I have the MOJO interface between Render and Browser, which takes Strings, which is fine.
I need to send JSON from JS, need to stringify in renderer- this piece is missing
Reply all
Reply to author
Forward
0 new messages