From ae7ee22aea27a66a0fdd56b733da132a748b2b03 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Fri, 15 Nov 2024 09:17:18 -0500 Subject: [PATCH] LibWeb: Don't copy url when calling determine_the_origin() in Navigable In #1537, determine_the_origin() changed to take `Optional const&` as first parameter, but it's passed `Web::Fetch::Infrastructure::Response::url()`, which returns `Optional`. Ladybird does not have SerenityOS/serenity#22870 (yet?), so this mismatch silently creates a copy. Change determine_the_origin() to take `Optional` instead. No behavior change, saves a copy, and is probably what was originally intended. --- Libraries/LibWeb/HTML/BrowsingContext.cpp | 2 +- Libraries/LibWeb/HTML/BrowsingContext.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Libraries/LibWeb/HTML/BrowsingContext.cpp index 9a8e88d0412..8da81080934 100644 --- a/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -60,7 +60,7 @@ bool url_matches_about_srcdoc(URL::URL const& url) } // https://html.spec.whatwg.org/multipage/document-sequences.html#determining-the-origin -URL::Origin determine_the_origin(Optional const& url, SandboxingFlagSet sandbox_flags, Optional source_origin) +URL::Origin determine_the_origin(Optional url, SandboxingFlagSet sandbox_flags, Optional source_origin) { // 1. If sandboxFlags has its sandboxed origin browsing context flag set, then return a new opaque origin. if (has_flag(sandbox_flags, SandboxingFlagSet::SandboxedOrigin)) { diff --git a/Libraries/LibWeb/HTML/BrowsingContext.h b/Libraries/LibWeb/HTML/BrowsingContext.h index 368db1b6aac..46953abe63a 100644 --- a/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Libraries/LibWeb/HTML/BrowsingContext.h @@ -169,7 +169,7 @@ private: GC::Ptr m_previous_sibling; }; -URL::Origin determine_the_origin(Optional const&, SandboxingFlagSet, Optional source_origin); +URL::Origin determine_the_origin(Optional, SandboxingFlagSet, Optional source_origin); SandboxingFlagSet determine_the_creation_sandboxing_flags(BrowsingContext const&, GC::Ptr embedder);