@@ -33,7 +33,7 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
3333
3434 PerContextData *perContextData = (PerContextData *) Local<External>::Cast (args.Data ())->Value ();
3535
36- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
36+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
3737 /* This one is default constructed with defaults */
3838 typename APP ::template WebSocketBehavior<PerSocketData> behavior = {};
3939
@@ -128,16 +128,19 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
128128
129129 Local<Function> upgradeLf = Local<Function>::New (isolate, upgradePf);
130130 Local<Object> resObject = perContextData->resTemplate [getAppTypeIndex<APP >()].Get (isolate)->Clone ();
131- resObject->SetAlignedPointerInInternalField (0 , res);
131+ // resObject->SetAlignedPointerInInternalField(0, res);
132+ setInternalPointer (resObject, res);
132133
133134 Local<Object> reqObject = perContextData->reqTemplate [std::is_same<APP , uWS::H3App>::value].Get (isolate)->Clone ();
134- reqObject->SetAlignedPointerInInternalField (0 , req);
135+ // reqObject->SetAlignedPointerInInternalField(0, req);
136+ setInternalPointer (reqObject, req);
135137
136138 Local<Value> argv[3 ] = {resObject, reqObject, External::New (isolate, (void *) context)};
137139 CallJS (isolate, upgradeLf, 3 , argv);
138140
139141 /* Properly invalidate req */
140- reqObject->SetAlignedPointerInInternalField (0 , nullptr );
142+ // reqObject->SetAlignedPointerInInternalField(0, nullptr);
143+ setInternalPointer (reqObject, nullptr );
141144
142145 /* µWS itself will terminate if not responded and not attached
143146 * onAborted handler, so we can assume it's done */
@@ -151,7 +154,8 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
151154
152155 /* Create a new websocket object */
153156 Local<Object> wsObject = perContextData->wsTemplate [getAppTypeIndex<APP >()].Get (isolate)->Clone ();
154- wsObject->SetAlignedPointerInInternalField (0 , ws);
157+ // wsObject->SetAlignedPointerInInternalField(0, ws);
158+ setInternalPointer (wsObject, ws);
155159
156160 /* Retrieve temporary userData object */
157161 PerSocketData *perSocketData = (PerSocketData *) ws->getUserData ();
@@ -286,7 +290,8 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
286290 Local<Object> wsObject = Local<Object>::New (isolate, perSocketData->socketPf );
287291
288292 /* Invalidate this wsObject */
289- wsObject->SetAlignedPointerInInternalField (0 , nullptr );
293+ // wsObject->SetAlignedPointerInInternalField(0, nullptr);
294+ setInternalPointer (wsObject, nullptr );
290295
291296 /* Only call close handler if we have one set */
292297 Local<Function> closeLf = Local<Function>::New (isolate, closePf);
@@ -311,7 +316,7 @@ void uWS_App_ws(const FunctionCallbackInfo<Value> &args) {
311316/* This method wraps get, post and all http methods */
312317template <typename APP , typename F>
313318void uWS_App_get (F f, const FunctionCallbackInfo<Value> &args) {
314- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
319+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
315320
316321 /* Pattern */
317322 NativeString pattern (args.GetIsolate (), args[0 ]);
@@ -464,16 +469,19 @@ void uWS_App_get(F f, const FunctionCallbackInfo<Value> &args) {
464469 HandleScope hs (isolate);
465470
466471 Local<Object> resObject = perContextData->resTemplate [getAppTypeIndex<APP >()].Get (isolate)->Clone ();
467- resObject->SetAlignedPointerInInternalField (0 , res);
472+ // resObject->SetAlignedPointerInInternalField(0, res);
473+ setInternalPointer (resObject, res);
468474
469475 Local<Object> reqObject = perContextData->reqTemplate [std::is_same<APP , uWS::H3App>::value].Get (isolate)->Clone ();
470- reqObject->SetAlignedPointerInInternalField (0 , req);
476+ // reqObject->SetAlignedPointerInInternalField(0, req);
477+ setInternalPointer (reqObject, req);
471478
472479 Local<Value> argv[] = {resObject, reqObject};
473480 CallJS (isolate, cb.Get (isolate), 2 , argv);
474481
475482 /* Properly invalidate req */
476- reqObject->SetAlignedPointerInInternalField (0 , nullptr );
483+ // reqObject->SetAlignedPointerInInternalField(0, nullptr);
484+ setInternalPointer (reqObject, nullptr );
477485
478486 /* µWS itself will terminate if not responded and not attached
479487 * onAborted handler, so we can assume it's done */
@@ -484,15 +492,15 @@ void uWS_App_get(F f, const FunctionCallbackInfo<Value> &args) {
484492
485493template <typename APP >
486494void uWS_App_close (const FunctionCallbackInfo<Value> &args) {
487- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
495+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
488496
489497 app->close ();
490498 args.GetReturnValue ().Set (args.This ());
491499}
492500
493501template <typename APP >
494502void uWS_App_listen_unix (const FunctionCallbackInfo<Value> &args) {
495- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
503+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
496504
497505 Isolate *isolate = args.GetIsolate ();
498506
@@ -526,7 +534,7 @@ void uWS_App_listen_unix(const FunctionCallbackInfo<Value> &args) {
526534
527535template <typename APP >
528536void uWS_App_listen (const FunctionCallbackInfo<Value> &args) {
529- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
537+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
530538
531539 Isolate *isolate = args.GetIsolate ();
532540
@@ -568,7 +576,7 @@ void uWS_App_listen(const FunctionCallbackInfo<Value> &args) {
568576
569577template <typename APP >
570578void uWS_App_filter (const FunctionCallbackInfo<Value> &args) {
571- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
579+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
572580
573581 /* Handler */
574582 Callback checkedCallback (args.GetIsolate (), args[0 ]);
@@ -585,7 +593,8 @@ void uWS_App_filter(const FunctionCallbackInfo<Value> &args) {
585593 HandleScope hs (isolate);
586594
587595 Local<Object> resObject = perContextData->resTemplate [getAppTypeIndex<APP >()].Get (isolate)->Clone ();
588- resObject->SetAlignedPointerInInternalField (0 , res);
596+ // resObject->SetAlignedPointerInInternalField(0, res);
597+ setInternalPointer (resObject, res);
589598
590599 Local<Value> argv[] = {resObject, Local<Value>::Cast (Integer::New (isolate, count))};
591600 CallJS (isolate, cb.Get (isolate), 2 , argv);
@@ -596,7 +605,7 @@ void uWS_App_filter(const FunctionCallbackInfo<Value> &args) {
596605
597606template <typename APP >
598607void uWS_App_domain (const FunctionCallbackInfo<Value> &args) {
599- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
608+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
600609
601610 Isolate *isolate = args.GetIsolate ();
602611
@@ -617,7 +626,7 @@ void uWS_App_domain(const FunctionCallbackInfo<Value> &args) {
617626
618627template <typename APP >
619628void uWS_App_publish (const FunctionCallbackInfo<Value> &args) {
620- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
629+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
621630
622631 Isolate *isolate = args.GetIsolate ();
623632
@@ -643,7 +652,7 @@ void uWS_App_publish(const FunctionCallbackInfo<Value> &args) {
643652
644653template <typename APP >
645654void uWS_App_numSubscribers (const FunctionCallbackInfo<Value> &args) {
646- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
655+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
647656
648657 Isolate *isolate = args.GetIsolate ();
649658
@@ -744,7 +753,7 @@ std::pair<uWS::SocketContextOptions, bool> readOptionsObject(const FunctionCallb
744753
745754template <typename APP >
746755void uWS_App_adoptSocket (const FunctionCallbackInfo<Value> &args) {
747- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
756+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
748757
749758 Isolate *isolate = args.GetIsolate ();
750759
@@ -762,7 +771,7 @@ void uWS_App_adoptSocket(const FunctionCallbackInfo<Value> &args) {
762771
763772template <typename APP >
764773void uWS_App_removeChildApp (const FunctionCallbackInfo<Value> &args) {
765- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
774+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
766775
767776 Isolate *isolate = args.GetIsolate ();
768777
@@ -778,7 +787,7 @@ void uWS_App_removeChildApp(const FunctionCallbackInfo<Value> &args) {
778787
779788template <typename APP >
780789void uWS_App_addChildApp (const FunctionCallbackInfo<Value> &args) {
781- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
790+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
782791
783792 Isolate *isolate = args.GetIsolate ();
784793
@@ -801,7 +810,7 @@ void uWS_App_addChildApp(const FunctionCallbackInfo<Value> &args) {
801810
802811template <typename APP >
803812void uWS_App_getDescriptor (const FunctionCallbackInfo<Value> &args) {
804- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
813+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
805814
806815 Isolate *isolate = args.GetIsolate ();
807816
@@ -826,7 +835,7 @@ void uWS_App_getDescriptor(const FunctionCallbackInfo<Value> &args) {
826835
827836template <typename APP >
828837void uWS_App_addServerName (const FunctionCallbackInfo<Value> &args) {
829- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
838+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
830839
831840 Isolate *isolate = args.GetIsolate ();
832841 NativeString hostnamePatternValue (isolate, args[0 ]);
@@ -850,7 +859,7 @@ void uWS_App_addServerName(const FunctionCallbackInfo<Value> &args) {
850859
851860template <typename APP >
852861void uWS_App_removeServerName (const FunctionCallbackInfo<Value> &args) {
853- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
862+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
854863
855864 Isolate *isolate = args.GetIsolate ();
856865 NativeString hostnamePatternValue (isolate, args[0 ]);
@@ -869,7 +878,7 @@ void uWS_App_removeServerName(const FunctionCallbackInfo<Value> &args) {
869878
870879template <typename APP >
871880void uWS_App_missingServerName (const FunctionCallbackInfo<Value> &args) {
872- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
881+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
873882 Isolate *isolate = args.GetIsolate ();
874883
875884 UniquePersistent<Function> missingPf;
@@ -933,7 +942,7 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
933942 std::cout << " Registering cached get handler" << std::endl;
934943
935944
936- APP *app = (APP *) args.This ()->GetAlignedPointerFromInternalField (0 );
945+ APP *app = (APP *) getInternalPointer ( args.This ()); // ->GetAlignedPointerFromInternalField(0);
937946
938947 /* Pattern */
939948 NativeString pattern (args.GetIsolate (), args[0 ]);
@@ -958,16 +967,19 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
958967
959968 // this needs to be cachedresponse wrapper (for both cached tcp and cached SSL?)
960969 Local<Object> resObject = perContextData->resTemplate [/* getAppTypeIndex<APP>()*/ 3 ].Get (isolate)->Clone ();
961- resObject->SetAlignedPointerInInternalField (0 , res);
970+ // resObject->SetAlignedPointerInInternalField(0, res);
971+ setInternalPointer (resObject, res);
962972
963973 Local<Object> reqObject = perContextData->reqTemplate [std::is_same<APP , uWS::H3App>::value].Get (isolate)->Clone ();
964- reqObject->SetAlignedPointerInInternalField (0 , req);
974+ // reqObject->SetAlignedPointerInInternalField(0, req);
975+ setInternalPointer (reqObject, req);
965976
966977 Local<Value> argv[] = {resObject, reqObject};
967978 CallJS (isolate, cb.Get (isolate), 2 , argv);
968979
969980 /* Properly invalidate req */
970- reqObject->SetAlignedPointerInInternalField (0 , nullptr );
981+ // reqObject->SetAlignedPointerInInternalField(0, nullptr);
982+ setInternalPointer (reqObject, nullptr );
971983
972984 /* µWS itself will terminate if not responded and not attached
973985 * onAborted handler, so we can assume it's done */
@@ -1052,7 +1064,8 @@ void uWS_App(const FunctionCallbackInfo<Value> &args) {
10521064 }
10531065
10541066 Local<Object> localApp = appTemplate->GetFunction (isolate->GetCurrentContext ()).ToLocalChecked ()->NewInstance (isolate->GetCurrentContext ()).ToLocalChecked ();
1055- localApp->SetAlignedPointerInInternalField (0 , app);
1067+ // localApp->SetAlignedPointerInInternalField(0, app);
1068+ setInternalPointer (localApp, app);
10561069
10571070 PerContextData *perContextData = (PerContextData *) Local<External>::Cast (args.Data ())->Value ();
10581071
0 commit comments