Index: Source/core/css/CSSStyleSheet.cpp |
diff --git a/Source/core/css/CSSStyleSheet.cpp b/Source/core/css/CSSStyleSheet.cpp |
index bc9337ec5398bab38e514ec28152e47a0ef05bbf..82b9c0ebfea1b09effefbb50652ce99d09004ebd 100644 |
--- a/Source/core/css/CSSStyleSheet.cpp |
+++ b/Source/core/css/CSSStyleSheet.cpp |
@@ -260,21 +260,21 @@ unsigned CSSStyleSheet::insertRule(const String& ruleString, unsigned index, Exc |
ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == m_contents->ruleCount()); |
if (index > length()) { |
- exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
+ exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is larger than the maximum index (" + String::number(length()) + ")."); |
return 0; |
} |
BisonCSSParser p(m_contents->parserContext(), UseCounter::getFrom(this)); |
RefPtr<StyleRuleBase> rule = p.parseRule(m_contents.get(), ruleString); |
if (!rule) { |
- exceptionState.throwUninformativeAndGenericDOMException(SyntaxError); |
+ exceptionState.throwDOMException(SyntaxError, "Failed to parse the rule '" + ruleString + "'."); |
return 0; |
} |
RuleMutationScope mutationScope(this); |
bool success = m_contents->wrapperInsertRule(rule, index); |
if (!success) { |
- exceptionState.throwUninformativeAndGenericDOMException(HierarchyRequestError); |
+ exceptionState.throwDOMException(HierarchyRequestError, "Failed to insert the rule."); |
return 0; |
} |
if (!m_childRuleCSSOMWrappers.isEmpty()) |
@@ -294,7 +294,7 @@ void CSSStyleSheet::deleteRule(unsigned index, ExceptionState& exceptionState) |
ASSERT(m_childRuleCSSOMWrappers.isEmpty() || m_childRuleCSSOMWrappers.size() == m_contents->ruleCount()); |
if (index >= length()) { |
- exceptionState.throwUninformativeAndGenericDOMException(IndexSizeError); |
+ exceptionState.throwDOMException(IndexSizeError, "The index provided (" + String::number(index) + ") is larger than the maximum index (" + String::number(length() - 1) + ")."); |
return; |
} |
RuleMutationScope mutationScope(this); |