Closed Bug 1551570 Opened 5 months ago Closed 5 months ago

Picture-in-Picture player window is playing fast and loose with its closing behaviour

Categories

(Toolkit :: Video/Audio Controls, defect, P1)

68 Branch
defect

Tracking

()

VERIFIED FIXED
mozilla68
Tracking Status
firefox68 --- verified

People

(Reporter: mconley, Assigned: mconley)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

The Picture-in-Picture player window is managed by PictureInPicture.jsm, and when that player window closes for various reasons, we expect to be able to do some clean-up (right now, we clear some state variables, but in the future, we also want to remove an icon from the tab where the PiP'd video was in bug 1528459).

There are a few problems, however:

  1. We're waiting for an "unload" event from a <xul:browser> instead of the window itself. This should be:
window.addEventListener("unload", () => {
  PictureInPicture.unload();
});
  1. There are situations where we'll manipulate the variables that PictureInPicture.unload relies upon / clears before the unload event even fires.

Specifically, we overwrite this.browser, and then call closePipWindow, which will clear that new value (expecting to clear the original value) when the unload event fires if a previous window existed.

I recommend making closePipWindow an async function that waits until the window has unloaded before continuing.

Pushed by mconley@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c9f22236d5a5
Ensure Picture-in-Picture player window is closed before updating internal state. r=JSON_voorhees
Status: NEW → RESOLVED
Closed: 5 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
Flags: qe-verify+

Build ID 20190626093633
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:69.0) Gecko/20100101 Firefox/69.0

Verified as fixed on the latest Nightly build on Windows 10.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.