mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:57:35 +00:00
LibWeb: Fix mismatching Resource subclass types
This was a confusing bug: ImageStyleValue loaded its image resource as a Generic resource, while HTMLImageElement loaded as Image. This patch fixes the issue and adds an assertion to verify that we only share resources that have the same C++ client class type.
This commit is contained in:
parent
3337365000
commit
5dc8c4a24c
5 changed files with 13 additions and 3 deletions
|
@ -55,6 +55,8 @@ public:
|
|||
static NonnullRefPtr<Resource> create(Badge<ResourceLoader>, Type, const LoadRequest&);
|
||||
virtual ~Resource();
|
||||
|
||||
Type type() const { return m_type; }
|
||||
|
||||
bool is_loaded() const { return m_loaded; }
|
||||
|
||||
bool is_failed() const { return m_failed; }
|
||||
|
@ -95,6 +97,8 @@ public:
|
|||
virtual void resource_did_fail() { }
|
||||
|
||||
protected:
|
||||
virtual Resource::Type client_type() const { return Resource::Type::Generic; }
|
||||
|
||||
Resource* resource() { return m_resource; }
|
||||
const Resource* resource() const { return m_resource; }
|
||||
void set_resource(Resource*);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue