adblock: Stray files left in /tmp if Epiphany is closed before filters are compiled
If Epiphany is closed between a call to webkit_user_content_filter_store_save()
and its completion callback is invoked, stray files are left under /tmp
.
The root cause for this is that WebKit does internally the following when compiling a JSON ruleset:
- A named temporary file is created under
/tmp
and mapped in memory. - The JSON rule set is compiled to bytecode.
a. If compilation failed, the file is removed before invoking the completion callback.
b. If compilation succeded, the file is moved to its final location (under the path configured when instantiating
WebKitUserContentFilterStore
).
Ideally we would fix this in WebKit, I filed bug #202277 for that, but maybe there is somthing we can do in Epiphany as a workaround in the meantime.