1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-17 12:35:07 +00:00
serenity/Userland/Libraries/LibWeb/Bindings/LocationObject.h
Luke Wilde ee5bac0891 LibWeb: Implement some custom JS internal overrides for Location
As required by the spec. Note that this isn't the full suite of
overrides.
2021-09-12 16:07:24 +02:00

45 lines
1.3 KiB
C++

/*
* Copyright (c) 2020, Andreas Kling <kling@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibJS/Runtime/Object.h>
#include <LibWeb/Forward.h>
namespace Web {
namespace Bindings {
class LocationObject final : public JS::Object {
JS_OBJECT(LocationObject, JS::Object);
public:
explicit LocationObject(JS::GlobalObject&);
virtual void initialize(JS::GlobalObject&) override;
virtual ~LocationObject() override;
virtual bool internal_set_prototype_of(Object* prototype) override;
virtual bool internal_is_extensible() const override;
virtual bool internal_prevent_extensions() override;
// FIXME: There should also be a custom [[GetPrototypeOf]], [[GetOwnProperty]], [[DefineOwnProperty]], [[Get]], [[Set]], [[Delete]] and [[OwnPropertyKeys]],
// but we don't have the infrastructure in place to implement them yet.
private:
JS_DECLARE_NATIVE_FUNCTION(reload);
JS_DECLARE_NATIVE_FUNCTION(href_getter);
JS_DECLARE_NATIVE_FUNCTION(href_setter);
JS_DECLARE_NATIVE_FUNCTION(host_getter);
JS_DECLARE_NATIVE_FUNCTION(hostname_getter);
JS_DECLARE_NATIVE_FUNCTION(pathname_getter);
JS_DECLARE_NATIVE_FUNCTION(hash_getter);
JS_DECLARE_NATIVE_FUNCTION(search_getter);
JS_DECLARE_NATIVE_FUNCTION(protocol_getter);
};
}
}