Find the extension files
In Explorer, open the directory "%APPDATA%\Mozilla\Firefox\Profiles\".
Open the folder that corresponds to your profile (typically a random letter and number combination ending in ".default").
Open the "Extensions" folder.
Duplicate the desired extension file ending in ".xpi"
Rename the duplicate file as a ".zip" file. Extract it to any desired location and open folder contents.
Open "Manifest.json" and view in a text editor like Notepad++ to look for the relevant script files (typically specified in "background":{"scripts": and located in a folder named "js" with the majority of the relevant code in "background.js").
Change the extension
Edit the "js/background.js" file and other relevant source code files to make any changes to the extension.
(Note: the source code in the Javascript file sometimes is condensed into
a single line. You can use a online decoder tool such as
https://beautifier.io/ to expand the code into multiple lines with conventional spacing for readability.)
When the extension is changed to your liking you will want to use it. You can test it until you close the browser with these steps:
"In Firefox: Open the about:debugging page, click "This Firefox" (in newer versions of Firefox), click "Load Temporary Add-on", then select any file in your extension's directory." - Mozilla Doc
After testing, compress your extension files as a ".zip" or ".xpi" file. (Note: remember NOT to compress the directory containing the files. "Manifest.json" needs to be in the root directory of the compressed file. Otherwise Firefox will report an error that the extension is corrupt!)
Install the modified extension
To have the plugin permanently installed, you must register the add-on with Mozilla and they will digitally sign it to run with any commercial release of Firefox. To avoid having to do this, you can use a Developer, Nightly Build, or Extended Support Release version of Firefox
In Firefox Developer Edition, open the page "about:config" and search for "xpinstall.signatures.required" and double click it to set it to "false". Do the same for
"extensions.langpacks.signatures.required" if your extension uses language packs.
On the Firefox menu bar (three horizontal lines icon, top right) go to the "Add-ons" page. To the right of "Manage Your Extensions" click the gear icon and select "Install Add-on from File...". Select your compressed extension file and it will be permanently installed.
Useful Links:
Mozilla Docs - Your First Web Extension How to temporarily test add-on.
Mozilla Docs - Add-on Signing Explains digital signing and how to get around the requirement.
https://beautifier.io/ Javascript decoder for readability