mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 22:49:47 +00:00
LibJS+LibWeb: Port interned bytecode strings to UTF-16
This was almost a no-op, except we intern JS exception messages. So the bulk of this patch is porting exception messages to UTF-16.
This commit is contained in:
parent
cf61171864
commit
70db474cf0
Notes:
github-actions[bot]
2025-08-14 08:28:16 +00:00
Author: https://github.com/trflynn89
Commit: 70db474cf0
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5845
Reviewed-by: https://github.com/gmta ✅
162 changed files with 1405 additions and 1422 deletions
|
@ -20,9 +20,9 @@ WebIDL::ExceptionOr<GC::Ref<CanvasGradient>> CanvasGradient::create_radial(JS::R
|
|||
{
|
||||
// If either of r0 or r1 are negative, then an "IndexSizeError" DOMException must be thrown.
|
||||
if (r0 < 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "The r0 passed is less than 0"_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "The r0 passed is less than 0"_utf16);
|
||||
if (r1 < 0)
|
||||
return WebIDL::IndexSizeError::create(realm, "The r1 passed is less than 0"_string);
|
||||
return WebIDL::IndexSizeError::create(realm, "The r1 passed is less than 0"_utf16);
|
||||
|
||||
auto radial_gradient = TRY_OR_THROW_OOM(realm.vm(), Gfx::CanvasRadialGradientPaintStyle::create(Gfx::FloatPoint { x0, y0 }, r0, Gfx::FloatPoint { x1, y1 }, r1));
|
||||
return realm.create<CanvasGradient>(realm, *radial_gradient);
|
||||
|
@ -61,14 +61,14 @@ WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, StringVi
|
|||
{
|
||||
// 1. If the offset is less than 0 or greater than 1, then throw an "IndexSizeError" DOMException.
|
||||
if (offset < 0 || offset > 1)
|
||||
return WebIDL::IndexSizeError::create(realm(), "CanvasGradient color stop offset out of bounds"_string);
|
||||
return WebIDL::IndexSizeError::create(realm(), "CanvasGradient color stop offset out of bounds"_utf16);
|
||||
|
||||
// 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 WebIDL::SyntaxError::create(realm(), "Could not parse color for CanvasGradient"_string);
|
||||
return WebIDL::SyntaxError::create(realm(), "Could not parse color for CanvasGradient"_utf16);
|
||||
|
||||
// 4. Place a new stop on the gradient, at offset offset relative to the whole gradient, and with the color parsed color.
|
||||
TRY_OR_THROW_OOM(realm().vm(), m_gradient->add_color_stop(offset, parsed_color.value()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue