1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 05:18:12 +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:
Andreas Kling 2020-06-05 23:32:23 +02:00
parent 3337365000
commit 5dc8c4a24c
5 changed files with 13 additions and 3 deletions

View file

@ -99,6 +99,8 @@ void ResourceClient::set_resource(Resource* resource)
m_resource->unregister_client({}, *this);
m_resource = resource;
if (m_resource) {
ASSERT(resource->type() == client_type());
m_resource->register_client({}, *this);
// Make sure that reused resources also have their load callback fired.