@@ -459,14 +459,11 @@ void Blob::StoreDataObject(const FunctionCallbackInfo<Value>& args) {
459459 std::string (*type, type.length ())));
460460}
461461
462- void Blob::RevokeObjectURL (const FunctionCallbackInfo<Value>& args) {
463- CHECK_GE (args.Length (), 1 );
464- CHECK (args[0 ]->IsString ());
465- Realm* realm = Realm::GetCurrent (args);
462+ void RevokeObjectURLImpl (Realm* realm, Local<String> input_str) {
466463 BlobBindingData* binding_data = realm->GetBindingData <BlobBindingData>();
467464 Isolate* isolate = realm->isolate ();
468465
469- Utf8Value input (isolate, args[ 0 ]. As <String>() );
466+ Utf8Value input (isolate, input_str );
470467 auto out = ada::parse<ada::url_aggregator>(input.ToStringView ());
471468
472469 if (!out) {
@@ -485,34 +482,22 @@ void Blob::RevokeObjectURL(const FunctionCallbackInfo<Value>& args) {
485482 }
486483}
487484
485+ void Blob::RevokeObjectURL (const FunctionCallbackInfo<Value>& args) {
486+ CHECK_GE (args.Length (), 1 );
487+ CHECK (args[0 ]->IsString ());
488+ Realm* realm = Realm::GetCurrent (args);
489+ RevokeObjectURLImpl (realm, args[0 ].As <String>());
490+ }
491+
488492void Blob::FastRevokeObjectURL (Local<Value> receiver,
489493 Local<Value> raw_input,
490494 FastApiCallbackOptions& options) {
491495 TRACK_V8_FAST_API_CALL (" blob.revokeObjectURL" );
492496 CHECK (raw_input->IsString ());
493-
494497 auto isolate = options.isolate ;
495498 HandleScope handleScope (isolate);
496499 Realm* realm = Realm::GetCurrent (isolate->GetCurrentContext ());
497- BlobBindingData* binding_data = realm->GetBindingData <BlobBindingData>();
498-
499- Utf8Value input (isolate, raw_input.As <String>());
500- auto out = ada::parse<ada::url_aggregator>(input.ToStringView ());
501-
502- if (!out) {
503- return ;
504- }
505-
506- auto pathname = out->get_pathname ();
507- auto start_index = pathname.find (' :' );
508-
509- if (start_index != std::string_view::npos && start_index != pathname.size ()) {
510- auto end_index = pathname.find (' :' , start_index + 1 );
511- if (end_index == std::string_view::npos) {
512- auto id = std::string (pathname.substr (start_index + 1 ));
513- binding_data->revoke_data_object (id);
514- }
515- }
500+ RevokeObjectURLImpl (realm, raw_input.As <String>());
516501}
517502
518503CFunction Blob::fast_revoke_object_url_method =
0 commit comments