I've built an extension (for both Chrome and Firefox) that needs to pass a lot of data from the background script to the content script to have it processed before the page loads. That is a hard requirement because of how it has to interact with the DOM.
I currently set a cookie in the background script and read that cookie at document_start from the content script. This works great but I recently found out there is a 4096 byte limit for all cookies for a domain. I can probably reduce the current size of the data by minimizing and even compressing it before setting the cookie but that's a band-aid fix. I'd like to figure out a more robust solution.
It'd really be nice if I could just use localstorage but it's async. So, is there a way to send more than 4kb from the background to the content script so that it is ready and available before the DOM loads?