зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1426223 - remove Stylo domain blocklist mechanism. r=xidorn
MozReview-Commit-ID: 2Kcla56H3wJ
This commit is contained in:
Родитель
44323b73ae
Коммит
8d7d5e5ea5
|
@ -178,10 +178,6 @@ const char* mozilla::dom::ContentPrefs::gEarlyPrefs[] = {
|
|||
"layout.css.servo.enabled",
|
||||
#endif
|
||||
"layout.css.shape-outside.enabled",
|
||||
#ifdef MOZ_STYLO
|
||||
"layout.css.stylo-blocklist.blocked_domains",
|
||||
"layout.css.stylo-blocklist.enabled",
|
||||
#endif
|
||||
"layout.css.text-align-unsafe-value.enabled",
|
||||
"layout.css.text-combine-upright-digits.enabled",
|
||||
"layout.css.text-combine-upright.enabled",
|
||||
|
|
|
@ -129,7 +129,6 @@
|
|||
#include "DisplayListChecker.h"
|
||||
#include "TextDrawTarget.h"
|
||||
#include "nsDeckFrame.h"
|
||||
#include "nsIEffectiveTLDService.h" // for IsInStyloBlocklist
|
||||
#include "mozilla/StylePrefs.h"
|
||||
#include "mozilla/dom/InspectorFontFace.h"
|
||||
|
||||
|
@ -196,8 +195,6 @@ typedef nsStyleTransformMatrix::TransformReferenceBox TransformReferenceBox;
|
|||
/* static */ bool nsLayoutUtils::sTextCombineUprightDigitsEnabled;
|
||||
#ifdef MOZ_STYLO
|
||||
/* static */ bool nsLayoutUtils::sStyloEnabled;
|
||||
/* static */ bool nsLayoutUtils::sStyloBlocklistEnabled;
|
||||
/* static */ nsTArray<nsCString>* nsLayoutUtils::sStyloBlocklist = nullptr;
|
||||
#endif
|
||||
/* static */ uint32_t nsLayoutUtils::sIdlePeriodDeadlineLimit;
|
||||
/* static */ uint32_t nsLayoutUtils::sQuiescentFramesBeforeIdlePeriod;
|
||||
|
@ -8231,24 +8228,6 @@ nsLayoutUtils::Initialize()
|
|||
Preferences::AddBoolVarCache(&sStyloEnabled,
|
||||
"layout.css.servo.enabled");
|
||||
}
|
||||
// We should only create the blocklist ONCE, and ignore any blocklist
|
||||
// reloads happen. Because otherwise we could have a top level page that
|
||||
// uses Stylo (if its load happens before the blocklist reload) and a
|
||||
// child iframe that uses Gecko (if its load happens after the blocklist
|
||||
// reload). If some page contains both backends, and they try to move
|
||||
// element across backend boundary, it could crash (see bug 1404020).
|
||||
sStyloBlocklistEnabled =
|
||||
Preferences::GetBool("layout.css.stylo-blocklist.enabled");
|
||||
if (sStyloBlocklistEnabled && !sStyloBlocklist) {
|
||||
nsAutoCString blocklist;
|
||||
Preferences::GetCString("layout.css.stylo-blocklist.blocked_domains", blocklist);
|
||||
if (!blocklist.IsEmpty()) {
|
||||
sStyloBlocklist = new nsTArray<nsCString>;
|
||||
for (const nsACString& domainString : blocklist.Split(',')) {
|
||||
sStyloBlocklist->AppendElement(domainString);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
Preferences::AddUintVarCache(&sIdlePeriodDeadlineLimit,
|
||||
"layout.idle_period.time_limit",
|
||||
|
@ -8271,13 +8250,7 @@ nsLayoutUtils::Shutdown()
|
|||
delete sContentMap;
|
||||
sContentMap = nullptr;
|
||||
}
|
||||
#ifdef MOZ_STYLO
|
||||
if (sStyloBlocklist) {
|
||||
sStyloBlocklist->Clear();
|
||||
delete sStyloBlocklist;
|
||||
sStyloBlocklist = nullptr;
|
||||
}
|
||||
#endif
|
||||
|
||||
for (auto& callback : kPrefCallbacks) {
|
||||
Preferences::UnregisterCallback(callback.func, callback.name);
|
||||
}
|
||||
|
@ -8300,44 +8273,10 @@ nsLayoutUtils::ShouldUseStylo(nsIPrincipal* aPrincipal)
|
|||
nsContentUtils::IsSystemPrincipal(aPrincipal)) {
|
||||
return false;
|
||||
}
|
||||
// Check the stylo block list.
|
||||
if (IsInStyloBlocklist(aPrincipal)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsLayoutUtils::IsInStyloBlocklist(nsIPrincipal* aPrincipal)
|
||||
{
|
||||
if (!sStyloBlocklist) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Note that a non-codebase principal (eg the system principal) will return
|
||||
// a null URI.
|
||||
nsCOMPtr<nsIURI> codebaseURI;
|
||||
aPrincipal->GetURI(getter_AddRefs(codebaseURI));
|
||||
if (!codebaseURI) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIEffectiveTLDService> tldService =
|
||||
do_GetService(NS_EFFECTIVETLDSERVICE_CONTRACTID);
|
||||
NS_ENSURE_TRUE(tldService, false);
|
||||
|
||||
// Check if a document's eTLD+1 domain belongs to one of the stylo blocklist.
|
||||
nsAutoCString baseDomain;
|
||||
NS_SUCCEEDED(tldService->GetBaseDomain(codebaseURI, 0, baseDomain));
|
||||
for (const nsCString& domains : *sStyloBlocklist) {
|
||||
if (baseDomain.Equals(domains)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsLayoutUtils::StyloChromeEnabled()
|
||||
|
|
|
@ -2585,15 +2585,6 @@ public:
|
|||
* Return whether stylo should be used for a given document principal.
|
||||
*/
|
||||
static bool ShouldUseStylo(nsIPrincipal* aPrincipal);
|
||||
|
||||
/**
|
||||
* Principal-based blocklist for stylo.
|
||||
* Check if aPrincipal is blocked by stylo's blocklist and should fallback to
|
||||
* use Gecko's style backend. Note that using a document's principal rather
|
||||
* than the document URI will let us piggy-back off the existing principal
|
||||
* relationships and symmetries.
|
||||
*/
|
||||
static bool IsInStyloBlocklist(nsIPrincipal* aPrincipal);
|
||||
#else
|
||||
static bool ShouldUseStylo(nsIPrincipal* aPrincipal) {
|
||||
return false;
|
||||
|
@ -3119,8 +3110,6 @@ private:
|
|||
static bool sTextCombineUprightDigitsEnabled;
|
||||
#ifdef MOZ_STYLO
|
||||
static bool sStyloEnabled;
|
||||
static bool sStyloBlocklistEnabled;
|
||||
static nsTArray<nsCString>* sStyloBlocklist;
|
||||
#endif
|
||||
static uint32_t sIdlePeriodDeadlineLimit;
|
||||
static uint32_t sQuiescentFramesBeforeIdlePeriod;
|
||||
|
|
|
@ -5804,9 +5804,6 @@ pref("media.block-autoplay-until-in-foreground", true);
|
|||
// Is Stylo CSS support built and enabled?
|
||||
// Only define these prefs if Stylo support is actually built in.
|
||||
#ifdef MOZ_STYLO
|
||||
// XXX: We should flip this pref to true once the blocked_domains is non-empty.
|
||||
pref("layout.css.stylo-blocklist.enabled", false);
|
||||
pref("layout.css.stylo-blocklist.blocked_domains", "");
|
||||
#ifdef MOZ_STYLO_ENABLE
|
||||
pref("layout.css.servo.enabled", true);
|
||||
#else
|
||||
|
|
Загрузка…
Ссылка в новой задаче