Fix race in chrome injections

Close #1568