Observers are global, not per window. When you register them from an overlay script, you'll get one observer for each window, and each of these observers will get notified for all http connections, no matter what window the request originated from (remember: observers are global). Oh, and each observer will also get each notified on each request that doesn't have any associated window (e.g. safe-browsing request refreshes, other components, other add-ons doing requests from their code modules).
You should do the following:
- Rewrite your code to only register exactly one observer for the whole application. Easiest way to do this is to implement it in a code module.
- Have the observer figure out the DOMWindow, if any, top level window, if any, and map that to a specific file. I already gave some code in another answer mapping a request to a DOMWindow and top level window in a http observer.
- How to map a request to a window and file is up to you in the end. You could register each top level window with your code module, and your code module would then generate an id/file name for each window and then in
observe
use that information to map the request window to the id and file, ...