Compare commits

..

2 Commits

Author SHA1 Message Date
Marshall Greenblatt cbbca050e0 cefclient: Allow download with --hide-controls (fixes #3742) 2024-07-17 15:06:23 -04:00
Marshall Greenblatt 69fbadd0bc Disable dangling ptr check for PendingRequest::request_ (fixes #3743)
The InterceptedRequestHandlerWrapper object may be deleted (likely via
~InterceptedRequest) while the task to call
InterceptedRequestHandlerWrapper:ContinueCreateURLLoaderNetworkObserver
is still pending. That binding holds a
WeakPtr<InterceptedRequestHandlerWrapper> (which is now nullptr)
resulting in the bound std::unique_ptr<PendingRequest> being deleted
while still holding a raw_ptr<network::ResourceRequest> to the
already-deleted object. This is always safe (raw_ptr will never be
dereferenced) because of the WeakPtr check.
2024-07-17 14:35:33 -04:00
2 changed files with 1 additions and 7 deletions

View File

@ -147,7 +147,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
} }
const int32_t id_; const int32_t id_;
raw_ptr<network::ResourceRequest> request_; raw_ptr<network::ResourceRequest, DisableDanglingPtrDetection> request_;
const bool request_was_redirected_; const bool request_was_redirected_;
OnBeforeRequestResultCallback callback_; OnBeforeRequestResultCallback callback_;
CancelRequestCallback cancel_callback_; CancelRequestCallback cancel_callback_;

View File

@ -822,12 +822,6 @@ bool ClientHandler::CanDownload(CefRefPtr<CefBrowser> browser,
const CefString& request_method) { const CefString& request_method) {
CEF_REQUIRE_UI_THREAD(); CEF_REQUIRE_UI_THREAD();
if (!with_controls_) {
// Block the download.
LOG(INFO) << "Blocking download";
return false;
}
// Allow the download. // Allow the download.
return true; return true;
} }