LibJS+WebContent: Cache the resolved system time zone identifier

Even though the underlying time zone is already cached by LibUnicode, JS
performs additional expensive lookups with that time zone. There's no
need to do those lookups again until the system time zone has changed.
This commit is contained in:
Timothy Flynn 2024-09-03 10:18:43 -04:00 committed by Andreas Kling
commit 5ee92af1d9
Notes: github-actions[bot] 2024-09-03 17:27:07 +00:00
4 changed files with 18 additions and 1 deletions

View file

@ -8,6 +8,7 @@
#include <AK/Enumerate.h>
#include <LibCore/Environment.h>
#include <LibJS/Runtime/ArrayBuffer.h>
#include <LibJS/Runtime/Date.h>
#include <LibJS/Runtime/TypedArray.h>
#include <LibTest/JavaScriptTestRunner.h>
#include <LibUnicode/TimeZone.h>
@ -109,6 +110,7 @@ TESTJS_GLOBAL_FUNCTION(set_time_zone, setTimeZone)
return vm.throw_completion<JS::InternalError>(MUST(String::formatted("Could not set time zone: {}", result.error())));
}
JS::clear_system_time_zone_cache();
Unicode::clear_system_time_zone_cache();
tzset();