If I understand what you want to do, you need to write a Gecko plugin. Through the plugin, you can register your own MIME type, and then manipulate Javascript and the DOM.
This means that you will need to add the <object /> or <embed /> on the page to load your plugin, but then you can search for <script type="application/x-yourtype" /> to capture the inner text of this tag script and parse it using your plugin.
As Nickolay suggested, an alternative is to use what the browser currently supports, or to create a custom browser build. Daniel Spiewak's suggestion for using a Java applet (or a Flash applet also works).
Information about you is available on the Mozilla Developer website:
Nathan de vries
source share