@@ -159,15 +159,16 @@ Serializer::Serializer(Lock& js, Options options)
159159
160160v8::Maybe<uint32_t > Serializer::GetSharedArrayBufferId (
161161 v8::Isolate* isolate, v8::Local<v8::SharedArrayBuffer> sab) {
162+ auto & js = jsg::Lock::from (isolate);
162163 uint32_t n;
163164 auto value = JsValue (sab);
164165 for (n = 0 ; n < sharedArrayBuffers.size (); n++) {
165166 // If the SharedArrayBuffer has already been added, return the existing ID for it.
166- if (sharedArrayBuffers[n] == value) {
167+ if (sharedArrayBuffers[n]. getHandle (js) == value) {
167168 return v8::Just (n);
168169 }
169170 }
170- sharedArrayBuffers.add (value);
171+ sharedArrayBuffers.add (jsg::JsRef (js, value) );
171172 sharedBackingStores.add (sab->GetBackingStore ());
172173 return v8::Just (n);
173174}
@@ -352,11 +353,11 @@ void Serializer::transfer(Lock& js, const JsValue& value) {
352353 uint32_t n;
353354 for (n = 0 ; n < arrayBuffers.size (); n++) {
354355 // If the ArrayBuffer has already been added, we do not want to try adding it again.
355- if (arrayBuffers[n] == value) {
356+ if (arrayBuffers[n]. getHandle (js) == value) {
356357 return ;
357358 }
358359 }
359- arrayBuffers.add (value);
360+ arrayBuffers.add (jsg::JsRef (js, value) );
360361
361362 backingStores.add (arrayBuffer->GetBackingStore ());
362363 check (arrayBuffer->Detach (v8::Local<v8::Value>()));
0 commit comments