From 17b23692fe309927badba0617b7679ed50d46acb Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Wed, 19 Apr 2023 22:34:54 -0700 Subject: [PATCH] #659: tuneups and edgecases --- layout/style/nsCSSParser.cpp | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index a4f598fa4..38026e25f 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1592,22 +1592,29 @@ CSSParserImpl::InitScanner(nsCSSScanner& aScanner, mSheetPrincipal = aSheetPrincipal; mHavePushBack = false; + // TenFourFox issue 659 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); + bool isChrome; + + // Never turn on grid for browser chrome. + nsresult rv = mBaseURI->SchemeIs("chrome", &isChrome); + if (NS_SUCCEEDED(rv) && !isChrome) { + // Get host and check pref. + rv = mBaseURI->GetHost(host); + if (NS_SUCCEEDED(rv) && !host.IsEmpty()) { + 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()); + if (mHostCSSGridOK) + fprintf(stderr, "CSS grid enabled for %s\n", pref.get()); #endif + } } } }