mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 23:27:43 +00:00
LibWeb: Make DOMException GC-allocated
This commit is contained in:
parent
0e47754ac8
commit
497ead37bc
58 changed files with 307 additions and 278 deletions
|
@ -55,7 +55,7 @@ DOM::ExceptionOr<unsigned> CSSRuleList::insert_a_css_rule(Variant<StringView, CS
|
|||
|
||||
// 2. If index is greater than length, then throw an IndexSizeError exception.
|
||||
if (index > length)
|
||||
return DOM::IndexSizeError::create("CSS rule index out of bounds.");
|
||||
return DOM::IndexSizeError::create(global_object(), "CSS rule index out of bounds.");
|
||||
|
||||
// 3. Set new rule to the results of performing parse a CSS rule on argument rule.
|
||||
// NOTE: The insert-a-css-rule spec expects `rule` to be a string, but the CSSStyleSheet.insertRule()
|
||||
|
@ -72,7 +72,7 @@ DOM::ExceptionOr<unsigned> CSSRuleList::insert_a_css_rule(Variant<StringView, CS
|
|||
|
||||
// 4. If new rule is a syntax error, throw a SyntaxError exception.
|
||||
if (!new_rule)
|
||||
return DOM::SyntaxError::create("Unable to parse CSS rule.");
|
||||
return DOM::SyntaxError::create(global_object(), "Unable to parse CSS rule.");
|
||||
|
||||
// FIXME: 5. If new rule cannot be inserted into list at the zero-index position index due to constraints specified by CSS, then throw a HierarchyRequestError exception. [CSS21]
|
||||
|
||||
|
@ -93,7 +93,7 @@ DOM::ExceptionOr<void> CSSRuleList::remove_a_css_rule(u32 index)
|
|||
|
||||
// 2. If index is greater than or equal to length, then throw an IndexSizeError exception.
|
||||
if (index >= length)
|
||||
return DOM::IndexSizeError::create("CSS rule index out of bounds.");
|
||||
return DOM::IndexSizeError::create(global_object(), "CSS rule index out of bounds.");
|
||||
|
||||
// 3. Set old rule to the indexth item in list.
|
||||
CSSRule& old_rule = m_rules[index];
|
||||
|
|
|
@ -50,7 +50,7 @@ DOM::ExceptionOr<unsigned> CSSStyleSheet::insert_rule(StringView rule, unsigned
|
|||
|
||||
// 4. If parsed rule is a syntax error, return parsed rule.
|
||||
if (!parsed_rule)
|
||||
return DOM::SyntaxError::create("Unable to parse CSS rule.");
|
||||
return DOM::SyntaxError::create(global_object(), "Unable to parse CSS rule.");
|
||||
|
||||
// FIXME: 5. If parsed rule is an @import rule, and the constructed flag is set, throw a SyntaxError DOMException.
|
||||
|
||||
|
|
|
@ -520,14 +520,14 @@ Optional<StyleProperty> ResolvedCSSStyleDeclaration::property(PropertyID propert
|
|||
DOM::ExceptionOr<void> ResolvedCSSStyleDeclaration::set_property(PropertyID, StringView, StringView)
|
||||
{
|
||||
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
|
||||
return DOM::NoModificationAllowedError::create("Cannot modify properties in result of getComputedStyle()");
|
||||
return DOM::NoModificationAllowedError::create(global_object(), "Cannot modify properties in result of getComputedStyle()");
|
||||
}
|
||||
|
||||
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-removeproperty
|
||||
DOM::ExceptionOr<String> ResolvedCSSStyleDeclaration::remove_property(PropertyID)
|
||||
{
|
||||
// 1. If the computed flag is set, then throw a NoModificationAllowedError exception.
|
||||
return DOM::NoModificationAllowedError::create("Cannot remove properties from result of getComputedStyle()");
|
||||
return DOM::NoModificationAllowedError::create(global_object(), "Cannot remove properties from result of getComputedStyle()");
|
||||
}
|
||||
|
||||
String ResolvedCSSStyleDeclaration::serialized() const
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue