mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:57:43 +00:00
LibWeb: Fix int parsing in Document::shared_declarative_refresh_steps
We now have functions for parsing integers in a spec-compliant way. This patch replaces the `to_uint` call with a call to the spec-compliant `Web::HTML::parse_non_negative_integer` function.
This commit is contained in:
parent
088af86c90
commit
acd46b5974
1 changed files with 2 additions and 2 deletions
|
@ -71,6 +71,7 @@
|
|||
#include <LibWeb/HTML/MessageEvent.h>
|
||||
#include <LibWeb/HTML/Navigable.h>
|
||||
#include <LibWeb/HTML/NavigationParams.h>
|
||||
#include <LibWeb/HTML/Numbers.h>
|
||||
#include <LibWeb/HTML/Origin.h>
|
||||
#include <LibWeb/HTML/Parser/HTMLParser.h>
|
||||
#include <LibWeb/HTML/Scripting/ClassicScript.h>
|
||||
|
@ -3370,8 +3371,7 @@ void Document::shared_declarative_refresh_steps(StringView input, JS::GCPtr<HTML
|
|||
}
|
||||
|
||||
// 7. Otherwise, set time to the result of parsing timeString using the rules for parsing non-negative integers.
|
||||
// FIXME: Not sure if this exactly matches the spec's "rules for parsing non-negative integers".
|
||||
auto maybe_time = time_string.to_uint<u32>();
|
||||
auto maybe_time = Web::HTML::parse_non_negative_integer(time_string);
|
||||
|
||||
// FIXME: Since we only collected ASCII digits, this can only fail because of overflow. What do we do when that happens? For now, default to 0.
|
||||
if (maybe_time.has_value() && maybe_time.value() < NumericLimits<int>::max() && !Checked<int>::multiplication_would_overflow(static_cast<int>(maybe_time.value()), 1000)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue