Bug 1543128 - Fire UAWidgetSetupOrChange for the no-controls <video> case on Desktop. r=jya

The Picture-in-Picture toggle buttons are now part of the video controls UAWidget
bindings, so we need to construct a UAWidget for the no-controls case for Desktop
to make that toggle available.

Up until now, we've never needed a no-controls UAWidget for Desktop, since we
never needed to show UI in that case.

Depends on D26809

Differential Revision: https://phabricator.services.mozilla.com/D26803

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mike Conley 2019-04-15 01:08:32 +00:00
Родитель 189f9c4505
Коммит f957ebe843
3 изменённых файлов: 14 добавлений и 14 удалений

Просмотреть файл

@ -4097,19 +4097,7 @@ nsresult HTMLMediaElement::BindToTree(Document* aDocument, nsIContent* aParent,
if (IsInComposedDoc()) {
// Construct Shadow Root so web content can be hidden in the DOM.
AttachAndSetUAShadowRoot();
#ifdef ANDROID
NotifyUAWidgetSetupOrChange();
#else
// We don't want to call into JS if the website never asks for native
// video controls.
// If controls attribute is set later, controls is constructed lazily
// with the UAWidgetAttributeChanged event.
// This only applies to Desktop because on Fennec we would need to show
// an UI if the video is blocked.
if (Controls()) {
NotifyUAWidgetSetupOrChange();
}
#endif
}
mUnboundFromTree = false;

Просмотреть файл

@ -56,7 +56,11 @@ add_task(async () => {
suspendTimerFired = true;
}
originalVideo.addEventListener("mozstartvideosuspendtimer", listener);
originalVideo.setVisible(false);
// Have to do this to access normally-preffed off binding methods for some
// reason.
// See bug 1544257.
SpecialPowers.wrap(originalVideo).setVisible(false);
await waitForEventOnce(originalVideo, "ended");
@ -65,7 +69,10 @@ add_task(async () => {
ok(!suspendTimerFired,
"mozstartvideosuspendtimer should not have fired.");
originalVideo.setVisible(true);
// Have to do this to access normally-preffed off binding methods for some
// reason.
// See bug 1544257.
SpecialPowers.wrap(originalVideo).setVisible(true);
});
await originalVideo.play();

Просмотреть файл

@ -30,6 +30,11 @@
info(`Found ${audioDevices.length} output devices`);
ok(audioDevices.length > 0, "More than one output device found");
// Have to do this to access normally-preffed off binding methods for some
// reason.
// See bug 1544257.
let audio = SpecialPowers.wrap(audio);
is(audio.sinkId, "", "Initial value is empty string");
const p = audio.setSinkId(audioDevices[0].deviceId);