diff --git a/toolkit/components/pictureinpicture/content/player.js b/toolkit/components/pictureinpicture/content/player.js index 5c6c9b1ca0e3..4b4bd0f65eb7 100644 --- a/toolkit/components/pictureinpicture/content/player.js +++ b/toolkit/components/pictureinpicture/content/player.js @@ -65,7 +65,6 @@ let Player = { WINDOW_EVENTS: [ "click", "contextmenu", - "dblclick", "keydown", "mouseout", "resize", @@ -172,11 +171,6 @@ let Player = { break; } - case "dblclick": { - this.onDblClick(event); - break; - } - case "keydown": { if (event.keyCode == KeyEvent.DOM_VK_TAB) { this.controls.setAttribute("keying", true); @@ -185,10 +179,6 @@ let Player = { this.controls.hasAttribute("keying") ) { this.controls.removeAttribute("keying"); - - // We preventDefault to avoid exiting fullscreen if we happen - // to be in it. - event.preventDefault(); } else if ( Services.prefs.getBoolPref(KEYBOARD_CONTROLS_ENABLED_PREF, false) && !this.controls.hasAttribute("keying") && @@ -225,17 +215,6 @@ let Player = { } }, - onDblClick(event) { - if (event.target.id == "controls") { - if (document.fullscreenElement == document.body) { - document.exitFullscreen(); - } else { - document.body.requestFullscreen(); - } - event.preventDefault(); - } - }, - onClick(event) { switch (event.target.id) { case "audio": { diff --git a/toolkit/components/pictureinpicture/tests/browser.ini b/toolkit/components/pictureinpicture/tests/browser.ini index 750f2dd59fc0..7f88cf4a227d 100644 --- a/toolkit/components/pictureinpicture/tests/browser.ini +++ b/toolkit/components/pictureinpicture/tests/browser.ini @@ -23,7 +23,6 @@ prefs = [browser_contextMenu.js] [browser_closePlayer.js] [browser_closeTab.js] -[browser_dblclickFullscreen.js] [browser_disabledForMediaStreamVideos.js] [browser_fullscreen.js] skip-if = (os == "mac" && debug) #Bug 1566173 diff --git a/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js b/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js deleted file mode 100644 index 60053da21acc..000000000000 --- a/toolkit/components/pictureinpicture/tests/browser_dblclickFullscreen.js +++ /dev/null @@ -1,124 +0,0 @@ -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -"use strict"; - -/** - * Tests that double-clicking on the Picture-in-Picture player window - * causes it to fullscreen, and that pressing Escape allows us to exit - * fullscreen. - */ -add_task(async () => { - await BrowserTestUtils.withNewTab( - { - gBrowser, - url: TEST_PAGE, - }, - async browser => { - let pipWin = await triggerPictureInPicture(browser, "no-controls"); - - let entered = BrowserTestUtils.waitForEvent( - pipWin, - "MozDOMFullscreen:Entered" - ); - - let controls = pipWin.document.getElementById("controls"); - - EventUtils.sendMouseEvent( - { - type: "dblclick", - }, - controls, - pipWin - ); - - await entered; - - Assert.equal( - pipWin.document.fullscreenElement, - pipWin.document.body, - "Double-click caused us to enter fullscreen." - ); - - await BrowserTestUtils.waitForCondition(() => { - return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS"); - }); - - // First, we'll test exiting fullscreen by double-clicking again - // on the document body. - - let exited = BrowserTestUtils.waitForEvent( - pipWin, - "MozDOMFullscreen:Exited" - ); - - EventUtils.sendMouseEvent( - { - type: "dblclick", - }, - controls, - pipWin - ); - - await exited; - - Assert.ok( - !pipWin.document.fullscreenElement, - "Double-click caused us to exit fullscreen." - ); - - await BrowserTestUtils.waitForCondition(() => { - return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS"); - }); - - // Now we double-click to re-enter fullscreen. - - entered = BrowserTestUtils.waitForEvent( - pipWin, - "MozDOMFullscreen:Entered" - ); - - EventUtils.sendMouseEvent( - { - type: "dblclick", - }, - controls, - pipWin - ); - - await entered; - - Assert.equal( - pipWin.document.fullscreenElement, - pipWin.document.body, - "Double-click caused us to re-enter fullscreen." - ); - - await BrowserTestUtils.waitForCondition(() => { - return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS"); - }); - - // Finally, we check that hitting Escape lets the user leave - // fullscreen. - - exited = BrowserTestUtils.waitForEvent(pipWin, "MozDOMFullscreen:Exited"); - - EventUtils.synthesizeKey("KEY_Escape", {}, pipWin); - - await exited; - - Assert.ok( - !pipWin.document.fullscreenElement, - "Pressing Escape caused us to exit fullscreen." - ); - - await BrowserTestUtils.waitForCondition(() => { - return !TelemetryStopwatch.running("FULLSCREEN_CHANGE_MS"); - }); - - let pipClosed = BrowserTestUtils.domWindowClosed(pipWin); - pipWin.close(); - await pipClosed; - } - ); -});