runtime.oninstalled not working on reinstalling safari web extension

runtime.oninstalled is invoked when I install the extension for the first time in the browser. But if I uninstalled it again (by dragging the app to bin), and tried reinstalling the runtime.oninstalled is not invoked.

is that an expected behavior?

If so, how can I test this case during extension development? Because it is difficult to find a new browser to test this case every time.

Thanks.
In the latest version of Safari (or in Safari Technology Preview) - Safari should fire the onInstalled event every time your extension is turned off and back on again in Safari Extensions preferences.

Let me know if this isn't what you are seeing!

Reviving this thread because I am still seeing this issue with Web Extensions. It would appear that until you "Always allow on every website" the extension simply doesn't run (even in the background) in order to receive the onInstalled event. Furthermore, even after setting the proper web site permissions and toggling the extension off and then on, it does not 100% of the time fire the onInstalled event.

In my case, we want to show a tab with a welcome page for quickly onboarding after installing the extension. Specifically, we want to describe Safari's opt-in site permissions and how to make our extension work with those settings, but we are in a catch 22 because we can't even show that page until the user opts in to site permissions.

Hi, I came across this comment because I am facing the same issue. Have you found a fix for this? I just tested Honey's app and their onInstalled event runs without permissions needing to be set

for context, here's a video of it: https://www.dropbox.com/s/a48ixh58wjpc2tj/onInstalledEvent.MP4?dl=0

runtime.oninstalled not working on reinstalling safari web extension
 
 
Q