mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Don't leak entire realm after parsing CSS @supports rule
Before this change, every CSS @supports rule would keep the containing JS realm alive via a JS::Handle. This led to a GC reference cycle and the whole realm leaked. Since we only need the realm at construction time, we can take it as a parameter instead, and stop storing it.
This commit is contained in:
parent
2ef37c0b06
commit
b2a099e647
Notes:
sideshowbarker
2024-07-17 07:31:31 +09:00
Author: https://github.com/awesomekling
Commit: b2a099e647
Pull-request: https://github.com/SerenityOS/serenity/pull/23839
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 27 additions and 29 deletions
|
@ -178,7 +178,7 @@ RefPtr<Supports> Parser::parse_a_supports(TokenStream<T>& tokens)
|
|||
auto maybe_condition = parse_supports_condition(token_stream);
|
||||
token_stream.skip_whitespace();
|
||||
if (maybe_condition && !token_stream.has_next_token())
|
||||
return Supports::create(maybe_condition.release_nonnull());
|
||||
return Supports::create(m_context.realm(), maybe_condition.release_nonnull());
|
||||
|
||||
return {};
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ Optional<Supports::Feature> Parser::parse_supports_feature(TokenStream<Component
|
|||
if (auto declaration = consume_a_declaration(block_tokens); declaration.has_value()) {
|
||||
transaction.commit();
|
||||
return Supports::Feature {
|
||||
Supports::Declaration { declaration->to_string(), JS::make_handle(m_context.realm()) }
|
||||
Supports::Declaration { declaration->to_string() }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -316,7 +316,7 @@ Optional<Supports::Feature> Parser::parse_supports_feature(TokenStream<Component
|
|||
builder.append(item.to_string());
|
||||
transaction.commit();
|
||||
return Supports::Feature {
|
||||
Supports::Selector { builder.to_string().release_value_but_fixme_should_propagate_errors(), JS::make_handle(m_context.realm()) }
|
||||
Supports::Selector { builder.to_string().release_value_but_fixme_should_propagate_errors() }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue