File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -316,8 +316,15 @@ impl Context {
316316 /// Note that index 0 currently has a special meaning for Chrome's debugger.
317317 #[ inline( always) ]
318318 pub fn set_embedder_data ( & self , slot : i32 , data : Local < ' _ , Value > ) {
319+ // Initialize the annex when slot count > INTERNAL_SLOT_COUNT.
320+ self . get_annex_mut ( true ) ;
321+
319322 unsafe {
320- v8__Context__SetEmbedderData ( self , slot, & * data) ;
323+ v8__Context__SetEmbedderData (
324+ self ,
325+ slot + Self :: INTERNAL_SLOT_COUNT ,
326+ & * data,
327+ ) ;
321328 }
322329 }
323330
@@ -329,7 +336,11 @@ impl Context {
329336 scope : & PinScope < ' s , ' _ , ( ) > ,
330337 slot : i32 ,
331338 ) -> Option < Local < ' s , Value > > {
332- unsafe { scope. cast_local ( |_| v8__Context__GetEmbedderData ( self , slot) ) }
339+ unsafe {
340+ scope. cast_local ( |_| {
341+ v8__Context__GetEmbedderData ( self , slot + Self :: INTERNAL_SLOT_COUNT )
342+ } )
343+ }
333344 }
334345
335346 #[ inline( always) ]
You can’t perform that action at this time.
0 commit comments