mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 22:17:44 +00:00
LibWeb+LibJS: Add a naive way to check if a wrapper "is" a certain type
Instead of only checking the class_name(), we now generate an is_foo() virtual in the wrapper generator. (It's currently something we override on Bindings::Wrapper, which is not really scalable.) Longer term we'll need to think up something smarter for verifying that one wrapper "is" another type of wrapper.
This commit is contained in:
parent
1ffffa0053
commit
94fdf4fa5a
3 changed files with 19 additions and 4 deletions
|
@ -37,11 +37,17 @@ namespace Bindings {
|
|||
class Wrapper
|
||||
: public JS::Object
|
||||
, public Weakable<Wrapper> {
|
||||
public:
|
||||
virtual bool is_node_wrapper() const { return false; }
|
||||
virtual bool is_document_wrapper() const { return false; }
|
||||
|
||||
protected:
|
||||
explicit Wrapper(Object& prototype)
|
||||
: Object(&prototype)
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool is_web_wrapper() const final { return true; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue