Instantly share code, notes, and snippets.

What would you like to do?
Restart Button for Firefox. An updated version of Middle click also empties the script cache.
(function() {
if(location != 'chrome://browser/content/browser.xul')
try {
id: 'restart-button',
type: 'custom',
defaultArea: CustomizableUI.AREA_NAVBAR,
onBuild: function(aDocument) {
var toolbaritem = aDocument.createElementNS('', '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)
else if(event.button == 2)
let cancelQuit = Cc[";1"].createInstance(Ci.nsISupportsPRBool);
Services.obs.notifyObservers(cancelQuit, "quit-application-requested", "restart");
Services.startup.quit(Services.startup.eAttemptQuit | Services.startup.eRestart);

This comment has been minimized.

Skrity commented Dec 13, 2017

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


This comment has been minimized.

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?


This comment has been minimized.

Eternal73 commented Sep 7, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment