Restart browser in a WebExt?

Greetings everybody!

Is there a way to restart the browser through WebExt API ?
I thought “chrome.runtime.restart()” would do the job but apparently it’s not :frowning: ?
May be it requires any permission ?

Regards,
Etienne

Looks like chrome.runtime.restart() is only defined on the chrome API, and it only works in ChromeOS’s kiosk mode: “Restart the ChromeOS device when the app runs in kiosk mode. Otherwise, it’s no-op.”

Are you looking to close all the tabs and reopen the browser? You could definitely iterate through all the tabs and close them, do whatever you want to do, then re-open the tabs, but that’d still leave the browser launched.

I would like to close all windows and exit the browser (so that the memory is freed) and then that the browser opens up again, restoring the tabs (just as if the browser would restart after an update for example).

Such an addon used to exist before migration to WebExt (e.g : https://addons.mozilla.org/fr/firefox/addon/re-start/). It’s really basic but really useful to free memory when it becomes saturated.

PS : By the way, what is kiosk mode exactly?

Ah, cool, makes sense :). Since webextensions are built on top of these web-like APIs, i’m not sure if it’s going to be possible to restart the browser application since javascript cant re-launch the browser. Looks like that was possible with the old style extensions.

Kiosk mode seems to be a chrome / chromebook specific feature: https://support.google.com/chromebook/answer/3134673?hl=en

Mozilla could implement that API, but I doubt they will. There is no CLI option to do this either.

As the user, you can press Shift+F2, hope that the Developer Toolbar opens and enter restart.