diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-12 14:27:29 +0200 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2020-10-13 09:35:20 +0000 |
commit | c30a6232df03e1efbd9f3b226777b07e087a1122 (patch) | |
tree | e992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/content/browser/find_request_manager.cc | |
parent | 7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff) | |
download | qtwebengine-chromium-85-based.tar.gz |
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/content/browser/find_request_manager.cc')
-rw-r--r-- | chromium/content/browser/find_request_manager.cc | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/chromium/content/browser/find_request_manager.cc b/chromium/content/browser/find_request_manager.cc index 102d0d3040d..0828eae9f3d 100644 --- a/chromium/content/browser/find_request_manager.cc +++ b/chromium/content/browser/find_request_manager.cc @@ -278,7 +278,7 @@ void FindRequestManager::Find(int request_id, DCHECK_GT(request_id, current_session_id_); // If this is a new find session, clear any queued requests from last session. - if (!options->find_next) + if (options->new_session) find_request_queue_ = base::queue<FindRequest>(); find_request_queue_.emplace(request_id, search_text, std::move(options)); @@ -327,7 +327,7 @@ void FindRequestManager::HandleFinalUpdateForFrame(RenderFrameHostImpl* rfh, // This is the final update for all frames for the current find operation. if (request_id == current_request_.id && request_id != current_session_id_) { - DCHECK(current_request_.options->find_next); + DCHECK(!current_request_.options->new_session); DCHECK_EQ(pending_find_next_reply_, rfh); pending_find_next_reply_ = nullptr; } @@ -584,7 +584,7 @@ void FindRequestManager::FindInternal(const FindRequest& request) { DCHECK_GT(request.id, current_request_.id); DCHECK_GT(request.id, current_session_id_); - if (request.options->find_next) { + if (!request.options->new_session) { // This is a find next operation. // This implies that there is an ongoing find session with the same search @@ -636,10 +636,10 @@ void FindRequestManager::SendFindRequest(const FindRequest& request, DCHECK(CheckFrame(rfh)); DCHECK(rfh->IsRenderFrameLive()); - if (request.options->find_next) - pending_find_next_reply_ = rfh; - else + if (request.options->new_session) pending_initial_replies_.insert(rfh); + else + pending_find_next_reply_ = rfh; static_cast<RenderFrameHostImpl*>(rfh)->GetFindInPage()->Find( request.id, base::UTF16ToUTF8(request.search_text), @@ -679,9 +679,14 @@ RenderFrameHost* FindRequestManager::Traverse(RenderFrameHost* from_rfh, DCHECK(from_rfh); // If |from_rfh| is being detached, it might already be removed from // its parent's list of children, meaning we can't traverse it correctly. + // We also don't traverse when |from_rfh| is in back-forward cache as we don't + // allow any updates in this state. auto* from_rfh_impl = static_cast<RenderFrameHostImpl*>(from_rfh); - if (!from_rfh_impl->is_active()) + if (from_rfh_impl->IsPendingDeletion() || + from_rfh_impl->IsInBackForwardCache()) { return nullptr; + } + FrameTreeNode* node = from_rfh_impl->frame_tree_node(); FrameTreeNode* last_node = node; while ((node = TraverseNode(node, forward, wrap)) != nullptr) { @@ -721,7 +726,7 @@ void FindRequestManager::AddFrame(RenderFrameHost* rfh, bool force) { FindRequest request = current_request_; request.id = current_session_id_; - request.options->find_next = false; + request.options->new_session = true; request.options->force = force; SendFindRequest(request, rfh); } @@ -770,7 +775,7 @@ void FindRequestManager::FinalUpdateReceived(int request_id, RenderFrameHost* target_rfh; if (request_id == current_request_.id && - current_request_.options->find_next) { + !current_request_.options->new_session) { // If this was a find next operation, then the active match will be in the // next frame with matches after this one. target_rfh = Traverse(rfh, current_request_.options->forward, @@ -804,7 +809,7 @@ void FindRequestManager::FinalUpdateReceived(int request_id, // has not yet been found. NotifyFindReply(request_id, false /* final_update */); - current_request_.options->find_next = true; + current_request_.options->new_session = false; SendFindRequest(current_request_, target_rfh); } |