mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-09-18 23:42:17 +00:00
LibWeb: Restore flags to prevent formatting timestamps as local time
The flag to stringify these timestamps as UTC was errantly dropped in
6fb2be96bf
. This was causing test-web to
fail in time zones other than GMT+0.
This commit is contained in:
parent
efa9737cf7
commit
3171d57639
Notes:
github-actions[bot]
2025-06-25 21:42:10 +00:00
Author: https://github.com/trflynn89
Commit: 3171d57639
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5216
Reviewed-by: https://github.com/gmta ✅
7 changed files with 63 additions and 18 deletions
|
@ -4,7 +4,9 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibJS/Runtime/Date.h>
|
||||
#include <LibJS/Runtime/VM.h>
|
||||
#include <LibUnicode/TimeZone.h>
|
||||
#include <LibWeb/Bindings/InternalsPrototype.h>
|
||||
#include <LibWeb/Bindings/Intrinsics.h>
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
|
@ -53,6 +55,17 @@ void Internals::gc()
|
|||
vm().heap().collect_garbage();
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<String> Internals::set_time_zone(StringView time_zone)
|
||||
{
|
||||
auto current_time_zone = Unicode::current_time_zone();
|
||||
|
||||
if (auto result = Unicode::set_current_time_zone(time_zone); result.is_error())
|
||||
return vm().throw_completion<JS::InternalError>(MUST(String::formatted("Could not set time zone: {}", result.error())));
|
||||
|
||||
JS::clear_system_time_zone_cache();
|
||||
return current_time_zone;
|
||||
}
|
||||
|
||||
JS::Object* Internals::hit_test(double x, double y)
|
||||
{
|
||||
auto& active_document = window().associated_document();
|
||||
|
|
|
@ -23,6 +23,8 @@ public:
|
|||
void signal_test_is_done(String const& text);
|
||||
void set_test_timeout(double milliseconds);
|
||||
|
||||
WebIDL::ExceptionOr<String> set_time_zone(StringView time_zone);
|
||||
|
||||
void gc();
|
||||
JS::Object* hit_test(double x, double y);
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ interface Internals {
|
|||
undefined signalTestIsDone(DOMString text);
|
||||
undefined setTestTimeout(double milliseconds);
|
||||
|
||||
DOMString setTimeZone(DOMString timeZone);
|
||||
|
||||
undefined gc();
|
||||
object hitTest(double x, double y);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue