mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-04 15:19:16 +00:00
LibWeb: Make DOMException GC-allocated
This commit is contained in:
parent
0e47754ac8
commit
497ead37bc
Notes:
sideshowbarker
2024-07-17 23:07:41 +09:00
Author: https://github.com/awesomekling
Commit: 497ead37bc
Pull-request: https://github.com/SerenityOS/serenity/pull/14816
Reviewed-by: https://github.com/ADKaster
Reviewed-by: https://github.com/linusg ✅
58 changed files with 307 additions and 278 deletions
|
@ -53,14 +53,14 @@ DOM::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, String cons
|
|||
{
|
||||
// 1. If the offset is less than 0 or greater than 1, then throw an "IndexSizeError" DOMException.
|
||||
if (offset < 0 || offset > 1)
|
||||
return DOM::IndexSizeError::create("CanvasGradient color stop offset out of bounds");
|
||||
return DOM::IndexSizeError::create(global_object(), "CanvasGradient color stop offset out of bounds");
|
||||
|
||||
// 2. Let parsed color be the result of parsing color.
|
||||
auto parsed_color = Color::from_string(color);
|
||||
|
||||
// 3. If parsed color is failure, throw a "SyntaxError" DOMException.
|
||||
if (!parsed_color.has_value())
|
||||
return DOM::SyntaxError::create("Could not parse color for CanvasGradient");
|
||||
return DOM::SyntaxError::create(global_object(), "Could not parse color for CanvasGradient");
|
||||
|
||||
// 4. Place a new stop on the gradient, at offset offset relative to the whole gradient, and with the color parsed color.
|
||||
m_color_stops.append(ColorStop { offset, parsed_color.value() });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue