Closed infrom-software closed 6 years ago
from the header comments of DoClose
:
Called when a browser has recieved a request to close. This may result directly from a call to
CefBrowserHost::CloseBrowser()
or indirectly if the browser is parented to a top-level window created by CEF and the user attempts to close that window (by clicking the 'X', for example).
To me this means that if you want to receive onDoClose
you either have to have the browser in a CEF-managed window or call CEFBrowserHost.closeBrowser()
manually
My fault. onBeforeClose won't be triggered if client.browser.host.windowHandle.removeFromSuperview() is not called (from inside windowShouldClose), even if .allowed by onDoClose (after a closeBrowser(), yes).
I don't manage to have CEFLifeSpanHandler.onBeforeClose(browser: CEFBrowser) triggered after windowShouldClose(_ sender: NSWindow) returns true and the window is destroyed. (browser's view being child of a view in the window of the app in my test sample, i.e. the window is not created by CEF)