mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-22 17:29:01 +00:00
LibWeb: Avoid dereferencing a null pointer to document
This commit is contained in:
parent
66d18170c6
commit
01be928a16
Notes:
github-actions[bot]
2025-09-10 15:58:41 +00:00
Author: https://github.com/pranair 🔰
Commit: 01be928a16
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6081
Reviewed-by: https://github.com/AtkinsSJ ✅
3 changed files with 24 additions and 1 deletions
|
@ -754,7 +754,12 @@ GC::Ptr<CSSPropertyRule> Parser::convert_to_property_rule(AtRule const& rule)
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto parsing_params = CSS::Parser::ParsingParams { *document() };
|
CSS::Parser::ParsingParams parsing_params;
|
||||||
|
if (document())
|
||||||
|
parsing_params = CSS::Parser::ParsingParams { *document() };
|
||||||
|
else
|
||||||
|
parsing_params = CSS::Parser::ParsingParams { realm() };
|
||||||
|
|
||||||
auto syntax_component_values = parse_component_values_list(parsing_params, syntax_maybe.value());
|
auto syntax_component_values = parse_component_values_list(parsing_params, syntax_maybe.value());
|
||||||
auto maybe_syntax = parse_as_syntax(syntax_component_values);
|
auto maybe_syntax = parse_as_syntax(syntax_component_values);
|
||||||
|
|
||||||
|
|
1
Tests/LibWeb/Text/expected/DOM/replaceSync-Property.txt
Normal file
1
Tests/LibWeb/Text/expected/DOM/replaceSync-Property.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
PASS (Didn't crash)
|
17
Tests/LibWeb/Text/input/DOM/replaceSync-Property.html
Normal file
17
Tests/LibWeb/Text/input/DOM/replaceSync-Property.html
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
test(() => {
|
||||||
|
const sheet = new CSSStyleSheet();
|
||||||
|
const css = `
|
||||||
|
@property --test {
|
||||||
|
syntax: '<color>';
|
||||||
|
inherits: false;
|
||||||
|
initial-value: black;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
sheet.replaceSync(css);
|
||||||
|
document.adoptedStyleSheets = [sheet];
|
||||||
|
println("PASS (Didn't crash)");
|
||||||
|
});
|
||||||
|
</script>
|
Loading…
Add table
Add a link
Reference in a new issue