#659: initial support for per-host CSS grid whitelist
This commit is contained in:
parent
2488fabc48
commit
c889bc5ce1
|
@ -174,6 +174,9 @@ static ContentMap& GetContentMap() {
|
||||||
// When the pref "layout.css.grid.enabled" changes, this function is invoked
|
// When the pref "layout.css.grid.enabled" changes, this function is invoked
|
||||||
// to let us update kDisplayKTable, to selectively disable or restore the
|
// to let us update kDisplayKTable, to selectively disable or restore the
|
||||||
// entries for "grid" and "inline-grid" in that table.
|
// entries for "grid" and "inline-grid" in that table.
|
||||||
|
//
|
||||||
|
// NB: as of TenFourFox issue 659, a whitelist entry per host is also required
|
||||||
|
// to enable (but turning it off turns it off globally).
|
||||||
static void
|
static void
|
||||||
GridEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
|
GridEnabledPrefChangeCallback(const char* aPrefName, void* aClosure)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1439,6 +1439,10 @@ protected:
|
||||||
// Value to make sure our resolved variable results stay within sane limits.
|
// Value to make sure our resolved variable results stay within sane limits.
|
||||||
const uint32_t MAX_CSS_VAR_LENGTH = 10240;
|
const uint32_t MAX_CSS_VAR_LENGTH = 10240;
|
||||||
|
|
||||||
|
// TenFourFox issue 659
|
||||||
|
// If this host is whitelisted, turn on CSS grid and inline grid.
|
||||||
|
bool mHostCSSGridOK : 1;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Used from nsCSSParser constructors and destructors
|
// Used from nsCSSParser constructors and destructors
|
||||||
CSSParserImpl* mNextFree;
|
CSSParserImpl* mNextFree;
|
||||||
|
@ -1587,6 +1591,25 @@ CSSParserImpl::InitScanner(nsCSSScanner& aScanner,
|
||||||
mSheetURI = aSheetURI;
|
mSheetURI = aSheetURI;
|
||||||
mSheetPrincipal = aSheetPrincipal;
|
mSheetPrincipal = aSheetPrincipal;
|
||||||
mHavePushBack = false;
|
mHavePushBack = false;
|
||||||
|
|
||||||
|
mHostCSSGridOK = false;
|
||||||
|
if (MOZ_LIKELY(mBaseURI)) {
|
||||||
|
nsCString host;
|
||||||
|
|
||||||
|
nsresult rv = mBaseURI->GetHost(host);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
nsCString pref;
|
||||||
|
|
||||||
|
pref.AssignLiteral("layout.css.grid.host.");
|
||||||
|
pref.SetCapacity(pref.Length() + host.Length());
|
||||||
|
pref += host;
|
||||||
|
mHostCSSGridOK = Preferences::GetBool(pref.get(), false);
|
||||||
|
#if DEBUG
|
||||||
|
if (mHostCSSGridOK)
|
||||||
|
fprintf(stderr, "CSS grid enabled for %s\n", pref.get());
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -7586,6 +7609,14 @@ CSSParserImpl::ParseVariant(nsCSSValue& aValue,
|
||||||
}
|
}
|
||||||
if ((aVariantMask & VARIANT_KEYWORD) != 0) {
|
if ((aVariantMask & VARIANT_KEYWORD) != 0) {
|
||||||
int32_t value;
|
int32_t value;
|
||||||
|
|
||||||
|
// TenFourFox issue 659
|
||||||
|
if (MOZ_UNLIKELY(!mHostCSSGridOK &&
|
||||||
|
aKeywordTable == nsCSSProps::kDisplayKTable &&
|
||||||
|
(keyword == eCSSKeyword_grid ||
|
||||||
|
keyword == eCSSKeyword_inline_grid))) {
|
||||||
|
// pretend the keyword wasn't found
|
||||||
|
} else
|
||||||
if (nsCSSProps::FindKeyword(keyword, aKeywordTable, value)) {
|
if (nsCSSProps::FindKeyword(keyword, aKeywordTable, value)) {
|
||||||
aValue.SetIntValue(value, eCSSUnit_Enumerated);
|
aValue.SetIntValue(value, eCSSUnit_Enumerated);
|
||||||
return CSSParseResult::Ok;
|
return CSSParseResult::Ok;
|
||||||
|
|
|
@ -2395,11 +2395,10 @@ pref("layout.css.variables.enabled", true);
|
||||||
pref("layout.css.overflow-clip-box.enabled", false);
|
pref("layout.css.overflow-clip-box.enabled", false);
|
||||||
|
|
||||||
// Is support for CSS grid enabled?
|
// Is support for CSS grid enabled?
|
||||||
#ifdef RELEASE_BUILD
|
// TenFourFox issue 659 makes this into a per-host whitelist.
|
||||||
pref("layout.css.grid.enabled", false);
|
|
||||||
#else
|
|
||||||
pref("layout.css.grid.enabled", true);
|
pref("layout.css.grid.enabled", true);
|
||||||
#endif
|
// Whitelist by default:
|
||||||
|
pref("layout.css.grid.host.developer.mozilla.org", true);
|
||||||
|
|
||||||
// Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
|
// Is support for CSS "grid-template-{columns,rows}: subgrid X" enabled?
|
||||||
pref("layout.css.grid-template-subgrid-value.enabled", false);
|
pref("layout.css.grid-template-subgrid-value.enabled", false);
|
||||||
|
|
Loading…
Reference in New Issue