-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add test SPI to see the entire frame trees in all processes for site isolation #13679
Conversation
EWS run on previous version of this PR (hash c5a0621) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a minor comment
@@ -31,8 +31,11 @@ | |||
|
|||
namespace WebKit { | |||
|
|||
enum class FrameType : bool { Local, Remote }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reuse the enum class FrameType
in Frame.h?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could, but then we'd need to include Frame.h in many more places, which would hurt our build time.
class FrameTreeCallbackAggregator : public RefCounted<FrameTreeCallbackAggregator> { | ||
public: | ||
static Ref<FrameTreeCallbackAggregator> create(CompletionHandler<void(Vector<FrameTreeNodeData>&&)>&& completionHandler, size_t processCount) { return adoptRef(*new FrameTreeCallbackAggregator(WTFMove(completionHandler), processCount)); } | ||
void addFrameTree(FrameTreeNodeData&& data) { m_data.uncheckedAppend(WTFMove(data)); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we make it private? It seems uncheckedAppend as a public method is not great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it needs to be public. But I can make the append a checked append call.
}; | ||
|
||
auto& internals = this->internals(); | ||
size_t processCount = !!m_mainFrame + internals.domainToSubframePageProxyMap.size(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If there is no main frame, why should there be any sub frame?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There wouldn't be. I'll make an early return if m_mainFrame is null.
size_t processCount = !!m_mainFrame + internals.domainToSubframePageProxyMap.size(); | ||
auto aggregator = FrameTreeCallbackAggregator::create(WTFMove(completionHandler), processCount); | ||
if (m_mainFrame) { | ||
m_mainFrame->process().sendWithAsyncReply(Messages::WebPage::GetFrameTree(), [aggregator] (FrameTreeNodeData&& data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto&&?
}, webPageID()); | ||
} | ||
for (auto& subframePageProxy : internals.domainToSubframePageProxyMap.values()) { | ||
subframePageProxy->process().sendWithAsyncReply(Messages::WebPage::GetFrameTree(), [aggregator] (FrameTreeNodeData&& data) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
auto&&
debugPrint(child, indentation + 2); | ||
} | ||
|
||
void debugPrint(const ExpectedFrameTree& node, size_t indentation = 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are all these debug prints routines really needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They were quite useful for looking for what went wrong. I guess they don't need to be checked in.
Util::run(&done); | ||
checkFrameTreesInProcesses(webView.get(), { | ||
{ "https://example.com"_s, | ||
{ { RemoteFrame } } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would expect the top level main frame to be local
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is. This is its child.
c5a0621
to
a53600d
Compare
EWS run on previous version of this PR (hash a53600d) |
a53600d
to
6c383b3
Compare
EWS run on current version of this PR (hash 6c383b3) |
β¦isolation https://bugs.webkit.org/show_bug.cgi?id=256574 rdar://109134755 Reviewed by J Pascoe and Youenn Fablet. WKWebView._frames gets info about the frame tree from whatever process each frame is in. In order to add tests that verifies the whole frame tree state in multiple process during operations like frame destruction, we need to get the whole frame tree state from each process and inspect all of it. This introduces such SPI and uses it for tests. * Source/WebKit/Shared/FrameInfoData.h: * Source/WebKit/Shared/FrameInfoData.serialization.in: * Source/WebKit/UIProcess/API/APIFrameInfo.h: * Source/WebKit/UIProcess/API/APIFrameTreeNode.h: * Source/WebKit/UIProcess/API/Cocoa/WKFrameInfo.mm: (-[WKFrameInfo _isLocalFrame]): * Source/WebKit/UIProcess/API/Cocoa/WKFrameInfoPrivate.h: * Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm: (-[WKWebView _frames:]): (-[WKWebView _frameTrees:]): * Source/WebKit/UIProcess/API/Cocoa/WKWebViewPrivate.h: * Source/WebKit/UIProcess/API/Cocoa/_WKFrameTreeNode.h: * Source/WebKit/UIProcess/API/Cocoa/_WKFrameTreeNode.mm: (-[_WKFrameTreeNode info]): (-[_WKFrameTreeNode _isLocalFrame]): * Source/WebKit/UIProcess/Cocoa/UIDelegate.mm: (WebKit::UIDelegate::UIClient::promptForDisplayCapturePermission): (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): * Source/WebKit/UIProcess/ProvisionalPageProxy.cpp: (WebKit::ProvisionalPageProxy::cancel): * Source/WebKit/UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::getAllFrameTrees): * Source/WebKit/UIProcess/WebPageProxy.h: * Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp: (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): * Source/WebKit/WebProcess/WebPage/WebFrame.cpp: (WebKit::WebFrame::info const): (WebKit::WebFrame::frameTreeData const): * Source/WebKit/WebProcess/WebPage/WebFrame.h: * Source/WebKit/WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::getFrameTree): * Source/WebKit/WebProcess/WebPage/WebPage.h: * Source/WebKit/WebProcess/WebPage/WebPage.messages.in: * Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm: (TestWebKitAPI::nullTerminatedIndentation): (TestWebKitAPI::debugPrint): (TestWebKitAPI::frameTreesMatch): (TestWebKitAPI::checkFrameTreesInProcesses): (TestWebKitAPI::TEST): Canonical link: https://commits.webkit.org/263912@main
6c383b3
to
538b503
Compare
Committed 263912@main (538b503): https://commits.webkit.org/263912@main Reviewed commits have been landed. Closing PR #13679 and removing active labels. |
538b503
6c383b3
π wincairoπ§ͺ wpe-wk2π§ͺ api-macπ§ͺ ios-wk2-wptπ§ͺ mac-wk1π§ͺ gtk-wk2π§ͺ mac-wk2π§ͺ api-gtkπ§ͺ mac-AS-debug-wk2π tv-simπ π§ͺ mergeπ watch-sim