1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:07:44 +00:00

LibWeb: Remove unecessary dependence on Window from HTML classes

These classes only needed Window to get at its realm. Pass a realm
directly to construct HTML classes.
This commit is contained in:
Andrew Kaster 2022-09-25 16:38:21 -06:00 committed by Linus Groh
parent a2ccb00e1d
commit f0c5f77f99
122 changed files with 334 additions and 317 deletions

View file

@ -131,7 +131,7 @@ WebIDL::ExceptionOr<String> WorkerGlobalScope::btoa(String const& data) const
byte_string.ensure_capacity(data.length());
for (u32 code_point : Utf8View(data)) {
if (code_point > 0xff)
return WebIDL::InvalidCharacterError::create(global_object(), "Data contains characters outside the range U+0000 and U+00FF");
return WebIDL::InvalidCharacterError::create(realm(), "Data contains characters outside the range U+0000 and U+00FF");
byte_string.append(code_point);
}
@ -151,7 +151,7 @@ WebIDL::ExceptionOr<String> WorkerGlobalScope::atob(String const& data) const
// 2. If decodedData is failure, then throw an "InvalidCharacterError" DOMException.
if (decoded_data.is_error())
return WebIDL::InvalidCharacterError::create(global_object(), "Input string is not valid base64 data");
return WebIDL::InvalidCharacterError::create(realm(), "Input string is not valid base64 data");
// 3. Return decodedData.
// decode_base64() returns a byte string. LibJS uses UTF-8 for strings. Use Latin1Decoder to convert bytes 128-255 to UTF-8.