@@ -400,20 +400,22 @@ std::unique_ptr<worker::TransferData> Blob::CloneForMessaging() const {
400400}
401401
402402void Blob::StoreDataObject (const v8::FunctionCallbackInfo<v8::Value>& args) {
403- Environment* env = Environment::GetCurrent (args);
404- BlobBindingData* binding_data = Realm::GetBindingData<BlobBindingData>(args);
403+ Realm* realm = Realm::GetCurrent (args);
405404
406405 CHECK (args[0 ]->IsString ()); // ID key
407- CHECK (Blob::HasInstance (env, args[1 ])); // Blob
406+ CHECK (Blob::HasInstance (realm-> env () , args[1 ])); // Blob
408407 CHECK (args[2 ]->IsUint32 ()); // Length
409408 CHECK (args[3 ]->IsString ()); // Type
410409
411- Utf8Value key (env->isolate (), args[0 ]);
410+ BlobBindingData* binding_data = realm->GetBindingData <BlobBindingData>();
411+ Isolate* isolate = realm->isolate ();
412+
413+ Utf8Value key (isolate, args[0 ]);
412414 Blob* blob;
413415 ASSIGN_OR_RETURN_UNWRAP (&blob, args[1 ]);
414416
415417 size_t length = args[2 ].As <Uint32>()->Value ();
416- Utf8Value type (env-> isolate () , args[3 ]);
418+ Utf8Value type (isolate, args[3 ]);
417419
418420 binding_data->store_data_object (
419421 std::string (*key, key.length ()),
@@ -427,9 +429,11 @@ void Blob::StoreDataObject(const v8::FunctionCallbackInfo<v8::Value>& args) {
427429void Blob::RevokeObjectURL (const FunctionCallbackInfo<Value>& args) {
428430 CHECK_GE (args.Length (), 1 );
429431 CHECK (args[0 ]->IsString ());
430- BlobBindingData* binding_data = Realm::GetBindingData<BlobBindingData>(args);
431- Environment* env = Environment::GetCurrent (args);
432- Utf8Value input (env->isolate (), args[0 ].As <String>());
432+ Realm* realm = Realm::GetCurrent (args);
433+ BlobBindingData* binding_data = realm->GetBindingData <BlobBindingData>();
434+ Isolate* isolate = realm->isolate ();
435+
436+ Utf8Value input (isolate, args[0 ].As <String>());
433437 auto out = ada::parse<ada::url_aggregator>(input.ToStringView ());
434438
435439 if (!out) {
@@ -449,36 +453,30 @@ void Blob::RevokeObjectURL(const FunctionCallbackInfo<Value>& args) {
449453}
450454
451455void Blob::GetDataObject (const v8::FunctionCallbackInfo<v8::Value>& args) {
452- BlobBindingData* binding_data = Realm::GetBindingData<BlobBindingData>(args);
453-
454- Environment* env = Environment::GetCurrent (args);
455456 CHECK (args[0 ]->IsString ());
457+ Realm* realm = Realm::GetCurrent (args);
458+ BlobBindingData* binding_data = realm->GetBindingData <BlobBindingData>();
459+ Isolate* isolate = realm->isolate ();
456460
457- Utf8Value key (env-> isolate () , args[0 ]);
461+ Utf8Value key (isolate, args[0 ]);
458462
459463 BlobBindingData::StoredDataObject stored =
460464 binding_data->get_data_object (std::string (*key, key.length ()));
461465 if (stored.blob ) {
462466 Local<Value> type;
463- if (!String::NewFromUtf8 (
464- env-> isolate (),
465- stored. type . c_str () ,
466- v8::NewStringType:: kNormal ,
467- static_cast < int >(stored. type . length ())) .ToLocal (&type)) {
467+ if (!String::NewFromUtf8 (isolate,
468+ stored. type . c_str (),
469+ v8::NewStringType:: kNormal ,
470+ static_cast < int >(stored. type . length ()))
471+ .ToLocal (&type)) {
468472 return ;
469473 }
470474
471- Local<Value> values[] = {
472- stored.blob ->object (),
473- Uint32::NewFromUnsigned (env->isolate (), stored.length ),
474- type
475- };
475+ Local<Value> values[] = {stored.blob ->object (),
476+ Uint32::NewFromUnsigned (isolate, stored.length ),
477+ type};
476478
477- args.GetReturnValue ().Set (
478- Array::New (
479- env->isolate (),
480- values,
481- arraysize (values)));
479+ args.GetReturnValue ().Set (Array::New (isolate, values, arraysize (values)));
482480 }
483481}
484482
0 commit comments