File tree 4 files changed +9
-4
lines changed
4 files changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,8 @@ util.inherits(MessagePort, EventEmitter);
24
24
const {
25
25
Worker : WorkerImpl ,
26
26
getEnvMessagePort,
27
- threadId
27
+ threadId,
28
+ oninit : oninit_symbol
28
29
} = internalBinding ( 'worker' ) ;
29
30
30
31
const isMainThread = threadId === 0 ;
@@ -93,7 +94,7 @@ function oninit() {
93
94
setupPortReferencing ( this , this , 'message' ) ;
94
95
}
95
96
96
- Object . defineProperty ( MessagePort . prototype , 'oninit' , {
97
+ Object . defineProperty ( MessagePort . prototype , oninit_symbol , {
97
98
enumerable : true ,
98
99
writable : false ,
99
100
value : oninit
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ struct PackageConfig {
113
113
#define PER_ISOLATE_SYMBOL_PROPERTIES (V ) \
114
114
V (handle_onclose_symbol, " handle_onclose" ) \
115
115
V (owner_symbol, " owner" ) \
116
+ V (oninit_symbol, " oninit" ) \
116
117
117
118
// Strings are per-isolate primitives but Environment proxies them
118
119
// for the sake of convenience. Strings should be ASCII-only.
@@ -219,7 +220,6 @@ struct PackageConfig {
219
220
V (onhandshakedone_string, " onhandshakedone" ) \
220
221
V (onhandshakestart_string, " onhandshakestart" ) \
221
222
V (onheaders_string, " onheaders" ) \
222
- V (oninit_string, " oninit" ) \
223
223
V (onmessage_string, " onmessage" ) \
224
224
V (onnewsession_string, " onnewsession" ) \
225
225
V (onocspresponse_string, " onocspresponse" ) \
Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ MessagePort::MessagePort(Environment* env,
421
421
async ()->data = static_cast <void *>(this );
422
422
423
423
Local<Value> fn;
424
- if (!wrap->Get (context, env->oninit_string ()).ToLocal (&fn))
424
+ if (!wrap->Get (context, env->oninit_symbol ()).ToLocal (&fn))
425
425
return ;
426
426
427
427
if (fn->IsFunction ()) {
Original file line number Diff line number Diff line change @@ -501,6 +501,10 @@ void InitWorker(Local<Object> target,
501
501
thread_id_string,
502
502
Number::New (env->isolate (),
503
503
static_cast <double >(env->thread_id ()))).FromJust ();
504
+ Local<String> oninit_string = FIXED_ONE_BYTE_STRING (env->isolate (), " oninit" );
505
+ target->Set (env->context (),
506
+ oninit_string,
507
+ env->oninit_symbol ()).FromJust ();
504
508
}
505
509
506
510
} // anonymous namespace
You can’t perform that action at this time.
0 commit comments