Skip to content

Commit

Permalink
Add test using loadHTMLString with site isolation
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=270372
rdar://123914567

Reviewed by Charlie Wolfe.

* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):

Canonical link: https://commits.webkit.org/275583@main
  • Loading branch information
achristensen07 committed Mar 2, 2024
1 parent 85712d7 commit 43475b5
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
Original file line number Diff line number Diff line change
Expand Up @@ -2635,6 +2635,34 @@ HTTPServer server(HTTPServer::UseCoroutines::Yes, [&](Connection connection) ->
Util::run(&receivedRequestFromSubframe);
}

TEST(SiteIsolation, LoadHTMLString)
{
HTTPServer server({
{ "/webkit"_s, { "hi"_s } }
}, HTTPServer::Protocol::HttpsProxy);

NSString *html = @"<iframe src='https://webkit.org/webkit'></iframe>";
auto [webView, navigationDelegate] = siteIsolatedViewAndDelegate(server);

[webView loadHTMLString:html baseURL:[NSURL URLWithString:@"https://example.com"]];
[navigationDelegate waitForDidFinishNavigation];
checkFrameTreesInProcesses(webView.get(), {
{ "https://example.com"_s,
{ { RemoteFrame } }
}, { RemoteFrame,
{ { "https://webkit.org"_s } }
},
});

[webView loadHTMLString:html baseURL:[NSURL URLWithString:@"https://webkit.org"]];
[navigationDelegate waitForDidFinishNavigation];
checkFrameTreesInProcesses(webView.get(), {
{ "https://webkit.org"_s,
{ { "https://webkit.org"_s } }
},
});
}

TEST(SiteIsolation, WebsitePoliciesCustomUserAgentDuringSameSiteProvisionalNavigation)
{
auto mainframeHTML = "<iframe id='frame' src='https://domain2.com/subframe'></iframe>"_s;
Expand Down

0 comments on commit 43475b5

Please sign in to comment.