I am writing an addon that replaces the code served by a particular URL. This is similar to the page-eater.js addon: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Modify_a_web_page
In the example above, the request still completes, which adds latency for the user. Instead of making the request and changing the result, I would like to reduce overall latency by canceling the request and providing a faked response.
In my attempts so far, any time that I cancel the request I also lose all opportunity to provide a faked result.