/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifdef MOZ_WMF_CDM_LPAC_SANDBOX # include "GMPServiceParent.h" # include "mozilla/dom/KeySystemNames.h" # include "mozilla/GeckoArgs.h" # include "mozilla/MFMediaEngineUtils.h" # include "mozilla/StaticPrefs_media.h" # include "nsIFile.h" # include "sandboxBroker.h" #endif
if (mLaunchPromiseLaunched) { return mLaunchPromise;
}
WhenProcessHandleReady()->Then(
GetCurrentSerialEventTarget(), __func__,
[this, liveToken = mLiveToken]( const ipc::ProcessHandlePromise::ResolveOrRejectValue& aResult) { if (!*liveToken) { // The UtilityProcessHost got deleted. Abort. The promise would have // already been rejected. return;
} if (mLaunchCompleted) { return;
}
mLaunchCompleted = true; if (aResult.IsReject()) {
RejectPromise(aResult.RejectValue());
} // If aResult.IsResolve() then we have succeeded in launching the // Utility process. The promise will be resolved once the channel has // connected (or failed to) later.
});
// Only clear mPrefSerializer in the success case to avoid a // possible race in the case case of a timeout on Windows launch. // See Bug 1555076 comment 7: // https://bugzilla.mozilla.org/show_bug.cgi?id=1555076#c7
mPrefSerializer = nullptr;
default:
MOZ_ASSERT(false, "Invalid SandboxingKind"); break;
} if (policy != nullptr) {
brokerFd = Some(FileDescriptor());
mSandboxBroker = SandboxBroker::Create(
std::move(policy), GetActor()->OtherPid(), brokerFd.ref()); // This is unlikely to fail and probably indicates OS resource // exhaustion, but we can at least try to recover.
Unused << NS_WARN_IF(mSandboxBroker == nullptr);
MOZ_ASSERT(brokerFd.ref().IsValid());
} #endif// XP_LINUX && MOZ_SANDBOX
RejectPromise(LaunchError("aborted by UtilityProcessHost::Shutdown"));
if (mUtilityProcessParent) {
LOGD("[%p] UtilityProcessHost::Shutdown not destroying utility process.", this);
// OnChannelClosed uses this to check if the shutdown was expected or // unexpected.
mShutdownRequested = true;
// The channel might already be closed if we got here unexpectedly. if (mUtilityProcessParent->CanSend()) {
mUtilityProcessParent->Close();
}
#ifndef NS_FREE_PERMANENT_DATA // No need to communicate shutdown, the Utility process doesn't need to // communicate anything back.
KillHard("NormalShutdown"); #endif
// If we're shutting down unexpectedly, we're in the middle of handling an // ActorDestroy for PUtilityProcessParent, which is still on the stack. // We'll return back to OnChannelClosed. // // Otherwise, we'll wait for OnChannelClose to be called whenever // PUtilityProcessParent acknowledges shutdown. return;
}
// `aReason` was not originally passed into this function; a value of 0 for // the `why` in telemetry means it's from an older build with no info
RejectPromise(
LaunchError("UtilityProcessHost::OnChannelClosed", 1 + (long)aReason));
if (!mShutdownRequested && mListener) { // This is an unclean shutdown. Notify our listener that we're going away.
mListener->OnProcessUnexpectedShutdown(this);
}
DestroyProcess();
// Release the actor.
UtilityProcessParent::Destroy(std::move(mUtilityProcessParent));
}
RefPtr<mozilla::gmp::GeckoMediaPluginServiceParent> gmps =
mozilla::gmp::GeckoMediaPluginServiceParent::GetSingleton(); if (NS_WARN_IF(!gmps)) {
WMF_LOG("Failed to get GeckoMediaPluginServiceParent!"); return;
}
if (!StaticPrefs::media_eme_widevine_experiment_enabled()) { return;
}
// If Widevine L1 is installed after the MFCDM process starts, we will set it // path later via MFCDMService::UpdateWideivineL1Path().
nsString widevineL1Path;
nsCOMPtr<nsIFile> pluginFile; if (NS_WARN_IF(NS_FAILED(gmps->FindPluginDirectoryForAPI(
nsCString(kWidevineExperimentAPIName),
{nsCString(kWidevineExperimentKeySystemName)},
getter_AddRefs(pluginFile))))) {
WMF_LOG("Widevine L1 is not installed yet"); return;
}
if (!pluginFile) {
WMF_LOG("No plugin file found!"); return;
}
if (NS_WARN_IF(NS_FAILED(pluginFile->GetTarget(widevineL1Path)))) {
WMF_LOG("Failed to get L1 path!"); return;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.