mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb/HTML: Check if evaluationStatus has a value before dereferencing
Previously, we would crash if scripting was disabled and a javascript URL was evaluated.
This commit is contained in:
parent
feaf2feab8
commit
57f82c029c
Notes:
github-actions[bot]
2024-10-19 22:29:10 +00:00
Author: https://github.com/rmg-x Commit: https://github.com/LadybirdBrowser/ladybird/commit/57f82c029c1 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1868 Reviewed-by: https://github.com/trflynn89
1 changed files with 1 additions and 1 deletions
|
@ -1603,7 +1603,7 @@ WebIDL::ExceptionOr<JS::GCPtr<DOM::Document>> Navigable::evaluate_javascript_url
|
|||
String result;
|
||||
|
||||
// 9. If evaluationStatus is a normal completion, and evaluationStatus.[[Value]] is a String, then set result to evaluationStatus.[[Value]].
|
||||
if (evaluation_status.type() == JS::Completion::Type::Normal && evaluation_status.value()->is_string()) {
|
||||
if (evaluation_status.type() == JS::Completion::Type::Normal && evaluation_status.value().has_value() && evaluation_status.value()->is_string()) {
|
||||
result = evaluation_status.value()->as_string().utf8_string();
|
||||
} else {
|
||||
// 10. Otherwise, return null.
|
||||
|
|
Loading…
Add table
Reference in a new issue