Ver Fonte

LibWeb: De-duplicate definition of url_matches_about_blank

We don't need two static methods for this.
Andrew Kaster há 1 ano atrás
pai
commit
a565021147

+ 1 - 1
Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp

@@ -37,7 +37,7 @@
 namespace Web::HTML {
 
 // https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:blank
-static bool url_matches_about_blank(AK::URL const& url)
+bool url_matches_about_blank(AK::URL const& url)
 {
     // A URL matches about:blank if its scheme is "about", its path contains a single string "blank", its username and password are the empty string, and its host is null.
     return url.scheme() == "about"sv

+ 4 - 0
Userland/Libraries/LibWeb/HTML/BrowsingContext.h

@@ -21,6 +21,7 @@
 #include <LibWeb/HTML/HistoryHandlingBehavior.h>
 #include <LibWeb/HTML/NavigableContainer.h>
 #include <LibWeb/HTML/Origin.h>
+#include <LibWeb/HTML/SandboxingFlagSet.h>
 #include <LibWeb/HTML/SessionHistoryEntry.h>
 #include <LibWeb/HTML/TokenizedFeatures.h>
 #include <LibWeb/HTML/VisibilityState.h>
@@ -337,4 +338,7 @@ HTML::Origin determine_the_origin(BrowsingContext const& browsing_context, Optio
 
 HTML::Origin determine_the_origin(AK::URL const& url, SandboxingFlagSet sandbox_flags, Optional<HTML::Origin> source_origin, Optional<HTML::Origin> container_origin);
 
+// FIXME: Find a better home for this
+bool url_matches_about_blank(AK::URL const& url);
+
 }

+ 0 - 11
Userland/Libraries/LibWeb/HTML/NavigableContainer.cpp

@@ -211,17 +211,6 @@ HTML::WindowProxy* NavigableContainer::content_window()
     return m_nested_browsing_context->window_proxy();
 }
 
-// https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:blank
-static bool url_matches_about_blank(AK::URL const& url)
-{
-    // A URL matches about:blank if its scheme is "about", its path contains a single string "blank", its username and password are the empty string, and its host is null.
-    return url.scheme() == "about"sv
-        && url.serialize_path() == "blank"sv
-        && url.raw_username().is_empty()
-        && url.raw_password().is_empty()
-        && url.host().has<Empty>();
-}
-
 // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#shared-attribute-processing-steps-for-iframe-and-frame-elements
 void NavigableContainer::shared_attribute_processing_steps_for_iframe_and_frame(bool initial_insertion)
 {