Skip to content

Commit

Permalink
Backed out changeset 3336c8e9a43f (bug 1756518) for causing build bus…
Browse files Browse the repository at this point in the history
…tages at Unified_cpp_xre_dllservices. CLOSED TREE
  • Loading branch information
Butkovits Atila committed Mar 4, 2022
1 parent 02023dd commit 2fa3391
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 221 deletions.
9 changes: 0 additions & 9 deletions browser/components/BrowserGlue.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -2766,15 +2766,6 @@ BrowserGlue.prototype = {
},
},

{
task: () => {
Services.obs.notifyObservers(
null,
"unblock-untrusted-modules-thread"
);
},
},

// WebDriver components (Remote Agent and Marionette) need to be
// initialized as very last step.
{
Expand Down
19 changes: 4 additions & 15 deletions dom/ipc/ContentChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -676,8 +676,7 @@ mozilla::ipc::IPCResult ContentChild::RecvSetXPCOMProcessAttributes(
FullLookAndFeel&& aLookAndFeelData, dom::SystemFontList&& aFontList,
Maybe<SharedMemoryHandle>&& aSharedUASheetHandle,
const uintptr_t& aSharedUASheetAddress,
nsTArray<SharedMemoryHandle>&& aSharedFontListBlocks,
const bool& aIsReadyForBackgroundProcessing) {
nsTArray<SharedMemoryHandle>&& aSharedFontListBlocks) {
if (!sShutdownCanary) {
return IPC_OK();
}
Expand All @@ -692,8 +691,7 @@ mozilla::ipc::IPCResult ContentChild::RecvSetXPCOMProcessAttributes(

gfx::gfxVars::SetValuesForInitialize(aXPCOMInit.gfxNonDefaultVarUpdates());
InitSharedUASheets(std::move(aSharedUASheetHandle), aSharedUASheetAddress);
InitXPCOM(std::move(aXPCOMInit), aInitialData,
aIsReadyForBackgroundProcessing);
InitXPCOM(std::move(aXPCOMInit), aInitialData);
InitGraphicsDeviceData(aXPCOMInit.contentDeviceData());

return IPC_OK();
Expand Down Expand Up @@ -1325,8 +1323,7 @@ void ContentChild::InitSharedUASheets(Maybe<SharedMemoryHandle>&& aHandle,

void ContentChild::InitXPCOM(
XPCOMInitData&& aXPCOMInit,
const mozilla::dom::ipc::StructuredCloneData& aInitialData,
bool aIsReadyForBackgroundProcessing) {
const mozilla::dom::ipc::StructuredCloneData& aInitialData) {
#ifdef MOZ_WIDGET_GTK
// LookAndFeel::NativeInit takes a long time to run on Linux, here we schedule
// it as soon as possible after BackgroundChild::Startup to give
Expand All @@ -1339,7 +1336,7 @@ void ContentChild::InitXPCOM(
// DLL services untrusted modules processing depends on
// BackgroundChild::Startup having been called
RefPtr<DllServices> dllSvc(DllServices::Get());
dllSvc->StartUntrustedModulesProcessor(aIsReadyForBackgroundProcessing);
dllSvc->StartUntrustedModulesProcessor();
#endif // defined(XP_WIN)

PBackgroundChild* actorChild = BackgroundChild::GetOrCreateForCurrentThread();
Expand Down Expand Up @@ -1466,14 +1463,6 @@ mozilla::ipc::IPCResult ContentChild::RecvGetUntrustedModulesData(
[aResolver](nsresult aReason) { aResolver(Nothing()); });
return IPC_OK();
}

mozilla::ipc::IPCResult ContentChild::RecvUnblockUntrustedModulesThread() {
if (nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService()) {
obs->NotifyObservers(nullptr, "unblock-untrusted-modules-thread", nullptr);
}
return IPC_OK();
}
#endif // defined(XP_WIN)

PCycleCollectWithLogsChild* ContentChild::AllocPCycleCollectWithLogsChild(
Expand Down
7 changes: 2 additions & 5 deletions dom/ipc/ContentChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ class ContentChild final : public PContentChild,
bool aIsForBrowser);

void InitXPCOM(XPCOMInitData&& aXPCOMInit,
const mozilla::dom::ipc::StructuredCloneData& aInitialData,
bool aIsReadyForBackgroundProcessing);
const mozilla::dom::ipc::StructuredCloneData& aInitialData);

void InitSharedUASheets(Maybe<base::SharedMemoryHandle>&& aHandle,
uintptr_t aAddress);
Expand Down Expand Up @@ -539,16 +538,14 @@ class ContentChild final : public PContentChild,
#if defined(XP_WIN)
mozilla::ipc::IPCResult RecvGetUntrustedModulesData(
GetUntrustedModulesDataResolver&& aResolver);
mozilla::ipc::IPCResult RecvUnblockUntrustedModulesThread();
#endif // defined(XP_WIN)

mozilla::ipc::IPCResult RecvSetXPCOMProcessAttributes(
XPCOMInitData&& aXPCOMInit, const StructuredCloneData& aInitialData,
FullLookAndFeel&& aLookAndFeelData, SystemFontList&& aFontList,
Maybe<base::SharedMemoryHandle>&& aSharedUASheetHandle,
const uintptr_t& aSharedUASheetAddress,
nsTArray<base::SharedMemoryHandle>&& aSharedFontListBlocks,
const bool& aIsReadyForBackgroundProcessing);
nsTArray<base::SharedMemoryHandle>&& aSharedFontListBlocks);

mozilla::ipc::IPCResult RecvProvideAnonymousTemporaryFile(
const uint64_t& aID, const FileDescOrError& aFD);
Expand Down
9 changes: 1 addition & 8 deletions dom/ipc/ContentParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2990,16 +2990,9 @@ bool ContentParent::InitInternal(ProcessPriority aInitialPriority) {
sharedUASheetAddress = 0;
}

bool isReadyForBackgroundProcessing = false;
#if defined(XP_WIN)
RefPtr<DllServices> dllSvc(DllServices::Get());
isReadyForBackgroundProcessing = dllSvc->IsReadyForBackgroundProcessing();
#endif

Unused << SendSetXPCOMProcessAttributes(
xpcomInit, initialData, lnf, fontList, std::move(sharedUASheetHandle),
sharedUASheetAddress, std::move(sharedFontListBlocks),
isReadyForBackgroundProcessing);
sharedUASheetAddress, std::move(sharedFontListBlocks));

ipc::WritableSharedMap* sharedData =
nsFrameMessageManager::sParentProcessManager->SharedData();
Expand Down
10 changes: 1 addition & 9 deletions dom/ipc/PContent.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -580,13 +580,6 @@ child:
* to pull data from content processes.
*/
async GetUntrustedModulesData() returns (UntrustedModulesData? data);

/**
* This method is used to notifty a child process to start
* processing module loading events in UntrustedModulesProcessor.
* This should be called when the parent process has gone idle.
*/
async UnblockUntrustedModulesThread();
#endif // defined(XP_WIN)

/**
Expand Down Expand Up @@ -757,8 +750,7 @@ child:
SystemFontList systemFontList,
SharedMemoryHandle? sharedUASheetHandle,
uintptr_t sharedUASheetAddress,
SharedMemoryHandle[] sharedFontListBlocks,
bool aIsStartingUp);
SharedMemoryHandle[] sharedFontListBlocks);

// Notify child that last-pb-context-exited notification was observed
async LastPrivateDocShellDestroyed();
Expand Down
10 changes: 1 addition & 9 deletions dom/media/ipc/PRDD.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ protocol PRDD
parent:

async Init(GfxVarUpdate[] vars, FileDescriptor? sandboxBroker,
bool canRecordReleaseTelemetry,
bool aIsReadyForBackgroundProcessing);
bool canRecordReleaseTelemetry);

async InitProfiler(Endpoint<PProfilerChild> endpoint);

Expand All @@ -62,13 +61,6 @@ parent:

#if defined(XP_WIN)
async GetUntrustedModulesData() returns (UntrustedModulesData? data);

/**
* This method is used to notifty a child process to start
* processing module loading events in UntrustedModulesProcessor.
* This should be called when the parent process has gone idle.
*/
async UnblockUntrustedModulesThread();
#endif // defined(XP_WIN)

#if defined(MOZ_SANDBOX) && defined(MOZ_DEBUG) && defined(ENABLE_TESTS)
Expand Down
9 changes: 1 addition & 8 deletions dom/media/ipc/RDDChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,7 @@ bool RDDChild::Init() {

nsTArray<GfxVarUpdate> updates = gfxVars::FetchNonDefaultVars();

bool isReadyForBackgroundProcessing = false;
#if defined(XP_WIN)
RefPtr<DllServices> dllSvc(DllServices::Get());
isReadyForBackgroundProcessing = dllSvc->IsReadyForBackgroundProcessing();
#endif

SendInit(updates, brokerFd, Telemetry::CanRecordReleaseData(),
isReadyForBackgroundProcessing);
SendInit(updates, brokerFd, Telemetry::CanRecordReleaseData());

Unused << SendInitProfiler(ProfilerParent::CreateForProcess(OtherPid()));

Expand Down
13 changes: 2 additions & 11 deletions dom/media/ipc/RDDParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,7 @@ void CGSShutdownServerConnections();

mozilla::ipc::IPCResult RDDParent::RecvInit(
nsTArray<GfxVarUpdate>&& vars, const Maybe<FileDescriptor>& aBrokerFd,
const bool& aCanRecordReleaseTelemetry,
const bool& aIsReadyForBackgroundProcessing) {
const bool& aCanRecordReleaseTelemetry) {
for (const auto& var : vars) {
gfxVars::ApplyUpdate(var);
}
Expand All @@ -152,7 +151,7 @@ mozilla::ipc::IPCResult RDDParent::RecvInit(
#if defined(XP_WIN)
if (aCanRecordReleaseTelemetry) {
RefPtr<DllServices> dllSvc(DllServices::Get());
dllSvc->StartUntrustedModulesProcessor(aIsReadyForBackgroundProcessing);
dllSvc->StartUntrustedModulesProcessor();
}
#endif // defined(XP_WIN)
return IPC_OK();
Expand Down Expand Up @@ -248,14 +247,6 @@ mozilla::ipc::IPCResult RDDParent::RecvGetUntrustedModulesData(
[aResolver](nsresult aReason) { aResolver(Nothing()); });
return IPC_OK();
}

mozilla::ipc::IPCResult RDDParent::RecvUnblockUntrustedModulesThread() {
if (nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService()) {
obs->NotifyObservers(nullptr, "unblock-untrusted-modules-thread", nullptr);
}
return IPC_OK();
}
#endif // defined(XP_WIN)

mozilla::ipc::IPCResult RDDParent::RecvPreferenceUpdate(const Pref& aPref) {
Expand Down
4 changes: 1 addition & 3 deletions dom/media/ipc/RDDParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ class RDDParent final : public PRDDParent {

mozilla::ipc::IPCResult RecvInit(nsTArray<GfxVarUpdate>&& vars,
const Maybe<ipc::FileDescriptor>& aBrokerFd,
const bool& aCanRecordReleaseTelemetry,
const bool& aIsReadyForBackgroundProcessing);
const bool& aCanRecordReleaseTelemetry);
mozilla::ipc::IPCResult RecvInitProfiler(
Endpoint<PProfilerChild>&& aEndpoint);

Expand All @@ -48,7 +47,6 @@ class RDDParent final : public PRDDParent {
#if defined(XP_WIN)
mozilla::ipc::IPCResult RecvGetUntrustedModulesData(
GetUntrustedModulesDataResolver&& aResolver);
mozilla::ipc::IPCResult RecvUnblockUntrustedModulesThread();
#endif // defined(XP_WIN)
mozilla::ipc::IPCResult RecvPreferenceUpdate(const Pref& pref);
mozilla::ipc::IPCResult RecvUpdateVar(const GfxVarUpdate& pref);
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/UtilityProcessChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ mozilla::ipc::IPCResult UtilityProcessChild::RecvInit(
#if defined(XP_WIN)
if (aCanRecordReleaseTelemetry) {
RefPtr<DllServices> dllSvc(DllServices::Get());
dllSvc->StartUntrustedModulesProcessor(false);
dllSvc->StartUntrustedModulesProcessor();
}
#endif // defined(XP_WIN)
return IPC_OK();
Expand Down
2 changes: 1 addition & 1 deletion js/xpconnect/src/XPCShellImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1318,7 +1318,7 @@ int XRE_XPCShellMain(int argc, char** argv, char** envp,

// Ensure that DLL Services are running
RefPtr<DllServices> dllSvc(DllServices::Get());
dllSvc->StartUntrustedModulesProcessor(true);
dllSvc->StartUntrustedModulesProcessor();
auto dllServicesDisable =
MakeScopeExit([&dllSvc]() { dllSvc->DisableFull(); });

Expand Down
10 changes: 0 additions & 10 deletions netwerk/ipc/PSocketProcess.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,6 @@ struct SocketPorcessInitAttributes {
bool mOffline;
bool mConnectivity;
bool mInitSandbox;
#if defined(XP_WIN)
bool mIsReadyForBackgroundProcessing;
#endif
FileDescriptor? mSandboxBroker;
};

Expand Down Expand Up @@ -225,13 +222,6 @@ child:

#if defined(XP_WIN)
async GetUntrustedModulesData() returns (UntrustedModulesData? data);

/**
* This method is used to notifty a child process to start
* processing module loading events in UntrustedModulesProcessor.
* This should be called when the parent process has gone idle.
*/
async UnblockUntrustedModulesThread();
#endif // defined(XP_WIN)

both:
Expand Down
20 changes: 5 additions & 15 deletions netwerk/ipc/SocketProcessChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,11 @@ bool SocketProcessChild::Init(base::ProcessId aParentPid,
return false;
}

#if defined(XP_WIN)
RefPtr<DllServices> dllSvc(DllServices::Get());
dllSvc->StartUntrustedModulesProcessor();
#endif // defined(XP_WIN)

return true;
}

Expand Down Expand Up @@ -223,12 +228,6 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvInit(
Unused << RecvInitLinuxSandbox(aAttributes.mSandboxBroker());
}

#if defined(XP_WIN)
RefPtr<DllServices> dllSvc(DllServices::Get());
dllSvc->StartUntrustedModulesProcessor(
aAttributes.mIsReadyForBackgroundProcessing());
#endif // defined(XP_WIN)

return IPC_OK();
}

Expand Down Expand Up @@ -741,15 +740,6 @@ mozilla::ipc::IPCResult SocketProcessChild::RecvGetUntrustedModulesData(
[aResolver](nsresult aReason) { aResolver(Nothing()); });
return IPC_OK();
}

mozilla::ipc::IPCResult
SocketProcessChild::RecvUnblockUntrustedModulesThread() {
if (nsCOMPtr<nsIObserverService> obs =
mozilla::services::GetObserverService()) {
obs->NotifyObservers(nullptr, "unblock-untrusted-modules-thread", nullptr);
}
return IPC_OK();
}
#endif // defined(XP_WIN)

} // namespace net
Expand Down
1 change: 0 additions & 1 deletion netwerk/ipc/SocketProcessChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ class SocketProcessChild final
#if defined(XP_WIN)
mozilla::ipc::IPCResult RecvGetUntrustedModulesData(
GetUntrustedModulesDataResolver&& aResolver);
mozilla::ipc::IPCResult RecvUnblockUntrustedModulesThread();
#endif // defined(XP_WIN)

protected:
Expand Down
6 changes: 0 additions & 6 deletions netwerk/ipc/SocketProcessHost.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,12 +176,6 @@ void SocketProcessHost::InitAfterConnect(bool aSucceeded) {

attributes.mInitSandbox() = false;

#if defined(XP_WIN)
RefPtr<DllServices> dllSvc(DllServices::Get());
attributes.mIsReadyForBackgroundProcessing() =
dllSvc->IsReadyForBackgroundProcessing();
#endif

#if defined(XP_LINUX) && defined(MOZ_SANDBOX)
if (GetEffectiveSocketProcessSandboxLevel() > 0) {
auto policy = SandboxBrokerPolicyFactory::GetSocketProcessPolicy(
Expand Down
2 changes: 0 additions & 2 deletions toolkit/xre/dllservices/UntrustedModulesData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ ModuleRecord::ModuleRecord(const nsAString& aResolvedNtPath)
}

MOZ_ASSERT(XRE_IsParentProcess());
AUTO_PROFILER_MARKER_TEXT("ModuleRecord", OTHER, {},
NS_ConvertUTF16toUTF8(aResolvedNtPath));

nsAutoString resolvedDosPath;
if (!NtPathToDosPath(aResolvedNtPath, resolvedDosPath)) {
Expand Down
Loading

0 comments on commit 2fa3391

Please sign in to comment.