Signal player gone in "pagehide" not "beforeunload"
ClosedPublic

Authored by broulik on Apr 17 2020, 7:51 PM.

Details

Summary

I don't recall if there was a particular reason for using *before* unload but this event is not emitted for iframes.
Using "pagehide" instead makes an iframe content script notice it's being destroyed (e.g. because of the overlay it was in being removed) and correctly signals the player being gone. "unload" supposedly causes the browser trouble caching the page.
We did noticed a video in an overlay being removed but not when it was inside of an iframe.

Test Plan
  • media controller hides when closing YouTube videos in overlays on websites, e.g. https://www.winhistory.de/more/nt31.htm
  • media controller hides when closing a video on tweetdeck.
  • normally navigating away from a video (not in an iframe) still signals gone

Diff Detail

Repository
R856 Plasma Browser Integration
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
broulik created this revision.Apr 17 2020, 7:51 PM
Restricted Application added a project: Plasma. · View Herald TranscriptApr 17 2020, 7:51 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik requested review of this revision.Apr 17 2020, 7:51 PM
broulik edited the test plan for this revision. (Show Details)Apr 17 2020, 7:57 PM
broulik updated this revision to Diff 81430.Apr 28 2020, 1:02 PM
broulik retitled this revision from Signal player gone in "unload" not "beforeunload" to Signal player gone in "pagehide" not "beforeunload".
broulik edited the summary of this revision. (Show Details)
fvogt accepted this revision.Apr 28 2020, 1:17 PM

Didn't test myself, but apparently you did, so LGTM.

This revision is now accepted and ready to land.Apr 28 2020, 1:17 PM
This revision was automatically updated to reflect the committed changes.