summaryrefslogtreecommitdiff
path: root/src/node.cc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-09-07 13:26:47 +0200
committerAnna Henningsen <anna@addaleax.net>2017-09-10 22:00:25 +0200
commit668ad449226940db92a5092822b77f3620631748 (patch)
tree2c01e570991b3d934df0e24996d6db53455512ba /src/node.cc
parent61e9ba127140ece5412f52a0218fb7446e360387 (diff)
downloadnode-new-668ad449226940db92a5092822b77f3620631748.tar.gz
intl: unexpose Intl.v8BreakIterator
It was never an official Ecma-402 API, it is about to be superseded by `Intl.Segmenter` and it's prone to crash under some circumstances. Searches don't turn up any usage in the wild and the recommendation from the V8 team is to remove it. Now seems like a good a time as any to do that. Fixes: https://github.com/nodejs/node/issues/8865 Fixes: https://github.com/nodejs/node/issues/14909 Refs: https://github.com/tc39/proposal-intl-segmenter Refs: https://chromium-review.googlesource.com/c/v8/v8/+/620755 PR-URL: https://github.com/nodejs/node/pull/15238 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/node.cc b/src/node.cc
index a569011894..664ae22a9a 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -4586,11 +4586,28 @@ void FreeEnvironment(Environment* env) {
}
+Local<Context> NewContext(Isolate* isolate,
+ Local<ObjectTemplate> object_template) {
+ auto context = Context::New(isolate, nullptr, object_template);
+ if (context.IsEmpty()) return context;
+ HandleScope handle_scope(isolate);
+ auto intl_key = FIXED_ONE_BYTE_STRING(isolate, "Intl");
+ auto break_iter_key = FIXED_ONE_BYTE_STRING(isolate, "v8BreakIterator");
+ Local<Value> intl_v;
+ Local<Object> intl;
+ if (context->Global()->Get(context, intl_key).ToLocal(&intl_v) &&
+ intl_v->ToObject(context).ToLocal(&intl)) {
+ intl->Delete(context, break_iter_key).FromJust();
+ }
+ return context;
+}
+
+
inline int Start(Isolate* isolate, IsolateData* isolate_data,
int argc, const char* const* argv,
int exec_argc, const char* const* exec_argv) {
HandleScope handle_scope(isolate);
- Local<Context> context = Context::New(isolate);
+ Local<Context> context = NewContext(isolate);
Context::Scope context_scope(context);
Environment env(isolate_data, context);
CHECK_EQ(0, uv_key_create(&thread_local_env));