Backed out changeset e9d8a75a0dcc (bug 1303096) for failing various tests on Android 4.3 debug (e.g. test_saveHeapSnapshot_e10s_01.html). r=backout

This commit is contained in:
Sebastian Hengst 2017-02-05 10:26:28 +01:00
Родитель a609ae147a
Коммит 122ebc553b
25 изменённых файлов: 295 добавлений и 735 удалений

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

@ -139,7 +139,7 @@ CopyURIs(const InfallibleTArray<URIParams>& aDomains, nsIDomainSet* aSet)
} }
void void
DomainPolicy::ApplyClone(const DomainPolicyClone* aClone) DomainPolicy::ApplyClone(DomainPolicyClone* aClone)
{ {
CopyURIs(aClone->blacklist(), mBlacklist); CopyURIs(aClone->blacklist(), mBlacklist);
CopyURIs(aClone->whitelist(), mWhitelist); CopyURIs(aClone->whitelist(), mWhitelist);

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

@ -17,7 +17,6 @@ class DomainPolicyClone;
%} %}
[ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone); [ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone);
[ptr] native DomainPolicyCloneConstPtr(const mozilla::dom::DomainPolicyClone);
/* /*
* When a domain policy is instantiated by invoking activateDomainPolicy() on * When a domain policy is instantiated by invoking activateDomainPolicy() on
@ -42,7 +41,7 @@ interface nsIDomainPolicy : nsISupports
void deactivate(); void deactivate();
[noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone); [noscript, notxpcom] void cloneDomainPolicy(in DomainPolicyClonePtr aClone);
[noscript, notxpcom] void applyClone(in DomainPolicyCloneConstPtr aClone); [noscript, notxpcom] void applyClone(in DomainPolicyClonePtr aClone);
}; };
[scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)] [scriptable, builtinclass, uuid(665c981b-0a0f-4229-ac06-a826e02d4f69)]

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

@ -502,24 +502,10 @@ NS_INTERFACE_MAP_BEGIN(ContentChild)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentChild) NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentChild)
NS_INTERFACE_MAP_END NS_INTERFACE_MAP_END
mozilla::ipc::IPCResult
ContentChild::RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit,
const StructuredCloneData& aInitialData,
nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache)
{
mLookAndFeelCache = aLookAndFeelIntCache;
InitXPCOM(aXPCOMInit, aInitialData);
InitGraphicsDeviceData();
return IPC_OK();
}
bool bool
ContentChild::Init(MessageLoop* aIOLoop, ContentChild::Init(MessageLoop* aIOLoop,
base::ProcessId aParentPid, base::ProcessId aParentPid,
IPC::Channel* aChannel, IPC::Channel* aChannel)
uint64_t aChildID,
bool aIsForBrowser)
{ {
#ifdef MOZ_WIDGET_GTK #ifdef MOZ_WIDGET_GTK
// We need to pass a display down to gtk_init because it's not going to // We need to pass a display down to gtk_init because it's not going to
@ -585,8 +571,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
XRE_GetProcessType()); XRE_GetProcessType());
#endif #endif
mID = aChildID; SendGetProcessAttributes(&mID, &mIsForBrowser);
mIsForBrowser = aIsForBrowser;
#ifdef NS_PRINTING #ifdef NS_PRINTING
// Force the creation of the nsPrintingProxy so that it's IPC counterpart, // Force the creation of the nsPrintingProxy so that it's IPC counterpart,
@ -948,14 +933,8 @@ ContentChild::InitGraphicsDeviceData()
} }
void void
ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit, ContentChild::InitXPCOM()
const mozilla::dom::ipc::StructuredCloneData& aInitialData)
{ {
SET_PREF_PHASE(pref_initPhase::BEGIN_ALL_PREFS);
for (unsigned int i = 0; i < aXPCOMInit.prefs().Length(); i++) {
Preferences::SetPreference(aXPCOMInit.prefs().ElementAt(i));
}
SET_PREF_PHASE(pref_initPhase::END_ALL_PREFS);
// Do this as early as possible to get the parent process to initialize the // Do this as early as possible to get the parent process to initialize the
// background thread since we'll likely need database information very soon. // background thread since we'll likely need database information very soon.
BackgroundChild::Startup(); BackgroundChild::Startup();
@ -978,29 +957,42 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
if (NS_FAILED(svc->RegisterListener(mConsoleListener))) if (NS_FAILED(svc->RegisterListener(mConsoleListener)))
NS_WARNING("Couldn't register console listener for child process"); NS_WARNING("Couldn't register console listener for child process");
mAvailableDictionaries = aXPCOMInit.dictionaries(); bool isOffline, isLangRTL, haveBidiKeyboards;
bool isConnected;
int32_t captivePortalState;
ClipboardCapabilities clipboardCaps;
DomainPolicyClone domainPolicy;
StructuredCloneData initialData;
OptionalURIParams userContentSheetURL;
RecvSetOffline(aXPCOMInit.isOffline()); SendGetXPCOMProcessAttributes(&isOffline, &isConnected, &captivePortalState,
RecvSetConnectivity(aXPCOMInit.isConnected()); &isLangRTL, &haveBidiKeyboards,
RecvSetCaptivePortalState(aXPCOMInit.captivePortalState()); &mAvailableDictionaries,
RecvBidiKeyboardNotify(aXPCOMInit.isLangRTL(), aXPCOMInit.haveBidiKeyboards()); &clipboardCaps, &domainPolicy, &initialData,
&mFontFamilies, &userContentSheetURL,
&mLookAndFeelCache);
RecvSetOffline(isOffline);
RecvSetConnectivity(isConnected);
RecvSetCaptivePortalState(captivePortalState);
RecvBidiKeyboardNotify(isLangRTL, haveBidiKeyboards);
// Create the CPOW manager as soon as possible. // Create the CPOW manager as soon as possible.
SendPJavaScriptConstructor(); SendPJavaScriptConstructor();
if (aXPCOMInit.domainPolicy().active()) { if (domainPolicy.active()) {
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
MOZ_ASSERT(ssm); MOZ_ASSERT(ssm);
ssm->ActivateDomainPolicyInternal(getter_AddRefs(mPolicy)); ssm->ActivateDomainPolicyInternal(getter_AddRefs(mPolicy));
if (!mPolicy) { if (!mPolicy) {
MOZ_CRASH("Failed to activate domain policy."); MOZ_CRASH("Failed to activate domain policy.");
} }
mPolicy->ApplyClone(&aXPCOMInit.domainPolicy()); mPolicy->ApplyClone(&domainPolicy);
} }
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1")); nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1"));
if (nsCOMPtr<nsIClipboardProxy> clipboardProxy = do_QueryInterface(clipboard)) { if (nsCOMPtr<nsIClipboardProxy> clipboardProxy = do_QueryInterface(clipboard)) {
clipboardProxy->SetCapabilities(aXPCOMInit.clipboardCaps()); clipboardProxy->SetCapabilities(clipboardCaps);
} }
{ {
@ -1010,9 +1002,7 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
} }
ErrorResult rv; ErrorResult rv;
JS::RootedValue data(jsapi.cx()); JS::RootedValue data(jsapi.cx());
mozilla::dom::ipc::StructuredCloneData id; initialData.Read(jsapi.cx(), &data, rv);
id.Copy(aInitialData);
id.Read(jsapi.cx(), &data, rv);
if (NS_WARN_IF(rv.Failed())) { if (NS_WARN_IF(rv.Failed())) {
MOZ_CRASH(); MOZ_CRASH();
} }
@ -1021,7 +1011,7 @@ ContentChild::InitXPCOM(const XPCOMInitData& aXPCOMInit,
} }
// The stylesheet cache is not ready yet. Store this URL for future use. // The stylesheet cache is not ready yet. Store this URL for future use.
nsCOMPtr<nsIURI> ucsURL = DeserializeURI(aXPCOMInit.userContentSheetURL()); nsCOMPtr<nsIURI> ucsURL = DeserializeURI(userContentSheetURL);
nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL); nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL);
// This will register cross-process observer. // This will register cross-process observer.

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

@ -96,12 +96,9 @@ public:
bool Init(MessageLoop* aIOLoop, bool Init(MessageLoop* aIOLoop,
base::ProcessId aParentPid, base::ProcessId aParentPid,
IPC::Channel* aChannel, IPC::Channel* aChannel);
uint64_t aChildID,
bool aIsForBrowser);
void InitXPCOM(const XPCOMInitData& aXPCOMInit, void InitXPCOM();
const mozilla::dom::ipc::StructuredCloneData& aInitialData);
void InitGraphicsDeviceData(); void InitGraphicsDeviceData();
@ -576,11 +573,6 @@ public:
const bool& minimizeMemoryUsage, const bool& minimizeMemoryUsage,
const MaybeFileDesc& DMDFile) override; const MaybeFileDesc& DMDFile) override;
virtual mozilla::ipc::IPCResult
RecvSetXPCOMProcessAttributes(const XPCOMInitData& aXPCOMInit,
const StructuredCloneData& aInitialData,
nsTArray<LookAndFeelInt>&& aLookAndFeelIntCache) override;
#if defined(XP_WIN) && defined(ACCESSIBILITY) #if defined(XP_WIN) && defined(ACCESSIBILITY)
bool bool
SendGetA11yContentId(); SendGetA11yContentId();

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

@ -186,8 +186,6 @@
#include "nsLayoutStylesheetCache.h" #include "nsLayoutStylesheetCache.h"
#include "ContentPrefs.h"
#ifdef MOZ_WEBRTC #ifdef MOZ_WEBRTC
#include "signaling/src/peerconnection/WebrtcGlobalParent.h" #include "signaling/src/peerconnection/WebrtcGlobalParent.h"
#endif #endif
@ -1826,48 +1824,6 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER); PROFILER_LABEL_FUNC(js::ProfileEntry::Category::OTHER);
std::vector<std::string> extraArgs; std::vector<std::string> extraArgs;
extraArgs.push_back("-childID");
char idStr[21];
SprintfLiteral(idStr, "%" PRId64, static_cast<uint64_t>(mChildID));
extraArgs.push_back(idStr);
extraArgs.push_back(IsForBrowser() ? "-isForBrowser" : "-notForBrowser");
std::stringstream boolPrefs;
std::stringstream intPrefs;
std::stringstream stringPrefs;
size_t prefsLen;
ContentPrefs::GetContentPrefs(&prefsLen);
for (unsigned int i = 0; i < prefsLen; i++) {
MOZ_ASSERT(i == 0 || strcmp(ContentPrefs::GetContentPref(i), ContentPrefs::GetContentPref(i - 1)) > 0);
switch (Preferences::GetType(ContentPrefs::GetContentPref(i))) {
case nsIPrefBranch::PREF_INT:
intPrefs << i << ':' << Preferences::GetInt(ContentPrefs::GetContentPref(i)) << '|';
break;
case nsIPrefBranch::PREF_BOOL:
boolPrefs << i << ':' << Preferences::GetBool(ContentPrefs::GetContentPref(i)) << '|';
break;
case nsIPrefBranch::PREF_STRING: {
std::string value(Preferences::GetCString(ContentPrefs::GetContentPref(i)).get());
stringPrefs << i << ':' << value.length() << ':' << value << '|';
}
break;
case nsIPrefBranch::PREF_INVALID:
break;
default:
printf("preference type: %x\n", Preferences::GetType(ContentPrefs::GetContentPref(i)));
MOZ_CRASH();
}
}
extraArgs.push_back("-intPrefs");
extraArgs.push_back(intPrefs.str());
extraArgs.push_back("-boolPrefs");
extraArgs.push_back(boolPrefs.str());
extraArgs.push_back("-stringPrefs");
extraArgs.push_back(stringPrefs.str());
if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) { if (!mSubprocess->LaunchAndWaitForProcessHandle(extraArgs)) {
MarkAsDead(); MarkAsDead();
return false; return false;
@ -1887,17 +1843,6 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
// Set a reply timeout for CPOWs. // Set a reply timeout for CPOWs.
SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0)); SetReplyTimeoutMs(Preferences::GetInt("dom.ipc.cpow.timeout", 0));
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
.ToMilliseconds()));
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-initializing", cpId.get());
}
return true; return true;
} }
@ -1955,90 +1900,6 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
bool aSetupOffMainThreadCompositing, bool aSetupOffMainThreadCompositing,
bool aSendRegisteredChrome) bool aSendRegisteredChrome)
{ {
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
.ToMilliseconds()));
XPCOMInitData xpcomInit;
Preferences::GetPreferences(&xpcomInit.prefs());
nsCOMPtr<nsIIOService> io(do_GetIOService());
MOZ_ASSERT(io, "No IO service?");
DebugOnly<nsresult> rv = io->GetOffline(&xpcomInit.isOffline());
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?");
rv = io->GetConnectivity(&xpcomInit.isConnected());
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?");
xpcomInit.captivePortalState() = nsICaptivePortalService::UNKNOWN;
nsCOMPtr<nsICaptivePortalService> cps = do_GetService(NS_CAPTIVEPORTAL_CONTRACTID);
if (cps) {
cps->GetState(&xpcomInit.captivePortalState());
}
nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard();
xpcomInit.isLangRTL() = false;
xpcomInit.haveBidiKeyboards() = false;
if (bidi) {
bidi->IsLangRTL(&xpcomInit.isLangRTL());
bidi->GetHaveBidiKeyboards(&xpcomInit.haveBidiKeyboards());
}
nsCOMPtr<nsISpellChecker> spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID));
MOZ_ASSERT(spellChecker, "No spell checker?");
spellChecker->GetDictionaryList(&xpcomInit.dictionaries());
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1"));
MOZ_ASSERT(clipboard, "No clipboard?");
rv = clipboard->SupportsSelectionClipboard(&xpcomInit.clipboardCaps().supportsSelectionClipboard());
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = clipboard->SupportsFindClipboard(&xpcomInit.clipboardCaps().supportsFindClipboard());
MOZ_ASSERT(NS_SUCCEEDED(rv));
// Let's copy the domain policy from the parent to the child (if it's active).
StructuredCloneData initialData;
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
if (ssm) {
ssm->CloneDomainPolicy(&xpcomInit.domainPolicy());
if (nsFrameMessageManager* mm = nsFrameMessageManager::sParentProcessManager) {
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
MOZ_CRASH();
}
JS::RootedValue init(jsapi.cx());
nsresult result = mm->GetInitialProcessData(jsapi.cx(), &init);
if (NS_FAILED(result)) {
MOZ_CRASH();
}
ErrorResult rv;
initialData.Write(jsapi.cx(), init, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
MOZ_CRASH();
}
}
}
// This is only implemented (returns a non-empty list) by MacOSX at present.
gfxPlatform::GetPlatform()->GetSystemFontFamilyList(&xpcomInit.fontFamilies());
nsTArray<LookAndFeelInt> lnfCache = LookAndFeel::GetIntCache();
// Content processes have no permission to access profile directory, so we
// send the file URL instead.
StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
if (ucs) {
SerializeURI(ucs->GetSheetURI(), xpcomInit.userContentSheetURL());
} else {
SerializeURI(nullptr, xpcomInit.userContentSheetURL());
}
Unused << SendSetXPCOMProcessAttributes(xpcomInit, initialData, lnfCache);
if (aSendRegisteredChrome) { if (aSendRegisteredChrome) {
nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService(); nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
nsChromeRegistryChrome* chromeRegistry = nsChromeRegistryChrome* chromeRegistry =
@ -2210,6 +2071,13 @@ ContentParent::Pid() const
return base::GetProcId(mSubprocess->GetChildProcessHandle()); return base::GetProcId(mSubprocess->GetChildProcessHandle());
} }
mozilla::ipc::IPCResult
ContentParent::RecvReadPrefsArray(InfallibleTArray<PrefSetting>* aPrefs)
{
Preferences::GetPreferences(aPrefs);
return IPC_OK();
}
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
ContentParent::RecvGetGfxVars(InfallibleTArray<GfxVarUpdate>* aVars) ContentParent::RecvGetGfxVars(InfallibleTArray<GfxVarUpdate>* aVars)
{ {
@ -2680,6 +2548,118 @@ ContentParent::RecvInitBackground(Endpoint<PBackgroundParent>&& aEndpoint)
return IPC_OK(); return IPC_OK();
} }
mozilla::ipc::IPCResult
ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId,
bool* aIsForBrowser)
{
*aCpId = mChildID;
*aIsForBrowser = mIsForBrowser;
return IPC_OK();
}
mozilla::ipc::IPCResult
ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
bool* aIsConnected,
int32_t* aCaptivePortalState,
bool* aIsLangRTL,
bool* aHaveBidiKeyboards,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
StructuredCloneData* aInitialData,
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
OptionalURIParams* aUserContentCSSURL,
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache)
{
Telemetry::Accumulate(Telemetry::CONTENT_PROCESS_LAUNCH_TIME_MS,
static_cast<uint32_t>((TimeStamp::Now() - mLaunchTS)
.ToMilliseconds()));
nsCOMPtr<nsIIOService> io(do_GetIOService());
MOZ_ASSERT(io, "No IO service?");
DebugOnly<nsresult> rv = io->GetOffline(aIsOffline);
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?");
rv = io->GetConnectivity(aIsConnected);
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?");
*aCaptivePortalState = nsICaptivePortalService::UNKNOWN;
nsCOMPtr<nsICaptivePortalService> cps = do_GetService(NS_CAPTIVEPORTAL_CONTRACTID);
if (cps) {
cps->GetState(aCaptivePortalState);
}
nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard();
*aIsLangRTL = false;
*aHaveBidiKeyboards = false;
if (bidi) {
bidi->IsLangRTL(aIsLangRTL);
bidi->GetHaveBidiKeyboards(aHaveBidiKeyboards);
}
nsCOMPtr<nsISpellChecker> spellChecker(do_GetService(NS_SPELLCHECKER_CONTRACTID));
MOZ_ASSERT(spellChecker, "No spell checker?");
spellChecker->GetDictionaryList(dictionaries);
nsCOMPtr<nsIClipboard> clipboard(do_GetService("@mozilla.org/widget/clipboard;1"));
MOZ_ASSERT(clipboard, "No clipboard?");
rv = clipboard->SupportsSelectionClipboard(&clipboardCaps->supportsSelectionClipboard());
MOZ_ASSERT(NS_SUCCEEDED(rv));
rv = clipboard->SupportsFindClipboard(&clipboardCaps->supportsFindClipboard());
MOZ_ASSERT(NS_SUCCEEDED(rv));
// Let's copy the domain policy from the parent to the child (if it's active).
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
NS_ENSURE_TRUE(ssm, IPC_OK());
ssm->CloneDomainPolicy(domainPolicy);
if (nsFrameMessageManager* mm = nsFrameMessageManager::sParentProcessManager) {
AutoJSAPI jsapi;
if (NS_WARN_IF(!jsapi.Init(xpc::PrivilegedJunkScope()))) {
return IPC_FAIL_NO_REASON(this);
}
JS::RootedValue init(jsapi.cx());
nsresult result = mm->GetInitialProcessData(jsapi.cx(), &init);
if (NS_FAILED(result)) {
return IPC_FAIL_NO_REASON(this);
}
ErrorResult rv;
aInitialData->Write(jsapi.cx(), init, rv);
if (NS_WARN_IF(rv.Failed())) {
rv.SuppressException();
return IPC_FAIL_NO_REASON(this);
}
}
// This is only implemented (returns a non-empty list) by MacOSX at present.
gfxPlatform::GetPlatform()->GetSystemFontFamilyList(fontFamilies);
*aLookAndFeelIntCache = LookAndFeel::GetIntCache();
// Content processes have no permission to access profile directory, so we
// send the file URL instead.
StyleSheet* ucs = nsLayoutStylesheetCache::For(StyleBackendType::Gecko)->UserContentSheet();
if (ucs) {
SerializeURI(ucs->GetSheetURI(), *aUserContentCSSURL);
} else {
SerializeURI(nullptr, *aUserContentCSSURL);
}
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
if (obs) {
nsAutoString cpId;
cpId.AppendInt(static_cast<uint64_t>(this->ChildID()));
obs->NotifyObservers(static_cast<nsIObserver*>(this), "ipc:content-initializing", cpId.get());
}
return IPC_OK();
}
mozilla::jsipc::PJavaScriptParent * mozilla::jsipc::PJavaScriptParent *
ContentParent::AllocPJavaScriptParent() ContentParent::AllocPJavaScriptParent()
{ {

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

@ -746,6 +746,24 @@ private:
virtual mozilla::ipc::IPCResult RecvInitBackground(Endpoint<mozilla::ipc::PBackgroundParent>&& aEndpoint) override; virtual mozilla::ipc::IPCResult RecvInitBackground(Endpoint<mozilla::ipc::PBackgroundParent>&& aEndpoint) override;
virtual mozilla::ipc::IPCResult RecvGetProcessAttributes(ContentParentId* aCpId,
bool* aIsForBrowser) override;
virtual mozilla::ipc::IPCResult
RecvGetXPCOMProcessAttributes(bool* aIsOffline,
bool* aIsConnected,
int32_t* aCaptivePortalState,
bool* aIsLangRTL,
bool* aHaveBidiKeyboards,
InfallibleTArray<nsString>* dictionaries,
ClipboardCapabilities* clipboardCaps,
DomainPolicyClone* domainPolicy,
StructuredCloneData* initialData,
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
OptionalURIParams* aUserContentSheetURL,
nsTArray<LookAndFeelInt>* aLookAndFeelIntCache) override;
mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport) override; mozilla::ipc::IPCResult RecvAddMemoryReport(const MemoryReport& aReport) override;
mozilla::ipc::IPCResult RecvFinishMemoryReport(const uint32_t& aGeneration) override; mozilla::ipc::IPCResult RecvFinishMemoryReport(const uint32_t& aGeneration) override;
@ -880,6 +898,7 @@ private:
virtual bool virtual bool
DeallocPWebBrowserPersistDocumentParent(PWebBrowserPersistDocumentParent* aActor) override; DeallocPWebBrowserPersistDocumentParent(PWebBrowserPersistDocumentParent* aActor) override;
virtual mozilla::ipc::IPCResult RecvReadPrefsArray(InfallibleTArray<PrefSetting>* aPrefs) override;
virtual mozilla::ipc::IPCResult RecvGetGfxVars(InfallibleTArray<GfxVarUpdate>* aVars) override; virtual mozilla::ipc::IPCResult RecvGetGfxVars(InfallibleTArray<GfxVarUpdate>* aVars) override;
virtual mozilla::ipc::IPCResult RecvReadFontList(InfallibleTArray<FontListEntry>* retValue) override; virtual mozilla::ipc::IPCResult RecvReadFontList(InfallibleTArray<FontListEntry>* retValue) override;

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

@ -1,275 +0,0 @@
/* -*- 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/. */
#include "ContentPrefs.h"
const char* mozilla::dom::ContentPrefs::gInitPrefs[] = {
"accessibility.monoaudio.enable",
"accessibility.mouse_focuses_formcontrol",
"accessibility.tabfocus_applies_to_xul",
"app.update.channel",
"browser.dom.window.dump.enabled",
"browser.sessionhistory.max_entries",
"browser.sessionhistory.max_total_viewers",
"content.cors.disable",
"content.cors.no_private_data",
"content.notify.backoffcount",
"content.notify.interval",
"content.notify.ontimer",
"content.sink.enable_perf_mode",
"content.sink.event_probe_rate",
"content.sink.initial_perf_time",
"content.sink.interactive_deflect_count",
"content.sink.interactive_parse_time",
"content.sink.interactive_time",
"content.sink.pending_event_mode",
"content.sink.perf_deflect_count",
"content.sink.perf_parse_time",
"device.storage.prompt.testing",
"device.storage.writable.name",
"dom.allow_XUL_XBL_for_file",
"dom.allow_cut_copy",
"dom.enable_frame_timing",
"dom.enable_performance",
"dom.enable_resource_timing",
"dom.event.handling-user-input-time-limit",
"dom.forms.autocomplete.experimental",
"dom.ipc.processPriorityManager.backgroundGracePeriodMS",
"dom.ipc.processPriorityManager.backgroundPerceivableGracePeriodMS",
"dom.max_chrome_script_run_time",
"dom.max_script_run_time",
"dom.performance.enable_notify_performance_timing",
"dom.performance.enable_user_timing_logging",
"dom.storage.testing",
"dom.url.encode_decode_hash",
"dom.url.getters_decode_hash",
"dom.use_watchdog",
"dom.vibrator.enabled",
"dom.vibrator.max_vibrate_list_len",
"dom.vibrator.max_vibrate_ms",
"focusmanager.testmode",
"font.size.inflation.disabledInMasterProcess",
"font.size.inflation.emPerLine",
"font.size.inflation.forceEnabled",
"font.size.inflation.lineThreshold",
"font.size.inflation.mappingIntercept",
"font.size.inflation.maxRatio",
"font.size.inflation.minTwips",
"full-screen-api.allow-trusted-requests-only",
"full-screen-api.enabled",
"full-screen-api.unprefix.enabled",
"gfx.font_rendering.opentype_svg.enabled",
"hangmonitor.timeout",
"html5.flushtimer.initialdelay",
"html5.flushtimer.subsequentdelay",
"html5.offmainthread",
"intl.charset.fallback.tld",
"intl.ime.hack.on_ime_unaware_apps.fire_key_events_for_composition",
"javascript.enabled",
"javascript.options.asmjs",
"javascript.options.asyncstack",
"javascript.options.baselinejit",
"javascript.options.baselinejit.threshold",
"javascript.options.baselinejit.unsafe_eager_compilation",
"javascript.options.discardSystemSource",
"javascript.options.dump_stack_on_debuggee_would_run",
"javascript.options.gczeal",
"javascript.options.gczeal.frequency",
"javascript.options.ion",
"javascript.options.ion.offthread_compilation",
"javascript.options.ion.threshold",
"javascript.options.ion.unsafe_eager_compilation",
"javascript.options.jit.full_debug_checks",
"javascript.options.native_regexp",
"javascript.options.parallel_parsing",
"javascript.options.shared_memory",
"javascript.options.strict",
"javascript.options.strict.debug",
"javascript.options.throw_on_asmjs_validation_failure",
"javascript.options.throw_on_debuggee_would_run",
"javascript.options.wasm",
"javascript.options.wasm_baselinejit",
"javascript.options.werror",
"javascript.use_us_english_locale",
"jsloader.reuseGlobal",
"layout.css.all-shorthand.enabled",
"layout.css.background-blend-mode.enabled",
"layout.css.background-clip-text.enabled",
"layout.css.box-decoration-break.enabled",
"layout.css.color-adjust.enabled",
"layout.css.contain.enabled",
"layout.css.control-characters.visible",
"layout.css.display-flow-root.enabled",
"layout.css.expensive-style-struct-assertions.enabled",
"layout.css.float-logical-values.enabled",
"layout.css.font-variations.enabled",
"layout.css.grid.enabled",
"layout.css.image-orientation.enabled",
"layout.css.initial-letter.enabled",
"layout.css.isolation.enabled",
"layout.css.mix-blend-mode.enabled",
"layout.css.object-fit-and-position.enabled",
"layout.css.osx-font-smoothing.enabled",
"layout.css.overflow-clip-box.enabled",
"layout.css.prefixes.animations",
"layout.css.prefixes.border-image",
"layout.css.prefixes.box-sizing",
"layout.css.prefixes.device-pixel-ratio-webkit",
"layout.css.prefixes.font-features",
"layout.css.prefixes.gradients",
"layout.css.prefixes.transforms",
"layout.css.prefixes.transitions",
"layout.css.prefixes.webkit",
"layout.css.scope-pseudo.enabled",
"layout.css.scroll-behavior.property-enabled",
"layout.css.scroll-snap.enabled",
"layout.css.shape-outside.enabled",
"layout.css.text-align-unsafe-value.enabled",
"layout.css.text-combine-upright-digits.enabled",
"layout.css.text-combine-upright.enabled",
"layout.css.touch_action.enabled",
"layout.css.unprefixing-service.enabled",
"layout.css.unprefixing-service.globally-whitelisted",
"layout.css.unprefixing-service.include-test-domains",
"layout.css.variables.enabled",
"layout.css.visited_links_enabled",
"layout.idle_period.required_quiescent_frames",
"layout.idle_period.time_limit",
"layout.interruptible-reflow.enabled",
"mathml.disabled",
"media.apple.forcevda",
"media.clearkey.persistent-license.enabled",
"media.cubeb_latency_msg_frames",
"media.cubeb_latency_playback_ms",
"media.decoder-doctor.wmf-disabled-is-failure",
"media.decoder.fuzzing.dont-delay-inputexhausted",
"media.decoder.fuzzing.enabled",
"media.decoder.fuzzing.video-output-minimum-interval-ms",
"media.decoder.limit",
"media.decoder.recycle.enabled",
"media.dormant-on-pause-timeout-ms",
"media.eme.audio.blank",
"media.eme.enabled",
"media.eme.video.blank",
"media.ffmpeg.enabled",
"media.ffvpx.enabled",
"media.flac.enabled",
"media.forcestereo.enabled",
"media.gmp.async-shutdown-timeout",
"media.gmp.decoder.aac",
"media.gmp.decoder.enabled",
"media.gmp.decoder.h264",
"media.gmp.insecure.allow",
"media.gpu-process-decoder",
"media.libavcodec.allow-obsolete",
"media.num-decode-threads",
"media.ogg.enabled",
"media.ogg.flac.enabled",
"media.resampling.enabled",
"media.resampling.rate",
"media.ruin-av-sync.enabled",
"media.rust.test_mode",
"media.suspend-bkgnd-video.delay-ms",
"media.suspend-bkgnd-video.enabled",
"media.use-blank-decoder",
"media.video_stats.enabled",
"media.volume_scale",
"media.webspeech.recognition.enable",
"media.webspeech.recognition.force_enable",
"media.webspeech.synth.force_global_queue",
"media.webspeech.test.enable",
"media.webspeech.test.fake_fsm_events",
"media.webspeech.test.fake_recognition_service",
"media.wmf.allow-unsupported-resolutions",
"media.wmf.decoder.thread-count",
"media.wmf.enabled",
"media.wmf.skip-blacklist",
"media.wmf.vp9.enabled",
"memory.free_dirty_pages",
"memory.low_commit_space_threshold_mb",
"memory.low_memory_notification_interval_ms",
"memory.low_physical_memory_threshold_mb",
"memory.low_virtual_mem_threshold_mb",
"network.IDN.blacklist_chars",
"network.IDN.restriction_profile",
"network.IDN.use_whitelist",
"network.IDN_show_punycode",
"network.buffer.cache.count",
"network.buffer.cache.size",
"network.captive-portal-service.enabled",
"network.cookie.cookieBehavior",
"network.cookie.lifetimePolicy",
"network.dns.disablePrefetch",
"network.dns.disablePrefetchFromHTTPS",
"network.jar.block-remote-files",
"network.loadinfo.skip_type_assertion",
"network.notify.changed",
"network.offline-mirrors-connectivity",
"network.protocol-handler.external.jar",
"network.proxy.type",
"network.security.ports.banned",
"network.security.ports.banned.override",
"network.standard-url.enable-rust",
"network.standard-url.max-length",
"network.sts.max_time_for_events_between_two_polls",
"network.sts.max_time_for_pr_close_during_shutdown",
"network.tcp.keepalive.enabled",
"network.tcp.keepalive.idle_time",
"network.tcp.keepalive.probe_count",
"network.tcp.keepalive.retry_interval",
"network.tcp.sendbuffer",
"nglayout.debug.invalidation",
"privacy.donottrackheader.enabled",
"privacy.firstparty.isolate",
"privacy.firstparty.isolate.restrict_opener_access",
"privacy.resistFingerprinting",
"security.data_uri.inherit_security_context",
"security.fileuri.strict_origin_policy",
"security.sandbox.content.level",
"security.sandbox.content.tempDirSuffix",
"security.sandbox.logging.enabled",
"security.sandbox.mac.track.violations",
"security.sandbox.windows.log",
"security.sandbox.windows.log.stackTraceDepth",
"shutdown.watchdog.timeoutSecs",
"signed.applets.codebase_principal_support",
"svg.disabled",
"svg.display-lists.hit-testing.enabled",
"svg.display-lists.painting.enabled",
"svg.new-getBBox.enabled",
"svg.paint-order.enabled",
"svg.path-caching.enabled",
"svg.transform-box.enabled",
"toolkit.asyncshutdown.crash_timeout",
"toolkit.asyncshutdown.log",
"toolkit.osfile.log",
"toolkit.osfile.log.redirect",
"toolkit.telemetry.enabled",
"toolkit.telemetry.idleTimeout",
"toolkit.telemetry.initDelay",
"toolkit.telemetry.log.dump",
"toolkit.telemetry.log.level",
"toolkit.telemetry.minSubsessionLength",
"toolkit.telemetry.scheduler.idleTickInterval",
"toolkit.telemetry.scheduler.tickInterval",
"toolkit.telemetry.unified",
"ui.key.menuAccessKeyFocuses",
"ui.popup.disable_autohide",
"ui.use_activity_cursor",
"view_source.editor.external"};
const char** mozilla::dom::ContentPrefs::GetContentPrefs(size_t* aCount)
{
*aCount = ArrayLength(ContentPrefs::gInitPrefs);
return gInitPrefs;
}
const char* mozilla::dom::ContentPrefs::GetContentPref(size_t aIndex)
{
MOZ_ASSERT(aIndex < ArrayLength(ContentPrefs::gInitPrefs));
return gInitPrefs[aIndex];
}

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

@ -1,25 +0,0 @@
/* -*- 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/. */
#ifndef mozilla_dom_ContentPrefs_h
#define mozilla_dom_ContentPrefs_h
namespace mozilla {
namespace dom {
class ContentPrefs {
public:
static const char** GetContentPrefs(size_t* aCount);
static const char* GetContentPref(size_t aIndex);
private:
static const char* gInitPrefs[];
};
}
}
#endif

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

@ -7,7 +7,6 @@
#include "mozilla/ipc/IOThreadChild.h" #include "mozilla/ipc/IOThreadChild.h"
#include "ContentProcess.h" #include "ContentProcess.h"
#include "ContentPrefs.h"
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
#include <stdlib.h> #include <stdlib.h>
@ -104,143 +103,46 @@ SetUpSandboxEnvironment()
} }
#endif #endif
bool void
ContentProcess::Init(int aArgc, char* aArgv[]) ContentProcess::SetAppDir(const nsACString& aPath)
{ {
// If passed in grab the application path for xpcom init mXREEmbed.SetAppDir(aPath);
bool foundAppdir = false; }
bool foundChildID = false;
bool foundIsForBrowser = false;
bool foundIntPrefs = false;
bool foundBoolPrefs = false;
bool foundStringPrefs = false;
uint64_t childID;
bool isForBrowser;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX) #if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
// If passed in grab the profile path for sandboxing void
bool foundProfile = false; ContentProcess::SetProfile(const nsACString& aProfile)
nsCOMPtr<nsIFile> profileDir; {
#endif bool flag;
nsresult rv =
InfallibleTArray<PrefSetting> prefsArray; XRE_GetFileFromPath(aProfile.BeginReading(), getter_AddRefs(mProfileDir));
for (int idx = aArgc; idx > 0; idx--) { if (NS_FAILED(rv) ||
if (!aArgv[idx]) { NS_FAILED(mProfileDir->Exists(&flag)) || !flag) {
continue; NS_WARNING("Invalid profile directory passed to content process.");
} mProfileDir = nullptr;
if (!strcmp(aArgv[idx], "-appdir")) {
MOZ_ASSERT(!foundAppdir);
if (foundAppdir) {
continue;
}
nsCString appDir;
appDir.Assign(nsDependentCString(aArgv[idx+1]));
mXREEmbed.SetAppDir(appDir);
foundAppdir = true;
} else if (!strcmp(aArgv[idx], "-childID")) {
MOZ_ASSERT(!foundChildID);
if (foundChildID) {
continue;
}
if (idx + 1 < aArgc) {
childID = strtoull(aArgv[idx + 1], nullptr, 10);
foundChildID = true;
}
} else if (!strcmp(aArgv[idx], "-isForBrowser") || !strcmp(aArgv[idx], "-notForBrowser")) {
MOZ_ASSERT(!foundIsForBrowser);
if (foundIsForBrowser) {
continue;
}
isForBrowser = strcmp(aArgv[idx], "-notForBrowser");
foundIsForBrowser = true;
} else if (!strcmp(aArgv[idx], "-intPrefs")) {
SET_PREF_PHASE(BEGIN_INIT_PREFS);
char* str = aArgv[idx + 1];
while (*str) {
int32_t index = strtol(str, &str, 10);
str++;
MaybePrefValue value(PrefValue(static_cast<int32_t>(strtol(str, &str, 10))));
str++;
PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue());
prefsArray.AppendElement(pref);
}
SET_PREF_PHASE(END_INIT_PREFS);
foundIntPrefs = true;
} else if (!strcmp(aArgv[idx], "-boolPrefs")) {
SET_PREF_PHASE(BEGIN_INIT_PREFS);
char* str = aArgv[idx + 1];
while (*str) {
int32_t index = strtol(str, &str, 10);
str++;
MaybePrefValue value(PrefValue(!!strtol(str, &str, 10)));
str++;
PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue());
prefsArray.AppendElement(pref);
}
SET_PREF_PHASE(END_INIT_PREFS);
foundBoolPrefs = true;
} else if (!strcmp(aArgv[idx], "-stringPrefs")) {
SET_PREF_PHASE(BEGIN_INIT_PREFS);
char* str = aArgv[idx + 1];
while (*str) {
int32_t index = strtol(str, &str, 10);
str++;
int32_t length = strtol(str, &str, 10);
str++;
MaybePrefValue value(PrefValue(nsCString(str, length)));
PrefSetting pref(nsCString(ContentPrefs::GetContentPref(index)), value, MaybePrefValue());
prefsArray.AppendElement(pref);
str += length + 1;
}
SET_PREF_PHASE(END_INIT_PREFS);
foundStringPrefs = true;
}
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
else if (!strcmp(aArgv[idx], "-profile")) {
MOZ_ASSERT(!foundProfile);
if (foundProfile) {
continue;
}
bool flag;
nsresult rv = XRE_GetFileFromPath(aArgv[idx+1], getter_AddRefs(profileDir));
if (NS_FAILED(rv) ||
NS_FAILED(profileDir->Exists(&flag)) || !flag) {
NS_WARNING("Invalid profile directory passed to content process.");
profileDir = nullptr;
}
foundProfile = true;
}
#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */
bool allFound = foundAppdir && foundChildID && foundIsForBrowser && foundIntPrefs && foundBoolPrefs && foundStringPrefs;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
allFound &= foundProfile;
#endif
if (allFound) {
break;
}
} }
Preferences::SetInitPreferences(&prefsArray); }
mContent.Init(IOThreadChild::message_loop(), #endif
ParentPid(),
IOThreadChild::channel(), bool
childID, ContentProcess::Init()
isForBrowser); {
mXREEmbed.Start(); mContent.Init(IOThreadChild::message_loop(),
ParentPid(),
IOThreadChild::channel());
mXREEmbed.Start();
mContent.InitXPCOM();
mContent.InitGraphicsDeviceData();
#if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) #if (defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
mContent.SetProfileDir(profileDir); mContent.SetProfileDir(mProfileDir);
#endif #endif
#if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX) #if (defined(XP_WIN) || defined(XP_MACOSX)) && defined(MOZ_CONTENT_SANDBOX)
SetUpSandboxEnvironment(); SetUpSandboxEnvironment();
#endif #endif
return true; return true;
} }
// Note: CleanUp() never gets called in non-debug builds because we exit early // Note: CleanUp() never gets called in non-debug builds because we exit early
@ -248,7 +150,7 @@ ContentProcess::Init(int aArgc, char* aArgv[])
void void
ContentProcess::CleanUp() ContentProcess::CleanUp()
{ {
mXREEmbed.Stop(); mXREEmbed.Stop();
} }
} // namespace dom } // namespace dom

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

@ -34,13 +34,23 @@ public:
~ContentProcess() ~ContentProcess()
{ } { }
virtual bool Init(int aArgc, char* aArgv[]) override; virtual bool Init() override;
virtual void CleanUp() override; virtual void CleanUp() override;
void SetAppDir(const nsACString& aPath);
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
void SetProfile(const nsACString& aProfile);
#endif
private: private:
ContentChild mContent; ContentChild mContent;
mozilla::ipc::ScopedXREEmbed mXREEmbed; mozilla::ipc::ScopedXREEmbed mXREEmbed;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
nsCOMPtr<nsIFile> mProfileDir;
#endif
#if defined(XP_WIN) #if defined(XP_WIN)
// This object initializes and configures COM. // This object initializes and configures COM.
mozilla::mscom::MainThreadRuntime mCOMRuntime; mozilla::mscom::MainThreadRuntime mCOMRuntime;

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

@ -334,22 +334,6 @@ struct GMPCapabilityData
GMPAPITags[] capabilities; GMPAPITags[] capabilities;
}; };
struct XPCOMInitData
{
bool isOffline;
bool isConnected;
int32_t captivePortalState;
bool isLangRTL;
bool haveBidiKeyboards;
nsString[] dictionaries;
ClipboardCapabilities clipboardCaps;
DomainPolicyClone domainPolicy;
/* used on MacOSX only */
FontFamilyListEntry[] fontFamilies;
OptionalURIParams userContentSheetURL;
PrefSetting[] prefs;
};
struct GfxInfoFeatureStatus struct GfxInfoFeatureStatus
{ {
int32_t feature; int32_t feature;
@ -543,8 +527,6 @@ child:
*/ */
async InitBlobURLs(BlobURLRegistrationData[] registrations); async InitBlobURLs(BlobURLRegistrationData[] registrations);
async SetXPCOMProcessAttributes(XPCOMInitData xpcomInit, StructuredCloneData initialData, LookAndFeelInt[] lookAndFeelIntCache);
// Notify child that last-pb-context-exited notification was observed // Notify child that last-pb-context-exited notification was observed
async LastPrivateDocShellDestroyed(); async LastPrivateDocShellDestroyed();
@ -668,6 +650,30 @@ child:
parent: parent:
async InitBackground(Endpoint<PBackgroundParent> aEndpoint); async InitBackground(Endpoint<PBackgroundParent> aEndpoint);
/**
* Tell the content process some attributes of itself. This is
* among the first information queried by content processes after
* startup. (The message is sync to allow the content process to
* control when it receives the information.)
*
* |id| is a unique ID among all subprocesses. When
* |isForBrowser|, we're loading <browser> or <xul:browser remote>.
*
* Keep the return values in sync with PBrowser()!
*/
sync GetProcessAttributes()
returns (ContentParentId cpId, bool isForBrowser);
sync GetXPCOMProcessAttributes()
returns (bool isOffline, bool isConnected, int32_t captivePortalState,
bool isLangRTL,
bool haveBidiKeyboards, nsString[] dictionaries,
ClipboardCapabilities clipboardCaps,
DomainPolicyClone domainPolicy,
StructuredCloneData initialData,
FontFamilyListEntry[] fontFamilies /* used on MacOSX only */,
OptionalURIParams userContentSheetURL,
LookAndFeelInt[] lookAndFeelIntCache);
sync CreateChildProcess(IPCTabContext context, sync CreateChildProcess(IPCTabContext context,
ProcessPriority priority, ProcessPriority priority,
TabId openerTabId) TabId openerTabId)
@ -811,6 +817,7 @@ parent:
async ExtProtocolChannelConnectParent(uint32_t registrarId); async ExtProtocolChannelConnectParent(uint32_t registrarId);
// PrefService message // PrefService message
sync ReadPrefsArray() returns (PrefSetting[] prefs) verify;
sync GetGfxVars() returns (GfxVarUpdate[] vars); sync GetGfxVars() returns (GfxVarUpdate[] vars);
sync ReadFontList() returns (FontListEntry[] retValue); sync ReadFontList() returns (FontListEntry[] retValue);

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

@ -119,8 +119,6 @@
#include "GroupedSHistory.h" #include "GroupedSHistory.h"
#include "nsIHttpChannel.h" #include "nsIHttpChannel.h"
#include "mozilla/dom/DocGroup.h" #include "mozilla/dom/DocGroup.h"
#include "nsISupportsPrimitives.h"
#include "mozilla/Telemetry.h"
#ifdef NS_PRINTING #ifdef NS_PRINTING
#include "nsIPrintSession.h" #include "nsIPrintSession.h"

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

@ -20,7 +20,6 @@ EXPORTS.mozilla.dom += [
'ContentBridgeParent.h', 'ContentBridgeParent.h',
'ContentChild.h', 'ContentChild.h',
'ContentParent.h', 'ContentParent.h',
'ContentPrefs.h',
'ContentProcess.h', 'ContentProcess.h',
'ContentProcessManager.h', 'ContentProcessManager.h',
'CPOWManagerGetter.h', 'CPOWManagerGetter.h',
@ -51,7 +50,6 @@ UNIFIED_SOURCES += [
'ContentBridgeChild.cpp', 'ContentBridgeChild.cpp',
'ContentBridgeParent.cpp', 'ContentBridgeParent.cpp',
'ContentParent.cpp', 'ContentParent.cpp',
'ContentPrefs.cpp',
'ContentProcess.cpp', 'ContentProcess.cpp',
'ContentProcessManager.cpp', 'ContentProcessManager.cpp',
'CrashReporterParent.cpp', 'CrashReporterParent.cpp',

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

@ -25,7 +25,7 @@ GMPProcessChild::~GMPProcessChild()
} }
bool bool
GMPProcessChild::Init(int aArgc, char* aArgv[]) GMPProcessChild::Init()
{ {
nsAutoString pluginFilename; nsAutoString pluginFilename;

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

@ -22,7 +22,7 @@ public:
explicit GMPProcessChild(ProcessId aParentPid); explicit GMPProcessChild(ProcessId aParentPid);
~GMPProcessChild(); ~GMPProcessChild();
bool Init(int aArgc, char* aArgv[]) override; bool Init() override;
void CleanUp() override; void CleanUp() override;
private: private:

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

@ -40,7 +40,7 @@ namespace plugins {
bool bool
PluginProcessChild::Init(int aArgc, char* aArgv[]) PluginProcessChild::Init()
{ {
nsDebugImpl::SetMultiprocessMode("NPAPI"); nsDebugImpl::SetMultiprocessMode("NPAPI");

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

@ -30,7 +30,7 @@ public:
virtual ~PluginProcessChild() virtual ~PluginProcessChild()
{ } { }
virtual bool Init(int aArgc, char* aArgv[]) override; virtual bool Init() override;
virtual void CleanUp() override; virtual void CleanUp() override;
protected: protected:

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

@ -22,7 +22,7 @@ GPUProcessImpl::~GPUProcessImpl()
} }
bool bool
GPUProcessImpl::Init(int aArgc, char* aArgv[]) GPUProcessImpl::Init()
{ {
return mGPU.Init(ParentPid(), return mGPU.Init(ParentPid(),
IOThreadChild::message_loop(), IOThreadChild::message_loop(),

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

@ -24,7 +24,7 @@ public:
explicit GPUProcessImpl(ProcessId aParentPid); explicit GPUProcessImpl(ProcessId aParentPid);
~GPUProcessImpl(); ~GPUProcessImpl();
bool Init(int aArgc, char* aArgv[]) override; bool Init() override;
void CleanUp() override; void CleanUp() override;
private: private:

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

@ -27,7 +27,7 @@ public:
explicit ProcessChild(ProcessId aParentPid); explicit ProcessChild(ProcessId aParentPid);
virtual ~ProcessChild(); virtual ~ProcessChild();
virtual bool Init(int aArgc, char* aArgv[]) = 0; virtual bool Init() = 0;
virtual void CleanUp() virtual void CleanUp()
{ } { }

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

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/dom/PContent.h" #include "mozilla/dom/ContentChild.h"
#include "mozilla/ArrayUtils.h" #include "mozilla/ArrayUtils.h"
#include "mozilla/Attributes.h" #include "mozilla/Attributes.h"
@ -546,14 +546,6 @@ NS_INTERFACE_MAP_END
* nsIPrefService Implementation * nsIPrefService Implementation
*/ */
InfallibleTArray<Preferences::PrefSetting>* gInitPrefs;
/*static*/
void
Preferences::SetInitPreferences(nsTArray<PrefSetting>* aPrefs) {
gInitPrefs = new InfallibleTArray<PrefSetting>(mozilla::Move(*aPrefs));
}
nsresult nsresult
Preferences::Init() Preferences::Init()
{ {
@ -565,13 +557,15 @@ Preferences::Init()
rv = pref_InitInitialObjects(); rv = pref_InitInitialObjects();
NS_ENSURE_SUCCESS(rv, rv); NS_ENSURE_SUCCESS(rv, rv);
using mozilla::dom::ContentChild;
if (XRE_IsContentProcess()) { if (XRE_IsContentProcess()) {
MOZ_ASSERT(gInitPrefs); InfallibleTArray<PrefSetting> prefs;
for (unsigned int i = 0; i < gInitPrefs->Length(); i++) { ContentChild::GetSingleton()->SendReadPrefsArray(&prefs);
Preferences::SetPreference(gInitPrefs->ElementAt(i));
// Store the array
for (uint32_t i = 0; i < prefs.Length(); ++i) {
pref_SetPref(prefs[i]);
} }
delete gInitPrefs;
gInitPrefs = nullptr;
return NS_OK; return NS_OK;
} }
@ -786,14 +780,6 @@ Preferences::GetPreferences(InfallibleTArray<PrefSetting>* aPrefs)
} }
} }
#ifdef DEBUG
void
Preferences::SetInitPhase(pref_initPhase phase)
{
pref_SetInitPhase(phase);
}
#endif
NS_IMETHODIMP NS_IMETHODIMP
Preferences::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval) Preferences::GetBranch(const char *aPrefRoot, nsIPrefBranch **_retval)
{ {

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

@ -28,20 +28,6 @@ typedef void (*PrefChangedFunc)(const char *, void *);
#define have_PrefChangedFunc_typedef #define have_PrefChangedFunc_typedef
#endif #endif
#ifdef DEBUG
enum pref_initPhase {
START,
BEGIN_INIT_PREFS,
END_INIT_PREFS,
BEGIN_ALL_PREFS,
END_ALL_PREFS
};
#define SET_PREF_PHASE(p) Preferences::SetInitPhase(p)
#else
#define SET_PREF_PHASE(p) do { } while (0)
#endif
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -380,12 +366,6 @@ public:
static void GetPreference(PrefSetting* aPref); static void GetPreference(PrefSetting* aPref);
static void SetPreference(const PrefSetting& aPref); static void SetPreference(const PrefSetting& aPref);
static void SetInitPreferences(nsTArray<PrefSetting>* aPrefs);
#ifdef DEBUG
static void SetInitPhase(pref_initPhase phase);
#endif
static int64_t SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeOf); static int64_t SizeOfIncludingThisAndOtherStuff(mozilla::MallocSizeOf aMallocSizeOf);
static void DirtyCallback(); static void DirtyCallback();

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

@ -29,7 +29,6 @@
#include "prprf.h" #include "prprf.h"
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/dom/PContent.h" #include "mozilla/dom/PContent.h"
#include "mozilla/dom/ContentPrefs.h"
#include "nsQuickSort.h" #include "nsQuickSort.h"
#include "nsString.h" #include "nsString.h"
#include "nsPrintfCString.h" #include "nsPrintfCString.h"
@ -737,48 +736,13 @@ static PrefTypeFlags pref_SetValue(PrefValue* existingValue, PrefTypeFlags flags
} }
return flags; return flags;
} }
#ifdef DEBUG
static pref_initPhase gPhase = START;
void
pref_SetInitPhase(pref_initPhase phase)
{
gPhase = phase;
}
struct StringComparator
{
const char* mKey;
explicit StringComparator(const char* aKey) : mKey(aKey) {}
int operator()(const char* string) const {
return strcmp(mKey, string);
}
};
bool
inInitArray(const char* key)
{
size_t prefsLen;
size_t found;
const char** list = mozilla::dom::ContentPrefs::GetContentPrefs(&prefsLen);
return BinarySearchIf(list, 0, prefsLen,
StringComparator(key), &found);
}
#endif
PrefHashEntry* pref_HashTableLookup(const char *key) PrefHashEntry* pref_HashTableLookup(const char *key)
{ {
#ifndef MOZ_B2G #ifndef MOZ_B2G
MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(NS_IsMainThread());
#endif #endif
MOZ_ASSERT((!XRE_IsContentProcess() || gPhase != START),
"pref access before commandline prefs set");
/* If you're hitting this assertion, you've added a pref access to start up.
* Consider moving it later or add it to the whitelist in ContentPrefs.cpp
* and get review from a DOM peer
*/
MOZ_ASSERT((!XRE_IsContentProcess() || gPhase > END_INIT_PREFS || inInitArray(key)),
"accessing non-init pref before the rest of the prefs are sent");
return static_cast<PrefHashEntry*>(gHashTable->Search(key)); return static_cast<PrefHashEntry*>(gHashTable->Search(key));
} }

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

@ -10,7 +10,6 @@
#include "mozilla/MemoryReporting.h" #include "mozilla/MemoryReporting.h"
#include "mozilla/UniquePtr.h" #include "mozilla/UniquePtr.h"
#include "Preferences.h"
extern PLDHashTable* gHashTable; extern PLDHashTable* gHashTable;
@ -26,11 +25,6 @@ pref_savePrefs(PLDHashTable* aTable, uint32_t* aPrefCount);
nsresult nsresult
pref_SetPref(const mozilla::dom::PrefSetting& aPref); pref_SetPref(const mozilla::dom::PrefSetting& aPref);
#ifdef DEBUG
void
pref_SetInitPhase(pref_initPhase phase);
#endif
int pref_CompareStrings(const void *v1, const void *v2, void* unused); int pref_CompareStrings(const void *v1, const void *v2, void* unused);
PrefHashEntry* pref_HashTableLookup(const char *key); PrefHashEntry* pref_HashTableLookup(const char *key);

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

@ -625,8 +625,49 @@ XRE_InitChildProcess(int aArgc,
process = new PluginProcessChild(parentPID); process = new PluginProcessChild(parentPID);
break; break;
case GeckoProcessType_Content: case GeckoProcessType_Content: {
process = new ContentProcess(parentPID); process = new ContentProcess(parentPID);
// If passed in grab the application path for xpcom init
bool foundAppdir = false;
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
// If passed in grab the profile path for sandboxing
bool foundProfile = false;
#endif
for (int idx = aArgc; idx > 0; idx--) {
if (aArgv[idx] && !strcmp(aArgv[idx], "-appdir")) {
MOZ_ASSERT(!foundAppdir);
if (foundAppdir) {
continue;
}
nsCString appDir;
appDir.Assign(nsDependentCString(aArgv[idx+1]));
static_cast<ContentProcess*>(process.get())->SetAppDir(appDir);
foundAppdir = true;
}
#if defined(XP_MACOSX) && defined(MOZ_CONTENT_SANDBOX)
if (aArgv[idx] && !strcmp(aArgv[idx], "-profile")) {
MOZ_ASSERT(!foundProfile);
if (foundProfile) {
continue;
}
nsCString profile;
profile.Assign(nsDependentCString(aArgv[idx+1]));
static_cast<ContentProcess*>(process.get())->SetProfile(profile);
foundProfile = true;
}
if (foundProfile && foundAppdir) {
break;
}
#else
if (foundAppdir) {
break;
}
#endif /* XP_MACOSX && MOZ_CONTENT_SANDBOX */
}
}
break; break;
case GeckoProcessType_IPDLUnitTest: case GeckoProcessType_IPDLUnitTest:
@ -649,7 +690,7 @@ XRE_InitChildProcess(int aArgc,
MOZ_CRASH("Unknown main thread class"); MOZ_CRASH("Unknown main thread class");
} }
if (!process->Init(aArgc, aArgv)) { if (!process->Init()) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }