Per @woxxom:
The service worker dies by design after a period of inactivity. To notify the browser of the
chrome
API listeners that will wake it up, they must be added at the initial evaluation of the script, not inside asynchronous or dynamic code. For simplicity you can do at the beginning/end of the script in the global scope e.g.omniboxHandler.addListener()
The extension is installed just once, but the script runs each time it wakes up, which is why the listeners must be always registered immediately.