Search code examples
firefoxgoogle-chromev8javascript-engine

How do I evaluate JavaScript before the browser does?


I am looking for a way to get javascript code before SpiderMoney (Firefox JS engine) or V8 (Chrome JS engine) evaluate the it.

I don't mean capturing the traffic and get it before the application does, but "hijacking" the javascript before it reaches the JS engine itself.

Does anyone know how to do it, or at least point me to the correct direction?


Solution

  • I compiled my own build of SpiderMonkey. Once I've done that I called my own function before the compile() function of the engine.

    The function is not exported so it cannot be hooked (replaced during runtime), only patched.