Created
July 27, 2019 01:31
-
-
Save jscher2000/ad268422c3187dbcbc0d15216a3a8060 to your computer and use it in GitHub Desktop.
Browser Console script to reload userChrome.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Code to paste and run in the Browser Console | |
Requires devtools.chrome.enabled => true in about:config | |
Tested in Firefox 68.0.1 on Windows | |
*/ | |
// Create references to APIs we'll use | |
var ss = Cc["@mozilla.org/content/style-sheet-service;1"].getService(Ci.nsIStyleSheetService); | |
var io = Cc["@mozilla.org/network/io-service;1"].getService(Ci.nsIIOService); | |
var ds = Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties); | |
// Get the chrome directory in the current profile | |
var chromepath = ds.get("UChrm", Ci.nsIFile); | |
// Specific file: userChrome.css or userContent.css | |
chromepath.append("userChrome.css"); | |
// Morph to a file URI | |
var chromefile = io.newFileURI(chromepath); | |
// Unregister the sheet | |
if(ss.sheetRegistered(chromefile, ss.USER_SHEET)){ | |
ss.unregisterSheet(chromefile, ss.USER_SHEET); | |
} | |
// Reload the sheet | |
ss.loadAndRegisterSheet(chromefile, ss.USER_SHEET); |
omnigenous
commented
May 9, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment