Come up with a working plan for how to execute user scripts, of course not known until run time. Compatible with all three runAt times -- critically document_start
.
See https://github.com/arantius/greasemonkey/tree/8a255bde1aa6312715740fd0157d582a2d6cb183 for my research so far, where the approach is:
tabs.executeScript()
to fire off each user script.This "works" except there's no event I've yet found to observe that works for all three run times. There's webNavigation
's onBeforeNavigate
which is in fact too soon, it (as the name implies) fires before the navigation, when the current document is still active. But the next point is onCommitted
, and at that point it's too late for start, inline scripts have already executed.
To research:
webRequest
instead of webNavigation
. Does that give us a handle at start time?Re: https://bugzilla.mozilla.org/show_bug.cgi?id=1332273#c8
I'd like to be able to store (in background) a blob, later get (only) its URL and pass that URL (synchronously) to content script(s), but I know of no way to do any of those things.
I haven't worked out all the details myself, but i think the background page could store blobs in IndexedDB, then convert them to blob URIs via URL.createObjectURL() at startup time and pass them to the hypothetical synchronous configuration API and then maybe load them via