diff --git a/Libraries/LibWeb/DOMURL/DOMURL.cpp b/Libraries/LibWeb/DOMURL/DOMURL.cpp index 5817107b05c..9b79f371b92 100644 --- a/Libraries/LibWeb/DOMURL/DOMURL.cpp +++ b/Libraries/LibWeb/DOMURL/DOMURL.cpp @@ -132,6 +132,10 @@ void DOMURL::revoke_object_url(JS::VM&, StringView url) // 1. Let url record be the result of parsing url. auto url_record = parse(url); + // Spec Bug: https://github.com/w3c/FileAPI/issues/207, missing check for URL failure parsing. + if (!url_record.is_valid()) + return; + // 2. If url record’s scheme is not "blob", return. if (url_record.scheme() != "blob"sv) return; @@ -151,7 +155,8 @@ void DOMURL::revoke_object_url(JS::VM&, StringView url) return; // 7. Remove an entry from the Blob URL Store for url. - FileAPI::remove_entry_from_blob_url_store(url); + // FIXME: Spec bug: https://github.com/w3c/FileAPI/issues/207, urlRecord should instead be passed through. + FileAPI::remove_entry_from_blob_url_store(url_record); } // https://url.spec.whatwg.org/#dom-url-canparse diff --git a/Libraries/LibWeb/FileAPI/BlobURLStore.cpp b/Libraries/LibWeb/FileAPI/BlobURLStore.cpp index d76cf21fc9a..382a6b2519a 100644 --- a/Libraries/LibWeb/FileAPI/BlobURLStore.cpp +++ b/Libraries/LibWeb/FileAPI/BlobURLStore.cpp @@ -115,13 +115,13 @@ Optional obtain_a_blob_object(URL::BlobURLEntry const } // https://w3c.github.io/FileAPI/#removeTheEntry -void remove_entry_from_blob_url_store(StringView url) +void remove_entry_from_blob_url_store(URL::URL const& url) { // 1. Let store be the user agent’s blob URL store; auto& store = blob_url_store(); // 2. Let url string be the result of serializing url. - auto url_string = URL::URL { url }.to_string(); + auto url_string = url.serialize(); // 3. Remove store[url string]. store.remove(url_string); diff --git a/Libraries/LibWeb/FileAPI/BlobURLStore.h b/Libraries/LibWeb/FileAPI/BlobURLStore.h index cbcf09feffa..1b4c8176391 100644 --- a/Libraries/LibWeb/FileAPI/BlobURLStore.h +++ b/Libraries/LibWeb/FileAPI/BlobURLStore.h @@ -30,7 +30,7 @@ ErrorOr add_entry_to_blob_url_store(GC::Ref object); bool check_for_same_partition_blob_url_usage(URL::BlobURLEntry const&, GC::Ref); struct NavigationEnvironment { }; Optional obtain_a_blob_object(URL::BlobURLEntry const&, Variant, NavigationEnvironment> environment); -void remove_entry_from_blob_url_store(StringView url); +void remove_entry_from_blob_url_store(URL::URL const& url); Optional resolve_a_blob_url(URL::URL const&); void run_unloading_cleanup_steps(GC::Ref);