Bug 1531101 - When the PictureInPicture window closes, stop cloning immediately to update the original video UAWidget. r=Felipe
authorMike Conley <mconley@mozilla.com>
Wed, 13 Mar 2019 01:44:37 +0000
changeset 463765 9786398875b774985975d0fd4fd294d95bd52f22
parent 463764 4854148dd5340d31aa4ea700c5d31d099d46d49b
child 463766 2b58359864c3558a91e6b55e34055830fd769f5e
push id80351
push usermconley@mozilla.com
push dateWed, 13 Mar 2019 01:46:42 +0000
treeherderautoland@9786398875b7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersFelipe
bugs1531101
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1531101 - When the PictureInPicture window closes, stop cloning immediately to update the original video UAWidget. r=Felipe Differential Revision: https://phabricator.services.mozilla.com/D22165
toolkit/actors/PictureInPictureChild.jsm
--- a/toolkit/actors/PictureInPictureChild.jsm
+++ b/toolkit/actors/PictureInPictureChild.jsm
@@ -101,12 +101,16 @@ class PictureInPictureChild extends Acto
     originatingVideo.cloneElementVisually(playerVideo);
 
     let originatingWindow = originatingVideo.ownerGlobal;
     originatingWindow.addEventListener("unload", (e) => {
       this.closePictureInPicture(originatingVideo);
     }, { once: true });
 
     this.content.addEventListener("unload", () => {
+      let video = gWeakVideo && gWeakVideo.get();
+      if (video) {
+        video.stopCloningElementVisually();
+      }
       gWeakVideo = null;
     }, { once: true });
   }
 }