Truly independent web browser
LibWebView: Keep processes with data: URL iframes shareable
Andreas Klingc35e2e5c483a
diff --git a/Libraries/LibWebView/WebContentClient.cpp b/Libraries/LibWebView/WebContentClient.cppindex de6f22f5aa0..fccb4a6129e 100644--- a/Libraries/LibWebView/WebContentClient.cpp+++ b/Libraries/LibWebView/WebContentClient.cpp@@ -94,9 +94,15 @@ void WebContentClient::note_hosted_document(CanonicalDocument const& document)}if (has_hosted_only_tabs_like(document))return;- } else if (!document.is_top_level() && m_origin_of_hosted_tabs.has_value() && !origin.is_opaque()- && (m_hosted_tabs_are_origin_keyed ? origin.is_same_origin(*m_origin_of_hosted_tabs) : origin.is_same_site(*m_origin_of_hosted_tabs))) {- return;+ } else if (!document.is_top_level() && m_origin_of_hosted_tabs.has_value()) {+ // NB: A data: URL iframe is hosted in the process of the document that made it, and holds only what that+ // document already had.+ if (origin.is_opaque()) {+ if (document.creation_url().scheme() == "data"sv)+ return;+ } else if (m_hosted_tabs_are_origin_keyed ? origin.is_same_origin(*m_origin_of_hosted_tabs) : origin.is_same_site(*m_origin_of_hosted_tabs)) {+ return;+ }}m_has_hosted_more_than_tabs_of_one_origin = true;diff --git a/Libraries/LibWebView/WebContentClient.h b/Libraries/LibWebView/WebContentClient.hindex b3b33a74b6d..0ef2f0a83dd 100644--- a/Libraries/LibWebView/WebContentClient.h+++ b/Libraries/LibWebView/WebContentClient.h@@ -139,8 +139,9 @@ public:Optional<String> const& hosted_web_ui() const { return m_hosted_web_ui; }void set_hosted_web_ui(String host) { m_hosted_web_ui = move(host); }// A process can take in a tab of an origin only if all it has ever hosted, and so may still hold, is tabs of that- // origin with their same-site iframes. An origin-keyed tab keeps apart from the other origins of its site, so it- // only joins origin-keyed tabs of its origin, in a process that has not hosted iframes of those other origins.+ // origin with their same-site and data: URL iframes. An origin-keyed tab keeps apart from the other origins of+ // its site, so it only joins origin-keyed tabs of its origin, in a process that has not hosted iframes of those+ // other origins.void note_hosted_document(CanonicalDocument const&);bool has_hosted_only_tabs_like(CanonicalDocument const&) const;bool has_hosted_only_tabs_unlike(CanonicalDocument const&) const;