mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
deps: V8: cherry-pick e74d0f437fcd
Original commit message:
[api] add v8::Isolate::GetDefaultLocale()
This allows embedders to query the default locale used by Intl
APIs.
This information is already available to user land via
Intl?.Collator().resolvedOptions().locale, the issue with this
is that it's a lot slower and requires dynamic access to Intl
API, which is subject to patching and prototype pollution so it's
not as reliable for embedders than having a V8 API to query
the default locale directly.
Refs: https://github.com/nodejs/node/pull/54279
Change-Id: I5a1823993c9ae79f8f61f54c6464daf882a09ba3
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/5772938
Reviewed-by: Leszek Swirski <leszeks@chromium.org>
Commit-Queue: Joyee Cheung <joyee@igalia.com>
Cr-Commit-Position: refs/heads/main@{#95678}
Refs: e74d0f437f
PR-URL: https://github.com/nodejs/node/pull/54279
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Ethan Arrowood <ethan@arrowood.dev>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
c44d41b2d8
commit
54e20c1c94
@ -36,7 +36,7 @@
|
||||
|
||||
# Reset this number to 0 on major V8 upgrades.
|
||||
# Increment by one for each non-official patch applied to deps/v8.
|
||||
'v8_embedder_string': '-node.13',
|
||||
'v8_embedder_string': '-node.14',
|
||||
|
||||
##### V8 defaults for Node.js #####
|
||||
|
||||
|
7
deps/v8/include/v8-isolate.h
vendored
7
deps/v8/include/v8-isolate.h
vendored
@ -9,6 +9,7 @@
|
||||
#include <stdint.h>
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "cppgc/common.h"
|
||||
@ -1717,6 +1718,12 @@ class V8_EXPORT Isolate {
|
||||
*/
|
||||
void LocaleConfigurationChangeNotification();
|
||||
|
||||
/**
|
||||
* Returns the default locale in a string if Intl support is enabled.
|
||||
* Otherwise returns an empty string.
|
||||
*/
|
||||
std::string GetDefaultLocale();
|
||||
|
||||
Isolate() = delete;
|
||||
~Isolate() = delete;
|
||||
Isolate(const Isolate&) = delete;
|
||||
|
11
deps/v8/src/api/api.cc
vendored
11
deps/v8/src/api/api.cc
vendored
@ -10768,6 +10768,17 @@ void v8::Isolate::LocaleConfigurationChangeNotification() {
|
||||
#endif // V8_INTL_SUPPORT
|
||||
}
|
||||
|
||||
std::string Isolate::GetDefaultLocale() {
|
||||
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
|
||||
ENTER_V8_NO_SCRIPT_NO_EXCEPTION(i_isolate);
|
||||
|
||||
#ifdef V8_INTL_SUPPORT
|
||||
return i_isolate->DefaultLocale();
|
||||
#else
|
||||
return std::string();
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(V8_OS_WIN) && defined(V8_ENABLE_ETW_STACK_WALKING)
|
||||
void Isolate::SetFilterETWSessionByURLCallback(
|
||||
FilterETWSessionByURLCallback callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user