I’m trying to pass large binary data (e.g. new Uint8Array(10000000)) from web page’s JavaScript (JS) to extension’s JS. I want these data to be saved from extension to a file by nsIBinaryOutputStream/nsIFile (which I can’t call from my page). [ATM I don’t know about any other method how to save (large/binary) data from page’s JS on local machine.]
I’ve red about an Interaction between privileged and non-privileged pages, but it is useful only for passing strings. I don’t think that converting 10MB from/to base64 is good idea.
- Is it even possible to pass such data to extension?
- If yes, how to do it then?
- Shouldn’t I use JS XPCOM component?
Thank you for suggestions.
OK, I’ve solved how to pass any object from webpage to extension.
In web page JavaScript (JS):
In extension JS:
Proof of concept here.