Keep off-window local hosts from stealing devtools view
This commit is contained in:
parent
89db360ee0
commit
3ca11a5e00
1 changed files with 28 additions and 0 deletions
|
|
@ -4486,6 +4486,34 @@ struct WebViewRepresentable: NSViewRepresentable {
|
|||
)
|
||||
}
|
||||
|
||||
let shouldPreserveExistingExternalLocalHost =
|
||||
host.window == nil &&
|
||||
webView.superview != nil &&
|
||||
webView.superview !== slotView
|
||||
if shouldPreserveExistingExternalLocalHost {
|
||||
// Split zoom can instantiate a replacement local host before it joins a window.
|
||||
// Never let that off-window host steal the live page + inspector hierarchy away
|
||||
// from the currently visible local host.
|
||||
host.setLocalInlineSlotHidden(true)
|
||||
coordinator.lastPortalHostId = nil
|
||||
coordinator.lastSynchronizedHostGeometryRevision = 0
|
||||
#if DEBUG
|
||||
dlog(
|
||||
"browser.localHost.reparent.skip web=\(Self.objectID(webView)) " +
|
||||
"reason=offWindowReplacementHost super=\(Self.objectID(webView.superview)) " +
|
||||
"host=\(Self.objectID(host)) slot=\(Self.objectID(slotView))"
|
||||
)
|
||||
Self.logDevToolsState(
|
||||
panel,
|
||||
event: "localHost.skip",
|
||||
generation: coordinator.attachGeneration,
|
||||
retryCount: 0,
|
||||
details: Self.attachContext(webView: webView, host: host)
|
||||
)
|
||||
#endif
|
||||
return false
|
||||
}
|
||||
|
||||
if webView.superview !== slotView {
|
||||
if let sourceSuperview = webView.superview {
|
||||
Self.moveWebKitRelatedSubviewsIntoHostIfNeeded(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue