зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1046166 - Send userContent.css URL to content processes. r=dbaron,haik
MozReview-Commit-ID: 4NTxwYeFGSU --HG-- extra : rebase_source : 194c526eaf3270cf71de16065d425d1bb13f5847
This commit is contained in:
Родитель
af86c4853c
Коммит
8915c51723
|
@ -915,12 +915,13 @@ ContentChild::InitXPCOM()
|
|||
ClipboardCapabilities clipboardCaps;
|
||||
DomainPolicyClone domainPolicy;
|
||||
StructuredCloneData initialData;
|
||||
OptionalURIParams userContentSheetURL;
|
||||
|
||||
SendGetXPCOMProcessAttributes(&isOffline, &isConnected, &captivePortalState,
|
||||
&isLangRTL, &haveBidiKeyboards,
|
||||
&mAvailableDictionaries,
|
||||
&clipboardCaps, &domainPolicy, &initialData,
|
||||
&mFontFamilies);
|
||||
&mFontFamilies, &userContentSheetURL);
|
||||
RecvSetOffline(isOffline);
|
||||
RecvSetConnectivity(isConnected);
|
||||
RecvSetCaptivePortalState(captivePortalState);
|
||||
|
@ -959,6 +960,10 @@ ContentChild::InitXPCOM()
|
|||
global->SetInitialProcessData(data);
|
||||
}
|
||||
|
||||
// The stylesheet cache is not ready yet. Store this URL for future use.
|
||||
nsCOMPtr<nsIURI> ucsURL = DeserializeURI(userContentSheetURL);
|
||||
nsLayoutStylesheetCache::SetUserContentCSSURL(ucsURL);
|
||||
|
||||
// This will register cross-process observer.
|
||||
mozilla::dom::time::InitializeDateCacheCleaner();
|
||||
}
|
||||
|
|
|
@ -182,6 +182,8 @@
|
|||
|
||||
#include "nsIBidiKeyboard.h"
|
||||
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
|
||||
#ifdef MOZ_WEBRTC
|
||||
#include "signaling/src/peerconnection/WebrtcGlobalParent.h"
|
||||
#endif
|
||||
|
@ -2546,7 +2548,8 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
|
|||
ClipboardCapabilities* clipboardCaps,
|
||||
DomainPolicyClone* domainPolicy,
|
||||
StructuredCloneData* aInitialData,
|
||||
InfallibleTArray<FontFamilyListEntry>* fontFamilies)
|
||||
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
|
||||
OptionalURIParams* aUserContentCSSURL)
|
||||
{
|
||||
nsCOMPtr<nsIIOService> io(do_GetIOService());
|
||||
MOZ_ASSERT(io, "No IO service?");
|
||||
|
@ -2612,6 +2615,15 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
|
|||
// This is only implemented (returns a non-empty list) by MacOSX at present.
|
||||
gfxPlatform::GetPlatform()->GetSystemFontFamilyList(fontFamilies);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
|
|
|
@ -664,8 +664,8 @@ private:
|
|||
ClipboardCapabilities* clipboardCaps,
|
||||
DomainPolicyClone* domainPolicy,
|
||||
StructuredCloneData* initialData,
|
||||
InfallibleTArray<FontFamilyListEntry>* fontFamilies)
|
||||
override;
|
||||
InfallibleTArray<FontFamilyListEntry>* fontFamilies,
|
||||
OptionalURIParams* aUserContentSheetURL) override;
|
||||
|
||||
virtual bool
|
||||
DeallocPJavaScriptParent(mozilla::jsipc::PJavaScriptParent*) override;
|
||||
|
|
|
@ -694,7 +694,8 @@ parent:
|
|||
ClipboardCapabilities clipboardCaps,
|
||||
DomainPolicyClone domainPolicy,
|
||||
StructuredCloneData initialData,
|
||||
FontFamilyListEntry[] fontFamilies /* used on MacOSX only */);
|
||||
FontFamilyListEntry[] fontFamilies /* used on MacOSX only */,
|
||||
OptionalURIParams userContentSheetURL);
|
||||
|
||||
sync CreateChildProcess(IPCTabContext context,
|
||||
ProcessPriority priority,
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nsServiceManagerUtils.h"
|
||||
#include "nsIXULRuntime.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
// Includes for the crash report annotation in ErrorLoadingBuiltinSheet.
|
||||
#ifdef MOZ_CRASHREPORTER
|
||||
|
@ -248,6 +249,14 @@ nsLayoutStylesheetCache::Shutdown()
|
|||
gCSSLoader_Servo = nullptr;
|
||||
gStyleCache_Gecko = nullptr;
|
||||
gStyleCache_Servo = nullptr;
|
||||
MOZ_ASSERT(!gUserContentSheetURL, "Got the URL but never used?");
|
||||
}
|
||||
|
||||
void
|
||||
nsLayoutStylesheetCache::SetUserContentCSSURL(nsIURI* aURI)
|
||||
{
|
||||
MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes.");
|
||||
gUserContentSheetURL = aURI;
|
||||
}
|
||||
|
||||
MOZ_DEFINE_MALLOC_SIZE_OF(LayoutStylesheetCacheMallocSizeOf)
|
||||
|
@ -331,6 +340,12 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType)
|
|||
LoadSheetURL("chrome://global/content/xul.css",
|
||||
&mXULSheet, eAgentSheetFeatures);
|
||||
|
||||
if (gUserContentSheetURL) {
|
||||
MOZ_ASSERT(XRE_IsContentProcess(), "Only used in content processes.");
|
||||
LoadSheet(gUserContentSheetURL, &mUserContentSheet, eUserSheetFeatures);
|
||||
gUserContentSheetURL = nullptr;
|
||||
}
|
||||
|
||||
// The remaining sheets are created on-demand do to their use being rarer
|
||||
// (which helps save memory for Firefox OS apps) or because they need to
|
||||
// be re-loadable in DependentPrefChanged.
|
||||
|
@ -961,3 +976,6 @@ nsLayoutStylesheetCache::gCSSLoader_Gecko;
|
|||
|
||||
mozilla::StaticRefPtr<mozilla::css::Loader>
|
||||
nsLayoutStylesheetCache::gCSSLoader_Servo;
|
||||
|
||||
mozilla::StaticRefPtr<nsIURI>
|
||||
nsLayoutStylesheetCache::gUserContentSheetURL;
|
||||
|
|
|
@ -66,6 +66,8 @@ class nsLayoutStylesheetCache final
|
|||
|
||||
static void Shutdown();
|
||||
|
||||
static void SetUserContentCSSURL(nsIURI* aURI);
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
private:
|
||||
|
@ -92,6 +94,7 @@ private:
|
|||
static mozilla::StaticRefPtr<nsLayoutStylesheetCache> gStyleCache_Servo;
|
||||
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Gecko;
|
||||
static mozilla::StaticRefPtr<mozilla::css::Loader> gCSSLoader_Servo;
|
||||
static mozilla::StaticRefPtr<nsIURI> gUserContentSheetURL;
|
||||
mozilla::StyleBackendType mBackendType;
|
||||
RefPtr<mozilla::StyleSheet> mChromePreferenceSheet;
|
||||
RefPtr<mozilla::StyleSheet> mContentEditableSheet;
|
||||
|
|
Загрузка…
Ссылка в новой задаче