1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

LibWeb: Use StringView literals for all WebIDL::SimpleExceptions

This commit is contained in:
Linus Groh 2022-10-27 23:18:16 +01:00
parent 14d4f227f2
commit 6ce08d3f75
6 changed files with 22 additions and 22 deletions

View file

@ -53,22 +53,22 @@ WebIDL::ExceptionOr<void> MutationObserver::observe(Node& target, MutationObserv
// 3. If none of options["childList"], options["attributes"], and options["characterData"] is true, then throw a TypeError.
if (!options.child_list && (!options.attributes.has_value() || !options.attributes.value()) && (!options.character_data.has_value() || !options.character_data.value()))
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Options must have one of childList, attributes or characterData set to true." };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "Options must have one of childList, attributes or characterData set to true."sv };
// 4. If options["attributeOldValue"] is true and options["attributes"] is false, then throw a TypeError.
// NOTE: If attributeOldValue is present, attributes will be present because of step 1.
if (options.attribute_old_value.has_value() && options.attribute_old_value.value() && !options.attributes.value())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeOldValue is true." };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeOldValue is true."sv };
// 5. If options["attributeFilter"] is present and options["attributes"] is false, then throw a TypeError.
// NOTE: If attributeFilter is present, attributes will be present because of step 1.
if (options.attribute_filter.has_value() && !options.attributes.value())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeFilter is present." };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "attributes must be true if attributeFilter is present."sv };
// 6. If options["characterDataOldValue"] is true and options["characterData"] is false, then throw a TypeError.
// NOTE: If characterDataOldValue is present, characterData will be present because of step 2.
if (options.character_data_old_value.has_value() && options.character_data_old_value.value() && !options.character_data.value())
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "characterData must be true if characterDataOldValue is true." };
return WebIDL::SimpleException { WebIDL::SimpleExceptionType::TypeError, "characterData must be true if characterDataOldValue is true."sv };
// 7. For each registered of targets registered observer list, if registereds observer is this:
bool updated_existing_observer = false;