Reputation: 1362
I am creating simple plugin to catch http-request and save information about it to files. Saving module works and catching module also. All http request belonging to each window are saving to separate files. For example all http request from any tab of window 1 saving to file 1.txt, from window 2 saving to file 2.txt etc. But for now I have problem, because request from window 2,3, ... saving also to previous files. I mean:
I am using observer, but for test I was using eventListener for click, any it works perfect. Click from window x was saving only for file x. Any idea, what can be wrong?
Upvotes: 0
Views: 507
Reputation: 33162
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:
observe
use that information to map the request window to the id and file, ...Upvotes: 1