Index: Source/core/css/CSSGroupingRule.cpp |
diff --git a/Source/core/css/CSSGroupingRule.cpp b/Source/core/css/CSSGroupingRule.cpp |
index 24f7147f6407a066f6618ece6732a452f8215773..f0b932981fa4ca93ae0dbdf528a0c98eea3766f7 100644 |
--- a/Source/core/css/CSSGroupingRule.cpp |
+++ b/Source/core/css/CSSGroupingRule.cpp |
@@ -71,13 +71,16 @@ unsigned CSSGroupingRule::insertRule(const String& ruleString, unsigned index, E |
CSSStyleSheet* styleSheet = parentStyleSheet(); |
CSSParserContext context(parserContext(), UseCounter::getFrom(styleSheet)); |
RefPtrWillBeRawPtr<StyleRuleBase> newRule = CSSParser::parseRule(context, styleSheet ? styleSheet->contents() : nullptr, ruleString); |
- // FIXME: @namespace rules have special handling in the CSSOM spec, but it |
- // mostly doesn't make sense since we don't support CSSNamespaceRule |
- if (!newRule || newRule->isNamespaceRule()) { |
+ if (!newRule) { |
exceptionState.throwDOMException(SyntaxError, "the rule '" + ruleString + "' is invalid and cannot be parsed."); |
return 0; |
} |
+ if (newRule->isNamespaceRule()) { |
+ exceptionState.throwDOMException(HierarchyRequestError, "'@namespace' rules cannot be inserted inside a group rule."); |
+ return 0; |
+ } |
+ |
if (newRule->isImportRule()) { |
// FIXME: an HierarchyRequestError should also be thrown for a nested @media rule. They are |
// currently not getting parsed, resulting in a SyntaxError to get raised above. |