Skip to content

Instantly share code, notes, and snippets.

Last active October 3, 2022 18:27
  • Star 7 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
Star You must be signed in to star a gist
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' && location != 'chrome://browser/content/browser.xhtml')
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);
Copy link

It doesn't work :(

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