CookieBannerChild cleanup timeout never executes on some sites
Categories
(Core :: Privacy: Anti-Tracking, defect, P3)
Tracking
()
| Tracking | Status | |
|---|---|---|
| firefox134 | --- | fixed |
People
(Reporter: emz, Assigned: majaharding)
References
(Blocks 1 open bug)
Details
Attachments
(2 files)
I've observed this issue while testing a broken rule on https://futurezone.de
The timeout gets scheduled here with a 5 second delay, but is never executed.
Never executing the cleanup callback means that we keep polling for cookie banners indefinitely.
We use Timer.sys.mjs for setTimeout. When I switched over to use this.contentWindow.setTimeout the callback was executed successfully. The bug might be in the Timer.sys.mjs implementation.
| Reporter | ||
Comment 1•2 years ago
|
||
Lowering priority now that we have a fixup in place (Bug 1865149).
| Reporter | ||
Comment 2•2 years ago
|
||
Bug 1865149 seems to work well and I don't have time to look into this further currently.
| Assignee | ||
Comment 3•1 year ago
|
||
I found the cause of this bug.
When the cleanup() function inside #promiseObserve() gets called with the result of the banner search, it cancels the observerCleanUpTimer, which can then no longer clean up the Button observer. The rules for https://futurezone.de match a banner on the page but not a button, hence why the bug shows up there.
Because the "load" event causes the cleanup timer to restart, the bug doesn't occur if "load" happens after "Starting to detect the target button".
Using this.contentWindow?.setTimeout() seemed to help, because the code to cancel that timeout was still lazy.clearTimeout(). i.e. The cleanup() function couldn't cancel the timeout and cause the bug.
I have a patch for this which fixes the bug and avoids the timing issues, I'll upload it shortly.
| Assignee | ||
Comment 4•1 year ago
|
||
When the cleanup() function inside #promiseObserve() gets called with the result of the banner search,
it cancels the observerCleanUpTimer, which can then no longer clean up the Button observer.
I fixed this, and also other potential async timing issues, by stopping the cleanup function from cancelling
the timeout, and having the timeout set a persistent "givenUp" flag instead of trying to directly cancel the
promiseObserver.
Updated•1 year ago
|
Comment 6•1 year ago
|
||
Backed out for causing perma mochistest failures @ test_event_listener_leaks.html
Backout link: https://hg.mozilla.org/integration/autoland/rev/32310605dbc657ffb394fe09a0d9fa4c96c223df
Failure log -> TEST-UNEXPECTED-FAIL | dom/indexedDB/test/test_event_listener_leaks.html
| Assignee | ||
Comment 7•1 year ago
|
||
Previously, some tests were failing because the interval function was not immediately
cleaned up when didDestroy() was called, which kept some references around and prevented
objects from being garbage collected.
I solved this by recognising that there are two ways that a promiseObserve can exit without
success: when the timeout expires, and when the CookieBannerChild is destroyed. These need
to be handled differently, so I gave each case a different AbortController.
Comment 9•1 year ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/0ce90d5b5b94
https://hg.mozilla.org/mozilla-central/rev/f566974ded62
| Assignee | ||
Updated•1 year ago
|
Description
•