| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 28e298f commit e9e12b8
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -411,6 +411,7 @@ constexpr size_t kFsStatsBufferLength = | |||
| 411 | 411 | V(http2settings_constructor_template, v8::ObjectTemplate) \ | |
| 412 | 412 | V(http2stream_constructor_template, v8::ObjectTemplate) \ | |
| 413 | 413 | V(http2ping_constructor_template, v8::ObjectTemplate) \ | |
| 414 | + V(i18n_converter_template, v8::ObjectTemplate) \ | ||
| 414 | 415 | V(libuv_stream_wrap_ctor_template, v8::FunctionTemplate) \ | |
| 415 | 416 | V(message_port_constructor_template, v8::FunctionTemplate) \ | |
| 416 | 417 | V(pipe_constructor_template, v8::FunctionTemplate) \ | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -86,6 +86,7 @@ namespace node { | |||
| 86 | 86 | ||
| 87 | 87 | using v8::Context; | |
| 88 | 88 | using v8::FunctionCallbackInfo; | |
| 89 | + using v8::FunctionTemplate; | ||
| 89 | 90 | using v8::HandleScope; | |
| 90 | 91 | using v8::Int32; | |
| 91 | 92 | using v8::Isolate; | |
@@ -171,8 +172,7 @@ class ConverterObject : public BaseObject, Converter { | |||
| 171 | 172 | Environment* env = Environment::GetCurrent(args); | |
| 172 | 173 | HandleScope scope(env->isolate()); | |
| 173 | 174 | ||
| 174 | - Local<ObjectTemplate> t = ObjectTemplate::New(env->isolate()); | ||
| 175 | - t->SetInternalFieldCount(ConverterObject::kInternalFieldCount); | ||
| 175 | + Local<ObjectTemplate> t = env->i18n_converter_template(); | ||
| 176 | 176 | Local<Object> obj; | |
| 177 | 177 | if (!t->NewInstance(env->context()).ToLocal(&obj)) return; | |
| 178 | 178 | ||
@@ -821,6 +821,16 @@ void Initialize(Local<Object> target, | |||
| 821 | 821 | env->SetMethod(target, "transcode", Transcode); | |
| 822 | 822 | ||
| 823 | 823 | // ConverterObject | |
| 824 | + { | ||
| 825 | + Local<FunctionTemplate> t = FunctionTemplate::New(env->isolate()); | ||
| 826 | + t->InstanceTemplate()->SetInternalFieldCount( | ||
| 827 | + ConverterObject::kInternalFieldCount); | ||
| 828 | + Local<String> converter_string = | ||
| 829 | + FIXED_ONE_BYTE_STRING(env->isolate(), "Converter"); | ||
| 830 | + t->SetClassName(converter_string); | ||
| 831 | + env->set_i18n_converter_template(t->InstanceTemplate()); | ||
| 832 | + } | ||
| 833 | + | ||
| 824 | 834 | env->SetMethod(target, "getConverter", ConverterObject::Create); | |
| 825 | 835 | env->SetMethod(target, "decode", ConverterObject::Decode); | |
| 826 | 836 | env->SetMethod(target, "hasConverter", ConverterObject::Has); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -107,8 +107,13 @@ if (common.hasIntl) { | |||
| 107 | 107 | if (common.hasIntl) { | |
| 108 | 108 | assert.strictEqual( | |
| 109 | 109 | util.inspect(dec, { showHidden: true }), | |
| 110 | - 'TextDecoder {\n encoding: \'utf-8\',\n fatal: false,\n ' + | ||
| 111 | - 'ignoreBOM: true,\n [Symbol(flags)]: 4,\n [Symbol(handle)]: {}\n}' | ||
| 110 | + 'TextDecoder {\n' + | ||
| 111 | + ' encoding: \'utf-8\',\n' + | ||
| 112 | + ' fatal: false,\n' + | ||
| 113 | + ' ignoreBOM: true,\n' + | ||
| 114 | + ' [Symbol(flags)]: 4,\n' + | ||
| 115 | + ' [Symbol(handle)]: Converter {}\n' + | ||
| 116 | + '}' | ||
| 112 | 117 | ); | |
| 113 | 118 | } else { | |
| 114 | 119 | assert.strictEqual( | |
| Back | FazBrowse Home | New Git URL |
0 commit comments