imported mozilla upstream changes: bug1144189, bug1157986, bug1181097, bug1181735, bug1243586

This commit is contained in:
2020-03-04 13:19:40 +08:00
parent 3c1231618a
commit a54c33f93f
5 changed files with 48 additions and 9 deletions
+5
View File
@@ -120,6 +120,11 @@ public:
return mNextDriver || mPreviousDriver;
}
GraphDriver* NextDriver()
{
return mNextDriver;
}
/**
* If we are running a real time graph, get the current time stamp to schedule
* video frames. This has to be reimplemented by real time drivers.
+22 -9
View File
@@ -623,6 +623,7 @@ MediaStreamGraphImpl::UpdateStreamOrder()
if (CurrentDriver()->AsAudioCallbackDriver()->IsStarted()) {
if (mLifecycleState == LIFECYCLE_RUNNING) {
SystemClockDriver* driver = new SystemClockDriver(this);
mMixer.RemoveCallback(CurrentDriver()->AsAudioCallbackDriver());
CurrentDriver()->SwitchAtNextIteration(driver);
}
}
@@ -2357,6 +2358,7 @@ MediaStream::RunAfterPendingUpdates(nsCOMPtr<nsIRunnable> aRunnable)
// runnable will run in finite time.
if (!(graph->mRealtime || graph->mNonRealtimeProcessing)) {
aRunnable->Run();
return;
}
class Message : public ControlMessage {
@@ -3255,7 +3257,6 @@ MediaStreamGraph::NotifyWhenGraphStarted(AudioNodeStream* aStream)
}
virtual void RunDuringShutdown()
{
MOZ_ASSERT(false, "We should be reviving the graph?");
}
};
@@ -3395,15 +3396,21 @@ MediaStreamGraphImpl::ApplyAudioContextOperationImpl(AudioNodeStream* aStream,
// If we have suspended the last AudioContext, and we don't have other
// streams that have audio, this graph will automatically switch to a
// SystemCallbackDriver, because it can't find a MediaStream that has an audio
// track. When resuming, force switching to an AudioCallbackDriver. It would
// have happened at the next iteration anyways, but doing this now save
// some time.
// track. When resuming, force switching to an AudioCallbackDriver (if we're
// not already switching). It would have happened at the next iteration
// anyways, but doing this now save some time.
if (aOperation == AudioContextOperation::Resume) {
if (!CurrentDriver()->AsAudioCallbackDriver()) {
AudioCallbackDriver* driver = new AudioCallbackDriver(this);
AudioCallbackDriver* driver;
if (CurrentDriver()->Switching()) {
MOZ_ASSERT(CurrentDriver()->NextDriver()->AsAudioCallbackDriver());
driver = CurrentDriver()->NextDriver()->AsAudioCallbackDriver();
} else {
driver = new AudioCallbackDriver(this);
mMixer.AddCallback(driver);
CurrentDriver()->SwitchAtNextIteration(driver);
}
driver->EnqueueStreamAndPromiseForOperation(aStream, aPromise, aOperation);
mMixer.AddCallback(driver);
CurrentDriver()->SwitchAtNextIteration(driver);
} else {
// We are resuming a context, but we are already using an
// AudioCallbackDriver, we can resolve the promise now.
@@ -3431,8 +3438,14 @@ MediaStreamGraphImpl::ApplyAudioContextOperationImpl(AudioNodeStream* aStream,
CurrentDriver()->AsAudioCallbackDriver()->
EnqueueStreamAndPromiseForOperation(aStream, aPromise, aOperation);
SystemClockDriver* driver = new SystemClockDriver(this);
CurrentDriver()->SwitchAtNextIteration(driver);
SystemClockDriver* driver;
if (CurrentDriver()->NextDriver()) {
MOZ_ASSERT(!CurrentDriver()->NextDriver()->AsAudioCallbackDriver());
} else {
driver = new SystemClockDriver(this);
mMixer.RemoveCallback(CurrentDriver()->AsAudioCallbackDriver());
CurrentDriver()->SwitchAtNextIteration(driver);
}
} else {
// We are closing or suspending an AudioContext, but something else is
// using the audio stream, we can resolve the promise now.
@@ -0,0 +1,5 @@
<script>
var ac = new AudioContext();
ac.resume();
ac.resume();
</script>
@@ -77,6 +77,7 @@ load oscillator-ended-2.html
load 1080986.html
load 1122218.html
load 1158427.html
load audiocontext-double-suspend.html
include ../../mediasource/test/crashtests/crashtests.list
# This needs to run at the end to avoid leaking busted state into other tests.
+15
View File
@@ -270,6 +270,21 @@ nsHttpChannel::Connect()
LOG(("nsHttpChannel::Connect [this=%p]\n", this));
// Note that we are only setting the "Upgrade-Insecure-Requests" request
// header for *all* navigational requests instead of all requests as
// defined in the spec, see:
// https://www.w3.org/TR/upgrade-insecure-requests/#preference
nsContentPolicyType type = mLoadInfo ?
mLoadInfo->GetExternalContentPolicyType() :
nsIContentPolicy::TYPE_OTHER;
if (type == nsIContentPolicy::TYPE_DOCUMENT ||
type == nsIContentPolicy::TYPE_SUBDOCUMENT) {
rv = SetRequestHeader(NS_LITERAL_CSTRING("Upgrade-Insecure-Requests"),
NS_LITERAL_CSTRING("1"), false);
NS_ENSURE_SUCCESS(rv, rv);
}
// Even if we're in private browsing mode, we still enforce existing STS
// data (it is read-only).
// if the connection is not using SSL and either the exact host matches or