Amin Bandali collected several other fixes that were necessary for mozjs115 to build with Python 3.12 beyond the one that I noticed was included in 115.8.
You can find them in the python3.12 patches in https://salsa.debian.org/gnome-team/mozjs/-/tree/debian/115/master/debian/patches (Note that mozjs115 is partially stripped down so I can't guarantee that even those patches are complete for firefox-esr's needs.) Therefore, I presume we will need to reopen this bug, but I have not tried building firefox-esr myself. Thank you, Jeremy Bícha