Closed Bug 1793782 Opened 2 years ago Closed 2 years ago

Cookie banner detection/clicking can fail if the banner shows up late due to slow load

Categories

(Core :: Privacy: Anti-Tracking, defect, P2)

defect

Tracking

()

RESOLVED FIXED
108 Branch
Tracking Status
firefox108 --- fixed

People

(Reporter: pbz, Assigned: pbz)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

We currently run our cookie banner detection code on DOMContentLoaded. If we can't find a visible cookie banner element at that point, we will register a MutationObserver to observe DOM changes within the next 5 seconds until giving up.
This behavior is problematic for cases where the total site load takes longer than 5 seconds and the banner shows up late, e.g. because it depends on a subresource. In this case we will fail to handle the banner.

We can address this issue by registering the MutationObserver on DOMContentLoaded and unregistering it only after the load event. That is, starting the unregister-timeout when we observe the load event.

There may still be edge cases where banner show up after our default timeout of 5 seconds, even after page load. I'm considering this out of scope for this bug.

Assignee: nobody → pbz
Status: NEW → ASSIGNED
Attachment #9298629 - Attachment description: WIP: Bug 1793782 - Extend MutationObserver lifetime to after page 'load' event. r=timhuang! → Bug 1793782 - Extend MutationObserver lifetime to after page 'load' event. r=timhuang!
Attachment #9298630 - Attachment description: WIP: Bug 1793782 - Add a test page that shows a cookie banner shortly after a slow page load. r=timhuang! → Bug 1793782 - Add a test page that shows a cookie banner shortly after a slow page load. r=timhuang!
Pushed by pzuhlcke@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a26c89a3b18d Extend MutationObserver lifetime to after page 'load' event. r=timhuang https://hg.mozilla.org/integration/autoland/rev/7f8e72f11548 Add a test page that shows a cookie banner shortly after a slow page load. r=timhuang
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 108 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: