IsHTMLDDA.cpp 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Contrib/Test262/IsHTMLDDA.h>
  7. #include <LibJS/Runtime/GlobalObject.h>
  8. namespace JS::Test262 {
  9. GC_DEFINE_ALLOCATOR(IsHTMLDDA);
  10. IsHTMLDDA::IsHTMLDDA(Realm& realm)
  11. // NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
  12. : NativeFunction("IsHTMLDDA", realm.intrinsics().function_prototype())
  13. {
  14. }
  15. ThrowCompletionOr<Value> IsHTMLDDA::call()
  16. {
  17. auto& vm = this->vm();
  18. if (vm.argument_count() == 0)
  19. return js_null();
  20. if (vm.argument(0).is_string() && vm.argument(0).as_string().is_empty())
  21. return js_null();
  22. // Not sure if this really matters, INTERPRETING.md simply says:
  23. // * IsHTMLDDA - (present only in implementations that can provide it) an object that:
  24. // a. has an [[IsHTMLDDA]] internal slot, and
  25. // b. when called with no arguments or with the first argument "" (an empty string) returns null.
  26. return js_undefined();
  27. }
  28. }