зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 4de429b6ad64 (bug 1572798) for causing browser chrome failures CLOSED TREE
This commit is contained in:
Родитель
eb8875ae13
Коммит
ebe9167de8
|
@ -7270,7 +7270,8 @@ void Document::SetScriptGlobalObject(
|
||||||
// still test false at this point and no state change will happen) or we're
|
// still test false at this point and no state change will happen) or we're
|
||||||
// doing the initial document load and don't want to fire the event for this
|
// doing the initial document load and don't want to fire the event for this
|
||||||
// change.
|
// change.
|
||||||
//
|
dom::VisibilityState oldState = mVisibilityState;
|
||||||
|
mVisibilityState = ComputeVisibilityState();
|
||||||
// When the visibility is changed, notify it to observers.
|
// When the visibility is changed, notify it to observers.
|
||||||
// Some observers need the notification, for example HTMLMediaElement uses
|
// Some observers need the notification, for example HTMLMediaElement uses
|
||||||
// it to update internal media resource allocation.
|
// it to update internal media resource allocation.
|
||||||
|
@ -7283,7 +7284,9 @@ void Document::SetScriptGlobalObject(
|
||||||
// not yet necessary. But soon after Document::SetScriptGlobalObject()
|
// not yet necessary. But soon after Document::SetScriptGlobalObject()
|
||||||
// call, the document becomes not hidden. At the time, MediaDecoder needs
|
// call, the document becomes not hidden. At the time, MediaDecoder needs
|
||||||
// to know it and needs to start updating decoding.
|
// to know it and needs to start updating decoding.
|
||||||
UpdateVisibilityState(DispatchVisibilityChange::No);
|
if (oldState != mVisibilityState) {
|
||||||
|
EnumerateActivityObservers(NotifyActivityChanged);
|
||||||
|
}
|
||||||
|
|
||||||
// The global in the template contents owner document should be the same.
|
// The global in the template contents owner document should be the same.
|
||||||
if (mTemplateContentsOwner && mTemplateContentsOwner != this) {
|
if (mTemplateContentsOwner && mTemplateContentsOwner != this) {
|
||||||
|
@ -14852,15 +14855,13 @@ void Document::UnlockPointer(Document* aDoc) {
|
||||||
asyncDispatcher->RunDOMEventWhenSafe();
|
asyncDispatcher->RunDOMEventWhenSafe();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::UpdateVisibilityState(DispatchVisibilityChange aDispatchEvent) {
|
void Document::UpdateVisibilityState() {
|
||||||
dom::VisibilityState oldState = mVisibilityState;
|
dom::VisibilityState oldState = mVisibilityState;
|
||||||
mVisibilityState = ComputeVisibilityState();
|
mVisibilityState = ComputeVisibilityState();
|
||||||
if (oldState != mVisibilityState) {
|
if (oldState != mVisibilityState) {
|
||||||
if (aDispatchEvent == DispatchVisibilityChange::Yes) {
|
|
||||||
nsContentUtils::DispatchTrustedEvent(this, ToSupports(this),
|
nsContentUtils::DispatchTrustedEvent(this, ToSupports(this),
|
||||||
u"visibilitychange"_ns,
|
u"visibilitychange"_ns,
|
||||||
CanBubble::eYes, Cancelable::eNo);
|
CanBubble::eYes, Cancelable::eNo);
|
||||||
}
|
|
||||||
EnumerateActivityObservers(NotifyActivityChanged);
|
EnumerateActivityObservers(NotifyActivityChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14886,9 +14887,9 @@ VisibilityState Document::ComputeVisibilityState() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Document::PostVisibilityUpdateEvent() {
|
void Document::PostVisibilityUpdateEvent() {
|
||||||
nsCOMPtr<nsIRunnable> event = NewRunnableMethod<DispatchVisibilityChange>(
|
nsCOMPtr<nsIRunnable> event =
|
||||||
"Document::UpdateVisibilityState", this, &Document::UpdateVisibilityState,
|
NewRunnableMethod("Document::UpdateVisibilityState", this,
|
||||||
DispatchVisibilityChange::Yes);
|
&Document::UpdateVisibilityState);
|
||||||
Dispatch(TaskCategory::Other, event.forget());
|
Dispatch(TaskCategory::Other, event.forget());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3207,11 +3207,7 @@ class Document : public nsINode,
|
||||||
|
|
||||||
// This method may fire a DOM event; if it does so it will happen
|
// This method may fire a DOM event; if it does so it will happen
|
||||||
// synchronously.
|
// synchronously.
|
||||||
//
|
void UpdateVisibilityState();
|
||||||
// Whether the event fires is controlled by the argument.
|
|
||||||
enum class DispatchVisibilityChange { No, Yes };
|
|
||||||
void UpdateVisibilityState(
|
|
||||||
DispatchVisibilityChange = DispatchVisibilityChange::Yes);
|
|
||||||
|
|
||||||
// Posts an event to call UpdateVisibilityState.
|
// Posts an event to call UpdateVisibilityState.
|
||||||
void PostVisibilityUpdateEvent();
|
void PostVisibilityUpdateEvent();
|
||||||
|
|
|
@ -47,10 +47,6 @@ skip-if = (os == "win" && processor == "aarch64") || (os == "mac") || (os == "li
|
||||||
[browser_delay_autoplay_webAudio.js]
|
[browser_delay_autoplay_webAudio.js]
|
||||||
tags = audiochannel
|
tags = audiochannel
|
||||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
||||||
[browser_bug1572798.js]
|
|
||||||
tags = audiochannel
|
|
||||||
skip-if = (os == "win" && processor == "aarch64") # aarch64 due to 1536573
|
|
||||||
support-files = file_document_open_audio.html
|
|
||||||
[browser_bug1170531.js]
|
[browser_bug1170531.js]
|
||||||
skip-if =
|
skip-if =
|
||||||
os == "linux" && !debug && !ccov # Bug 1647973
|
os == "linux" && !debug && !ccov # Bug 1647973
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
add_task(async function test_bug_1572798() {
|
|
||||||
let tab = BrowserTestUtils.addTab(window.gBrowser, "about:blank");
|
|
||||||
BrowserTestUtils.loadURI(
|
|
||||||
tab.linkedBrowser,
|
|
||||||
"https://example.com/browser/toolkit/content/tests/browser/file_document_open_audio.html"
|
|
||||||
);
|
|
||||||
await BrowserTestUtils.browserLoaded(tab.linkedBrowser);
|
|
||||||
let windowLoaded = BrowserTestUtils.waitForNewWindow();
|
|
||||||
info("- clicking button to spawn a new window -");
|
|
||||||
await ContentTask.spawn(tab.linkedBrowser, null, function() {
|
|
||||||
content.document.querySelector("button").click();
|
|
||||||
});
|
|
||||||
info("- waiting for the new window -");
|
|
||||||
let newWin = await windowLoaded;
|
|
||||||
info("- checking that the new window plays the audio -");
|
|
||||||
let documentOpenedBrowser = newWin.gBrowser.selectedBrowser;
|
|
||||||
await ContentTask.spawn(documentOpenedBrowser, null, async function() {
|
|
||||||
try {
|
|
||||||
await content.document.querySelector("audio").play();
|
|
||||||
ok(true, "Could play the audio");
|
|
||||||
} catch (e) {
|
|
||||||
ok(false, "Rejected audio promise" + e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
info("- Cleaning up -");
|
|
||||||
await BrowserTestUtils.closeWindow(newWin);
|
|
||||||
await BrowserTestUtils.removeTab(tab);
|
|
||||||
});
|
|
|
@ -1,11 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<title>Test for bug 1572798</title>
|
|
||||||
<script>
|
|
||||||
function openVideo() {
|
|
||||||
var w = window.open('', '', 'width = 640, height = 480, scrollbars=yes, menubar=no, toolbar=no, resizable=yes');
|
|
||||||
w.document.open();
|
|
||||||
w.document.write('<!DOCTYPE html><title>test popup</title><audio controls src="audio.ogg"></audio>');
|
|
||||||
w.document.close();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<button onclick="openVideo()">Open video</button>
|
|
Загрузка…
Ссылка в новой задаче