2022-03-29 20:36:22 +01:00
|
|
|
/*
|
2023-04-13 00:47:15 +02:00
|
|
|
* Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
|
2022-03-29 20:36:22 +01:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <LibJS/Contrib/Test262/IsHTMLDDA.h>
|
|
|
|
#include <LibJS/Runtime/GlobalObject.h>
|
|
|
|
|
|
|
|
namespace JS::Test262 {
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DEFINE_ALLOCATOR(IsHTMLDDA);
|
2023-11-19 09:45:05 +01:00
|
|
|
|
2022-08-16 00:20:49 +01:00
|
|
|
IsHTMLDDA::IsHTMLDDA(Realm& realm)
|
2022-03-29 20:36:22 +01:00
|
|
|
// NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
|
2025-08-02 19:27:29 -04:00
|
|
|
: NativeFunction("IsHTMLDDA"_utf16_fly_string, realm.intrinsics().function_prototype())
|
2022-03-29 20:36:22 +01:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ThrowCompletionOr<Value> IsHTMLDDA::call()
|
|
|
|
{
|
|
|
|
auto& vm = this->vm();
|
|
|
|
if (vm.argument_count() == 0)
|
|
|
|
return js_null();
|
2023-08-08 19:30:07 +02:00
|
|
|
if (vm.argument(0).is_string() && vm.argument(0).as_string().is_empty())
|
2022-03-29 20:36:22 +01:00
|
|
|
return js_null();
|
|
|
|
// Not sure if this really matters, INTERPRETING.md simply says:
|
|
|
|
// * IsHTMLDDA - (present only in implementations that can provide it) an object that:
|
|
|
|
// a. has an [[IsHTMLDDA]] internal slot, and
|
|
|
|
// b. when called with no arguments or with the first argument "" (an empty string) returns null.
|
|
|
|
return js_undefined();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|