Greasemonkey: WebExt: External editor support (read/write extension directory)

Created on 5 Jun 2017  ·  5Comments  ·  Source: greasemonkey/greasemonkey

The runtime API provides multiple ways to read files from the extension directory, so what is left to explore is how to write files to the extension directory.

I think it's worth exploring if runtime#getPackageDirectoryEntry and fileSystem#getWritableEntry can used to write files to the extension directory, but I fear that the permission system might interfere.

All 5 comments

Turns out fileSystem is not available to extensions, only to apps. So with a read-only API, it might still be possible to implement editor support but things like auto-update won't be possible.

This is effectively impossible. The only thing I can imagine is to use native messaging and a custom written local binary. That will be a lot of work, at best.

@yfdyh000 Thanks, that is incredibly helpful! I didn't even think about running python -m http.server to serve my userscript folder on localhost while I'm editing them. Now it's only two clicks and ~3 sec delay between them to reload a script from disk.

The only step missing to make it truly convenient is the Violentmonkey feature mentioned in the article: a checkbox on the GM "Install script" page to monitor the file instead of closing it after installing. Even simply keeping that installation page open instead of closing it after hitting Install would be awesome.

Was this page helpful?
0 / 5 - 0 ratings