WebExtensions: Redesign file loading
This fixes numerous issues with file loading including a handful leaks and calling WebKit API from threads.
This also changes resources to be a GHashTable instead of slowly iterating over a GList and doing string comparisons.
Overall this makes it more clear what is ran in a thread and the simple non-IO tasks like parsing JSON are kept in the main thread.