Fix #147 - Fix duplicate onBlockableItem events
Our tests were missing that there are several situations where onBlockableItem events were being duplicated. This includes some situations that vary between Chromium and Firefox.
On a high level, this MR focuses on fixing the hole in the testing where duplicate events were not caught, and then fix the situations that result in duplicate events.
On a high level, these were the problems in the production code:
- Allowlisted popups were checked for relevant filters up to 3 times, and logged their allowlisting filter on each occasion.
- Requests which were allowlisted because of $document filters were being logged on every stage a request filter goes through. It is sufficient to only do this logging on the first event in the pipeline (onBeforeRequest).
- Frame-state would refind all allowlisting filters for the frame when its headers were updated, and duplicate its logs for each one. I've added the ability to update the existing allowlisting filters instead.
- In frame-state, some of the events used seem to arrive in different orders for different browsers, so the onHeadersReceived event needs to be able to work regardless of if it was called before or after onCommitted.
Edited by Justin Wernick