Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Restart Button for Firefox. An updated version of https://github.com/Endor8/userChrome.js/tree/master/restartfirefoxbutton_movable. Middle click also empties the script cache.
(function() {
if(location != 'chrome://browser/content/browser.xul')
return;
try {
CustomizableUI.createWidget({
id: 'restart-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
var toolbaritem = aDocument.createElementNS('http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul', 'toolbarbutton');
toolbaritem.onclick = event => onClick(event);
var props = {
id: 'restart-button',
class: 'toolbarbutton-1 chromeclass-toolbar-additional',
label: 'Restart',
tooltiptext: 'Restart (with middle click userChrome.js cache is emptied)',
style: 'list-style-image: url(chrome://browser/skin/sync.svg)'
};
for(var p in props)
toolbaritem.setAttribute(p, props[p]);
return toolbaritem;
}
});
} catch(e) {};
function onClick(event) {
if(event.button == 1)
Services.appinfo.invalidateCachesOnRestart();
else if(event.button == 2)
return;
let cancelQuit = Cc["@mozilla.org/supports-PRBool;1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
if(!cancelQuit.data)
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);
}
})();
@Skrity

This comment has been minimized.

Copy link

Skrity commented Dec 13, 2017

This icon seem fitting, and can blend nicely with current theme: chrome://browser/skin/sync.svg

@rayman89

This comment has been minimized.

Copy link

rayman89 commented Apr 18, 2018

I was not able to make the button work. It only appears as a button not on the menu and clicking it does nothing. Any idea why?

@Eternal73

This comment has been minimized.

Copy link

Eternal73 commented Sep 7, 2018

Seems FF63 destroyed this, the icon has vanished from the toolbar....

@intika

This comment has been minimized.

Copy link

intika commented Nov 24, 2018

One simple solution is to bookmark "about:profiles" ... when restart is needed open that page and click "normal restart"

capture
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.