I'm looking for a way inspecting script element before the script
inside is executed, and possibly changing its content.

My first attempt was going it in DOMContentLoaded triggered event,
running on all script elements.
Needless to say it is too late, since as soon as DOM tree is created