Closed Bug 1344786 Opened 7 years ago Closed 7 years ago

Possibility to restartApplication from WebExtensions

Categories

(WebExtensions :: General, enhancement)

54 Branch
enhancement
Not set
normal

Tracking

(Not tracked)

RESOLVED WONTFIX

People

(Reporter: yfdyh000, Unassigned)

References

Details

(Whiteboard: [design-decision-denied] )

I would like to know that there is any possibility to make Restart add-ons via WebExtensions, like https://addons.mozilla.org/firefox/search/?q=restart. e.g. Call BrowserUtils.restartApplication();.


I know it is a sensitive, any plan makes a privileged API? I think that if this be specifically reviewed on AMO, it is acceptable.
OS: Unspecified → All
Hardware: Unspecified → All
Can you explain why you want this?
The extensions you linked to use old (pre-webextensions) methods of modifying the browser that prevents them from being started and stopped dynamically.  A lot of work has gone into moving away from extensions that require restarts, what is the rationale for requiring a restart?
Flags: needinfo?(yfdyh000)
(In reply to Andrew Swan [:aswan] from comment #1)
> Can you explain why you want this?
> The extensions you linked to use old (pre-webextensions) methods of
> modifying the browser that prevents them from being started and stopped
> dynamically.  A lot of work has gone into moving away from extensions that
> require restarts, what is the rationale for requiring a restart?

Sometimes I want to restart the browser due to memory leaks or other reasons, or just refresh. This may not be a common uses for the average user, and I know the 'Restart' command in GCLI, but still hope this possibility.

As a reference, https://addons.mozilla.org/firefox/addon/re-start have 28,485 users, Restart Button have 33,277 users, and other addons.


Or, assuming a usage scenario (still not a necessary, it seems...): gui:config and other add-ons will be able to prompt user for restart the browser, rather than describe for close and re-start the browser manually by the user, if some changes (e.g. some prefs) from them or the user needs the restart to take effect.
Flags: needinfo?(yfdyh000)
Whiteboard: [design-decision-needed]
Other use case no related to extension installs requiring restarts is about switching the language of the Fx interface. After switching the preferred language (via about:config or an specific add-on), a restart is required if the user want apply the new language to his already existing windows. All existent add-on related to UI language switching offers the option tp restart the browser after selecting a new language.
Yes. I want it to reduce RAM and CPU. When Firefox is running for a long time, the RAM used will be very large, when restarted, it will reduce the amount of RAM.
https://dxr.mozilla.org/mozilla-central/search?q=confirmRestartPrompt&redirect=false is a good practice.

I don't know whether needs to support for request close the application or something else.
See Also: → 1352130
Hi YF, this has been added to agenda for the April 18 WebExtensions API triage meeting. Would you be able to join us? 

Agenda: https://docs.google.com/document/d/1zKqhDqXoH9vi88q4DGtOHm1hsCF8ZwLNvCrrCE5htbc/edit#

Call-in info: https://wiki.mozilla.org/Add-ons/Contribute/Triage#Details_.26_How_to_Join
(In reply to Caitlin Neiman (http://pronoun.is/she) from comment #6)
> Hi YF, this has been added to agenda for the April 18 WebExtensions API
> triage meeting. Would you be able to join us? 
> 
> Agenda:
> https://docs.google.com/document/d/
> 1zKqhDqXoH9vi88q4DGtOHm1hsCF8ZwLNvCrrCE5htbc/edit#
> 
> Call-in info:
> https://wiki.mozilla.org/Add-ons/Contribute/Triage#Details_.26_How_to_Join

Thank you for your invitation, but because of language and time zone issues, it's hard for me to participate smoothly in a live chat.
All WebExtensions are restart less and the APIs that WebExtensions need are all restartless there isn't a need there. The main use case mentioned has been about adding a button or other UI element to trigger a restart because that's easier than using the keyboard shortcut, the os level tools, or the file menu to trigger a restart.

Whilst no-one has any specific examples of how this could be a security problem, there could be a possibility here for WebExtensions to force restarts un-neccessarily. That would need some investigation.

This doesn't seem worth creating an API for.

If we do land an API that causes a restart, e.g.: changing the locale, or change private browsing autostart then we should probably do the restart request as part of that API or discuss the issue then. These currently are not possible to do.

So we might re-open or re-investigate this at a later date.

Finally, if people want a button in the menu that does a restart, I would suggest that we file a bug asking for Firefox to implement one.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → WONTFIX
Whiteboard: [design-decision-needed] → [design-decision-denied]
(In reply to Criss Anger from comment #4)
> Yes. I want it to reduce RAM and CPU. When Firefox is running for a long
> time, the RAM used will be very large, when restarted, it will reduce the
> amount of RAM.

Nothing more to add, I always use some restartt addon (actually Restart manager), even such simple thing will be big problem after FX57.
We need to be able to restart Firefox via a button because the browser routinely slows to a crawl when repeatedly reloading XSLT documents (for Web development and personal purposes). (It just happened again in Firefox 53, which reminded me of this bug.)

My guess is this is related to whatever is causing bug 973245 where you can open an XSLT source document with an autoplaying |audio| element and the audio will continue to play even after the tab is closed. That suggests some kind of memory leak in which XSLT source documents are never unloaded from memory.

Until that's fixed, a restart button will be helpful. (That bug has gone three years without a response, so I'm not hopeful.)

(Another reason a restart button was useful was for loading/unloading the Adobe Flash plug-in, but that seems to be restartless now, so there's no need to use it for that purpose.)
This didn't occur to me until now, but we do have an open bug to implement tabs.discard (bug 1322485) which we plan to land in time for Firefox 57 (if not sooner), and perhaps an extension could be built around that that would do something similar to restarting the browser, if the need for the restart is that too many tabs are open and are consuming too much resources.
See Also: → 1366009
Use cases
- Toolbar button to restart application, while implementing custom functionality like in https://addons.mozilla.org/en-US/firefox/addon/restart-manager/ (reaches wider than bug 1366009)

Why would you want to restart your browser?
- Free up memory (RAM)
- Clear your browser cache if that option is set
- Remove cookies if that option is set
- Bugs (in Nightly) might require a restart to investigate properly (especially with the "tabs" API)
- Reload things that have changed on disk (configuration files)
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.