mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:37:44 +00:00
LibJS: Import C++ sources from libjs-test262 :^)
This commit upstreams most of the C++ bits of the LibJS test262 runner at https://github.com/linusg/libjs-test262/, specifically everything but the main.cpp file serving as the actual executable. Since all of these are just regular JS objects, I opted to put them in LibJS itself, in a new Contrib/ directory like many other projects have one. Other code that can end up there in the future is the runtime for esvu, which might even share some functionality with test262's $262 object. The code has been copied verbatim, and only a small number of changes have been made: - Putting everything into the JS::Test262 namespace - Removing now redundant JS namespace prefixes - Updating includes to use absolute <LibJS/...> paths - Updating the SPDX-License-Identifier comments from MIT to BSD-2-Clause I gained permission to change the license and upstream these changes from all the major contributors to this code: Ali, Andrew, David, Idan. The removal of the code from the source repository is here: https://github.com/linusg/libjs-test262/pull/54 This is only the first step, the goal is to eventually upstream the actual libjs-test262-runner executable and supporting Python scripts into SerenityOS as well.
This commit is contained in:
parent
e7eb6241c2
commit
1e01a85cdf
9 changed files with 343 additions and 0 deletions
28
Userland/Libraries/LibJS/Contrib/Test262/IsHTMLDDA.h
Normal file
28
Userland/Libraries/LibJS/Contrib/Test262/IsHTMLDDA.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Copyright (c) 2021, Linus Groh <linusg@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibJS/Runtime/NativeFunction.h>
|
||||
|
||||
namespace JS::Test262 {
|
||||
|
||||
class IsHTMLDDA final : public NativeFunction {
|
||||
JS_OBJECT(IsHTMLDDA, NativeFunction);
|
||||
|
||||
public:
|
||||
explicit IsHTMLDDA(JS::GlobalObject&);
|
||||
virtual ~IsHTMLDDA() override = default;
|
||||
|
||||
virtual ThrowCompletionOr<Value> call() override;
|
||||
virtual ThrowCompletionOr<Object*> construct(FunctionObject& new_target) override;
|
||||
|
||||
private:
|
||||
virtual bool has_constructor() const override { return true; }
|
||||
virtual bool is_htmldda() const override { return true; }
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue