diff --git a/toolkit/content/tests/widgets/mochitest.ini b/toolkit/content/tests/widgets/mochitest.ini index a78cbac92788..8aa19df966e7 100644 --- a/toolkit/content/tests/widgets/mochitest.ini +++ b/toolkit/content/tests/widgets/mochitest.ini @@ -25,6 +25,7 @@ support-files = videomask.css [test_audiocontrols_dimensions.html] +[test_audiocontrols_fullscreen.html] [test_mousecapture_area.html] [test_ua_widget_sandbox.html] [test_ua_widget_unbind.html] diff --git a/toolkit/content/tests/widgets/test_audiocontrols_fullscreen.html b/toolkit/content/tests/widgets/test_audiocontrols_fullscreen.html new file mode 100644 index 000000000000..6963c3da1e23 --- /dev/null +++ b/toolkit/content/tests/widgets/test_audiocontrols_fullscreen.html @@ -0,0 +1,61 @@ + + + + Audio controls test + + + + + + +

+ +
+ +
+ +
+
+
+ + diff --git a/toolkit/content/tests/widgets/test_videocontrols_audio.html b/toolkit/content/tests/widgets/test_videocontrols_audio.html index d953e4ae74e4..491c59717493 100644 --- a/toolkit/content/tests/widgets/test_videocontrols_audio.html +++ b/toolkit/content/tests/widgets/test_videocontrols_audio.html @@ -29,7 +29,7 @@ let children = InspectorUtils.getChildrenForNode(element, true); for (let child of children) { - var result = findElementByAttribute(child, aName, aValue); + const result = findElementByAttribute(child, aName, aValue); if (result) { return result; } @@ -38,36 +38,9 @@ } function loadedmetadata(event) { - SimpleTest.requestCompleteLog(); - SimpleTest.executeSoon(async function test_fullscreen_unavailable() { - const { x, y } = video.getBoundingClientRect(); + SimpleTest.executeSoon(function() { const controlBar = findElementByAttribute(video, "class", "controlBar"); - SimpleTest.requestFlakyTimeout("Waiting to ensure that fullscreen event does not fire"); - const endedPromise = new Promise(resolve => { - video.addEventListener("ended", () => { - info('Video ended event fired!'); - resolve(); - }, { once: true }); - setTimeout( () => { - info('Video ran out of time before ended event fired!'); - resolve(); - }, video.duration * 1000); - }); - let noFullscreenEvent = true; is(controlBar.getAttribute("fullscreen-unavailable"), "true", "Fullscreen button is hidden"); - document.addEventListener("mozfullscreenchange", () => { - noFullscreenEvent = false; - }, { once: true }); - info("Simulate double click on media player."); - synthesizeMouse(video, x, y, { clickCount: 2 }); - info("Waiting for video to end..."); - await endedPromise; - // By this point, if the double click was going to trigger fullscreen then - // it should have happened by now. - ok( - noFullscreenEvent, - "Double clicking should not trigger fullscreen event" - ); SimpleTest.finish(); }); } diff --git a/toolkit/content/widgets/videocontrols.js b/toolkit/content/widgets/videocontrols.js index 9bbce74249c4..547929027f21 100644 --- a/toolkit/content/widgets/videocontrols.js +++ b/toolkit/content/widgets/videocontrols.js @@ -299,6 +299,10 @@ this.VideoControlsImplWidget = class { isPausedByDragging: false, _isAudioOnly: false, + get isAudioTag() { + return this.video.localName == "audio"; + }, + get isAudioOnly() { return this._isAudioOnly; }, @@ -788,7 +792,7 @@ this.VideoControlsImplWidget = class { this.controlsSpacer.removeAttribute("aria-label"); this.statusOverlay.removeAttribute("status"); this.statusIcon.setAttribute("type", "throbber"); - this.isAudioOnly = this.video.localName == "audio"; + this.isAudioOnly = this.isAudioTag; this.setPlayButtonState(true); this.setupNewLoadState(); this.setupStatusFader(); @@ -1706,7 +1710,7 @@ this.VideoControlsImplWidget = class { toggleFullscreen() { // audio tags cannot toggle fullscreen - if (!this.isAudioOnly) { + if (!this.isAudioTag) { this.isVideoInFullScreen ? this.document.exitFullscreen() : this.video.requestFullscreen(); @@ -2436,7 +2440,7 @@ this.VideoControlsImplWidget = class { // Since the size of videocontrols is expanded with controlBar in