Bug 1202908 part 2 - Remove CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP. r=dbaron

This commit is contained in:
Xidorn Quan 2015-09-11 16:00:10 +10:00
parent 1a048ac363
commit acec4ee652
6 changed files with 9 additions and 61 deletions

View File

@ -9,16 +9,7 @@ propList = eval(sys.stdin.read())
props = ""
for [name, prop, id, flags, pref] in propList:
extendedAttrs = ["Throws", "TreatNullAs=EmptyString"]
# To limit the overhead of Func= annotations, we only generate them when
# necessary, which is when the
# CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP flag is set.
# Otherwise, we try to get by with just a Pref= annotation or no annotation
# at all.
if "CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP" in flags:
extendedAttrs.append('Func="IsCSSPropertyExposedToJS<eCSSProperty_%s>"' % id)
# The following is an 'elif' because it is the responsibility of
# IsCSSPropertyExposedToJS to handle the pref if there is one.
elif pref is not "":
if pref is not "":
extendedAttrs.append('Pref="%s"' % pref)
if not prop.startswith("Moz"):
prop = prop[0].lower() + prop[1:]

View File

@ -321,9 +321,6 @@ public:
if (mUnsafeRulesEnabled) {
enabledState |= nsCSSProps::eEnabledInUASheets;
}
if (mIsChromeOrCertifiedApp) {
enabledState |= nsCSSProps::eEnabledInChromeOrCertifiedApp;
}
return enabledState;
}
@ -1207,12 +1204,6 @@ protected:
// True if unsafe rules should be allowed
bool mUnsafeRulesEnabled : 1;
// True if we are in parsing rules for Chrome or Certified App content,
// in which case CSS properties with the
// CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP
// flag should be allowed.
bool mIsChromeOrCertifiedApp : 1;
// True if viewport units should be allowed.
bool mViewportUnitsEnabled : 1;
@ -1335,7 +1326,6 @@ CSSParserImpl::CSSParserImpl()
mHashlessColorQuirk(false),
mUnitlessLengthQuirk(false),
mUnsafeRulesEnabled(false),
mIsChromeOrCertifiedApp(false),
mViewportUnitsEnabled(true),
mHTMLMediaMode(false),
mParsingCompoundProperty(false),
@ -1487,9 +1477,6 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
}
mUnsafeRulesEnabled = aAllowUnsafeRules;
mIsChromeOrCertifiedApp =
dom::IsChromeURI(aSheetURI) ||
aSheetPrincipal->GetAppStatus() == nsIPrincipal::APP_STATUS_CERTIFIED;
nsCSSToken* tk = &mToken;
for (;;) {
@ -1513,7 +1500,6 @@ CSSParserImpl::ParseSheet(const nsAString& aInput,
ReleaseScanner();
mUnsafeRulesEnabled = false;
mIsChromeOrCertifiedApp = false;
// XXX check for low level errors
return NS_OK;

View File

@ -4151,8 +4151,7 @@ CSS_PROP_DISPLAY(
will_change,
WillChange,
CSS_PROPERTY_PARSE_FUNCTION |
CSS_PROPERTY_VALUE_LIST_USES_COMMAS |
CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP,
CSS_PROPERTY_VALUE_LIST_USES_COMMAS,
"",
0,
nullptr,

View File

@ -199,13 +199,11 @@ nsCSSProps::AddRefTable(void)
#ifdef DEBUG
{
// Assert that if CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS or
// CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP is used on
// a shorthand property that all of its component longhands also
// has the flag.
// Assert that if CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS is used
// on a shorthand property that all of its component longhands
// also has the flag.
static uint32_t flagsToCheck[] = {
CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS,
CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP
CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS
};
for (nsCSSProperty shorthand = eCSSProperty_COUNT_no_shorthands;
shorthand < eCSSProperty_COUNT;

View File

@ -207,13 +207,7 @@ static_assert((CSS_PROPERTY_PARSE_PROPERTY_MASK &
// In other words, this bit has no effect on the use of aliases.
#define CSS_PROPERTY_ALWAYS_ENABLED_IN_UA_SHEETS (1<<22)
// This property is always enabled in chrome and in certified apps. This is
// meant to be used together with a pref that enables the property for
// non-privileged content. Note that if such a property has an alias, then any
// use of that alias in privileged content will still be ignored unless the
// pref is enabled. In other words, this bit has no effect on the use of
// aliases.
#define CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP (1<<23)
// XXX (1<<23) will shortly be reused in bug 1069192.
// This property's unitless values are pixels.
#define CSS_PROPERTY_NUMBERS_ARE_PIXELS (1<<24)
@ -299,8 +293,6 @@ public:
eEnabledForAllContent = 0,
// Enable a property in UA sheets.
eEnabledInUASheets = 0x01,
// Enable a property in privileged content, i.e. chrome or Certified Apps
eEnabledInChromeOrCertifiedApp = 0x02,
// Special value to unconditionally enable a property. This implies all the
// bits above, but is strictly more than just their OR-ed union.
// This just skips any test so a property will be enabled even if it would
@ -544,11 +536,6 @@ public:
{
return true;
}
if ((aEnabled & eEnabledInChromeOrCertifiedApp) &&
PropHasFlags(aProperty, CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP))
{
return true;
}
return false;
}

View File

@ -435,21 +435,8 @@ nsDOMCSSDeclaration::RemoveCustomProperty(const nsAString& aPropertyName)
bool IsCSSPropertyExposedToJS(nsCSSProperty aProperty, JSContext* cx, JSObject* obj)
{
MOZ_ASSERT_UNREACHABLE("This is currently not used anywhere, "
"but should be reused soon in bug 1069192");
nsCSSProps::EnabledState enabledState = nsCSSProps::eEnabledForAllContent;
// Optimization: we skip checking properties of the JSContext
// in the majority case where the property does not have the
// CSS_PROPERTY_ALWAYS_ENABLED_IN_PRIVILEGED_CONTENT flag.
bool isEnabledInChromeOrCertifiedApp
= nsCSSProps::PropHasFlags(aProperty,
CSS_PROPERTY_ALWAYS_ENABLED_IN_CHROME_OR_CERTIFIED_APP);
if (isEnabledInChromeOrCertifiedApp) {
if (dom::IsInCertifiedApp(cx, obj) ||
nsContentUtils::ThreadsafeIsCallerChrome())
{
enabledState |= nsCSSProps::eEnabledInChromeOrCertifiedApp;
}
}
return nsCSSProps::IsEnabled(aProperty, enabledState);
}