File tree Expand file tree Collapse file tree 4 files changed +9
-4
lines changed Expand file tree Collapse file tree 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);
2424const {
2525 Worker : WorkerImpl ,
2626 getEnvMessagePort,
27- threadId
27+ threadId,
28+ oninit : oninit_symbol
2829} = internalBinding ( 'worker' ) ;
2930
3031const isMainThread = threadId === 0 ;
@@ -93,7 +94,7 @@ function oninit() {
9394 setupPortReferencing ( this , this , 'message' ) ;
9495}
9596
96- Object . defineProperty ( MessagePort . prototype , 'oninit' , {
97+ Object . defineProperty ( MessagePort . prototype , oninit_symbol , {
9798 enumerable : true ,
9899 writable : false ,
99100 value : oninit
Original file line number Diff line number Diff line change @@ -113,6 +113,7 @@ struct PackageConfig {
113113#define PER_ISOLATE_SYMBOL_PROPERTIES (V ) \
114114 V (handle_onclose_symbol, " handle_onclose" ) \
115115 V (owner_symbol, " owner" ) \
116+ V (oninit_symbol, " oninit" ) \
116117
117118// Strings are per-isolate primitives but Environment proxies them
118119// for the sake of convenience. Strings should be ASCII-only.
@@ -219,7 +220,6 @@ struct PackageConfig {
219220 V (onhandshakedone_string, " onhandshakedone" ) \
220221 V (onhandshakestart_string, " onhandshakestart" ) \
221222 V (onheaders_string, " onheaders" ) \
222- V (oninit_string, " oninit" ) \
223223 V (onmessage_string, " onmessage" ) \
224224 V (onnewsession_string, " onnewsession" ) \
225225 V (onocspresponse_string, " onocspresponse" ) \
Original file line number Diff line number Diff line change @@ -421,7 +421,7 @@ MessagePort::MessagePort(Environment* env,
421421 async ()->data = static_cast <void *>(this );
422422
423423 Local<Value> fn;
424- if (!wrap->Get (context, env->oninit_string ()).ToLocal (&fn))
424+ if (!wrap->Get (context, env->oninit_symbol ()).ToLocal (&fn))
425425 return ;
426426
427427 if (fn->IsFunction ()) {
Original file line number Diff line number Diff line change @@ -501,6 +501,10 @@ void InitWorker(Local<Object> target,
501501 thread_id_string,
502502 Number::New (env->isolate (),
503503 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 ();
504508}
505509
506510} // anonymous namespace
You can’t perform that action at this time.
0 commit comments