ephy-history-service: fix race-condition

Database shouldn't be accessed from the main thread.
tests: add test for read-only history database creation
[release] 3.11.2