mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Improve timing of frame attach/detach (see #3664)
- Move frame attachment from RenderFrameCreated to DidCommitProvisionalLoad. This has a number of advantages: - Significantly reduces the frequency of disconnects by avoiding the GetInterface/DidCommitNavigation race condition. - Stops connecting temporary frames (created during cross-origin navigation), making callback behavior more consistent. - Split frame detach and destruction notifications into separate callbacks. OnFrameDetached now reflects a potentially recoverable state. Add a new OnFrameDestroyed callback for the unrecoverable destruction state.
This commit is contained in:
@ -3593,7 +3593,9 @@ class ExtraInfoNavTestHandler : public TestHandler {
|
||||
CefRefPtr<CefFrame> frame,
|
||||
int httpStatusCode) override {
|
||||
if (popup_opened_) {
|
||||
DestroyTest();
|
||||
EXPECT_FALSE(got_load_end_popup_);
|
||||
got_load_end_popup_.yes();
|
||||
MaybeDestroyTest();
|
||||
} else {
|
||||
GrantPopupPermission(browser->GetHost()->GetRequestContext(),
|
||||
browser->GetMainFrame()->GetURL());
|
||||
@ -3641,9 +3643,12 @@ class ExtraInfoNavTestHandler : public TestHandler {
|
||||
EXPECT_TRUE(args->GetBool(0));
|
||||
if (popup_opened_) {
|
||||
EXPECT_TRUE(args->GetBool(1));
|
||||
EXPECT_FALSE(got_process_message_popup_);
|
||||
got_process_message_popup_.yes();
|
||||
MaybeDestroyTest();
|
||||
} else {
|
||||
EXPECT_FALSE(args->GetBool(1));
|
||||
EXPECT_FALSE(got_process_message_main_);
|
||||
got_process_message_main_.yes();
|
||||
}
|
||||
return true;
|
||||
@ -3653,15 +3658,23 @@ class ExtraInfoNavTestHandler : public TestHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected:
|
||||
private:
|
||||
bool popup_opened_ = false;
|
||||
TrackCallback got_process_message_main_;
|
||||
TrackCallback got_process_message_popup_;
|
||||
TrackCallback got_load_end_popup_;
|
||||
|
||||
void MaybeDestroyTest() {
|
||||
if (got_process_message_popup_ && got_load_end_popup_) {
|
||||
DestroyTest();
|
||||
}
|
||||
}
|
||||
|
||||
void DestroyTest() override {
|
||||
// Verify test expectations.
|
||||
EXPECT_TRUE(got_process_message_main_);
|
||||
EXPECT_TRUE(got_process_message_popup_);
|
||||
EXPECT_TRUE(got_load_end_popup_);
|
||||
|
||||
TestHandler::DestroyTest();
|
||||
}
|
||||
|
Reference in New Issue
Block a user