Closed Bug 1823670 Opened 1 year ago Closed 1 year ago

MessageHandler modules can still emit events for pages in BFCache

Categories

(Remote Protocol :: Agent, defect, P1)

defect
Points:
1

Tracking

(firefox113 fixed)

RESOLVED FIXED
113 Branch
Tracking Status
firefox113 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

Details

(Whiteboard: [webdriver:m6])

Attachments

(1 file)

Spotted while working on Bug 1822772.

We don't destroy MessageHandlers when a page is moved to BFCache, because the corresponding JSWindowActor is not destroyed. We didn't spot any issue with this earlier because:

  • the MessageHandlerRegistry was still only keeping one MessageHandler per session id, meaning it was "forgetting" about the MessageHandler moved in BFCache
  • broadcast from the parent process explicitly select compatible browsing contexts and therefore don't try to target contexts in BFCache
  • all our content process events were no longer emitted when the corresponding page was moved in BFCache

But since we started using the ChromeEventHandler to monitor load and DOMContentLoaded events, on non-fission the "bfcached" message handlers would still emit events for the "live" pages, resulting in duplicated events.

We should destroy MessageHandlers when their corresponding page is persisted in bfcache (this can either be done by the registry or by monitoring pagehide), and we should reinstantiate them when the page is taken from the bfcache (pageshow event)

Points: --- → 1
Whiteboard: [webdriver:m6]
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c21b16c9c0d3
[messagehandler] Destroy MessageHandlers when pages move to BFCache r=webdriver-reviewers,whimboo
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 113 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: