it might helps to keep frequently called small files in the browser's in-memory cache (to check exactly)
and use APIs when CSPs might not (music detection code)
If we got rid of /web-accessible/ moving all code to /extension/ there would be no delay, we would be up and running before YT even starts loading from the server.
Looking forward! So maybe it is only good for API calls. And files /photos that can/should wait, like it sounds, or a secondary.css)
In Firefox loading random YT clip the first js&css/web-accessible/core.js is injected right at the top, while
last js&css/web-accessible/init.js is the last node in HTML document injected long after whole thing loaded. This means there is a high chance browser already started executing YT javascript before our js&css/web-accessible/init.js runs. Bad for intercepting autoplay, bad for codecs, might even miss some early nodes in ImprovedTube.ytElementsHandler()
👍 this can be documentation for this project as long as it is like this!
dont take my word for it, test test test and verify. Might be my computer or config after all. I just rechecked and this time init.js lands just after HEAD, so it might have been my bogged Browser session. But even after HEAD is too slow - YT JS files loaded in HEAD might have started running at this point.
open devtools and look where js&css/web-accessible/ files are located in the YT html
Browser is able to inject all
before HTML is even fetched from YT server, but our manually injected files are injected with huge delay. In Chrome all land after HEAD. In FF and Vivaldi first few somehow manage to squeeze just before HEAD.
If we got rid of /web-accessible/ moving all code to /extension/ there would be no delay, we would be up and running before YT even starts loading from the server.
What might web-accessible even be good for?
Looking forward! So maybe it is only good for API calls. And files /photos that can/should wait, like it sounds, or a secondary.css)
(Separation:)
Web-accessible files load late/r