Verified Commit ad72f9a2 authored by Mike Conley's avatar Mike Conley Committed by ma1
Browse files

Bug 1880634 - Use chrome-only dispatch for the MozTogglePictureInPicture event. r=niklas

parent 3bda8ce9
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -128,7 +128,10 @@ export class ContextMenuChild extends JSWindowActorChild {
                  },
                  this.contentWindow
                );
                media.dispatchEvent(event);
                this.contentWindow.windowUtils.dispatchEventToChromeOnly(
                  media,
                  event
                );
                break;
            }
          }
+6 −3
Original line number Diff line number Diff line
@@ -182,7 +182,10 @@ export class PictureInPictureLauncherChild extends JSWindowActorChild {
          detail: { reason },
        }
      );
      video.dispatchEvent(stopPipEvent);
      this.contentWindow.windowUtils.dispatchEventToChromeOnly(
        video,
        stopPipEvent
      );
      return;
    }

@@ -673,7 +676,7 @@ export class PictureInPictureToggleChild extends JSWindowActorChild {
          detail: { reason: "urlBar" },
        }
      );
      video.dispatchEvent(pipEvent);
      this.contentWindow.windowUtils.dispatchEventToChromeOnly(video, pipEvent);
    }
  }

@@ -1066,7 +1069,7 @@ export class PictureInPictureToggleChild extends JSWindowActorChild {
        detail: { reason: "toggle" },
      }
    );
    video.dispatchEvent(pipEvent);
    this.contentWindow.windowUtils.dispatchEventToChromeOnly(video, pipEvent);

    // Since we've initiated Picture-in-Picture, we can go ahead and
    // hide the toggle now.
+12 −5
Original line number Diff line number Diff line
@@ -2,13 +2,20 @@
   http://creativecommons.org/publicdomain/zero/1.0/ */

/**
 * This helper script is used to record mouse button events for
 * Picture-in-Picture toggle click tests. Anytime the toggle is
 * clicked, we expect none of the events to be fired. Otherwise,
 * all events should be fired when clicking.
 * This helper script is used to record events for Picture-in-Picture toggle
 * click tests. Anytime the toggle is clicked, we expect none of the events to
 * be fired. Otherwise, all (except MozTogglePictureInPicture) events should be
 * fired when clicking on web content.
 */

let eventTypes = ["pointerdown", "mousedown", "pointerup", "mouseup", "click"];
let eventTypes = [
  "MozTogglePictureInPicture",
  "pointerdown",
  "mousedown",
  "pointerup",
  "mouseup",
  "click",
];

for (let event of eventTypes) {
  addEventListener(event, recordEvent, { capture: true });
+1 −1
Original line number Diff line number Diff line
@@ -139,7 +139,7 @@ async function triggerPictureInPicture(browser, videoID, triggerFn) {
      let event = new content.CustomEvent("MozTogglePictureInPicture", {
        bubbles: true,
      });
      video.dispatchEvent(event);
      content.windowUtils.dispatchEventToChromeOnly(video, event);
      await ContentTaskUtils.waitForCondition(() => {
        return video.isCloningElementVisually;
      }, "Video is being cloned visually.");