You also have to edit ~/.config/mimeapps.list to redirect all things handled by Firefox's desktop file to the new desktop file calling the script.
For example, I have
text/markdown=mdv.desktop
image/jpg=imv.desktop
text/x-diff=less.desktop
text/plain=less.desktop
text/gemini=lagrange.desktop
text/html=surf.desktop
text/xml=surf.desktop
x-scheme-handler/http=surf.desktop
x-scheme-handler/https=surf.desktop
x-scheme-handler/about=surf.desktop
x-scheme-handler/ftp=surf.desktop
x-scheme-handler/unknown=surf.desktop
x-scheme-handler/gemini=lagrange.desktop
x-scheme-handler/gopher=lagrange.desktop