mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Fix issues with request callbacks during browser shutdown (see issue #2622).
The behavior has changed as follows with NetworkService enabled: - All pending and in-progress requests will now be aborted when the CEF context or associated browser is destroyed. The OnResourceLoadComplete callback will now also be called in this case for in-progress requests that have a handler. - The CefResourceHandler::Cancel method will now always be called when resource handling is complete, irrespective of whether handling completed successfully. - Request callbacks that arrive after the OnBeforeClose callback for the associated browser (which may happen for in-progress requests that are aborted on browser destruction) will now always have a non-nullptr CefBrowser parameter. - Allow empty parameters to CefRequest and CefResponse methods where it makes sense (e.g. resetting default response state, or clearing a referrer value). - Fixed a reference loop that was keeping CefResourceHandler objects from being destroyed if they were holding a callback reference (from ProcessRequest, ReadResponse, etc.) during CEF context or associated browser destruction. - Fixed an issue where the main frame was not detached on browser destruction which could cause a crash due to RFH use-after-free (see issue #2498). To test: All unit tests pass as expected.
This commit is contained in:
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=fc10026d8f3e77868d19807ea625f9449678da60$
|
||||
// $hash=65f76c903a9c9f245ffe2b3275472d7d3d464f93$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/request_cpptoc.h"
|
||||
@@ -116,10 +116,7 @@ void CEF_CALLBACK request_set_referrer(struct _cef_request_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: referrer_url; type: string_byref_const
|
||||
DCHECK(referrer_url);
|
||||
if (!referrer_url)
|
||||
return;
|
||||
// Unverified params: referrer_url
|
||||
|
||||
// Execute
|
||||
CefRequestCppToC::Get(self)->SetReferrer(CefString(referrer_url), policy);
|
||||
@@ -265,10 +262,7 @@ void CEF_CALLBACK request_set_header_by_name(struct _cef_request_t* self,
|
||||
DCHECK(name);
|
||||
if (!name)
|
||||
return;
|
||||
// Verify param: value; type: string_byref_const
|
||||
DCHECK(value);
|
||||
if (!value)
|
||||
return;
|
||||
// Unverified params: value
|
||||
|
||||
// Execute
|
||||
CefRequestCppToC::Get(self)->SetHeaderByName(
|
||||
@@ -357,10 +351,7 @@ request_set_first_party_for_cookies(struct _cef_request_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: url; type: string_byref_const
|
||||
DCHECK(url);
|
||||
if (!url)
|
||||
return;
|
||||
// Unverified params: url
|
||||
|
||||
// Execute
|
||||
CefRequestCppToC::Get(self)->SetFirstPartyForCookies(CefString(url));
|
||||
|
@@ -9,7 +9,7 @@
|
||||
// implementations. See the translator.README.txt file in the tools directory
|
||||
// for more information.
|
||||
//
|
||||
// $hash=4573a140180f11230e688f73e8c09503f9123c3d$
|
||||
// $hash=5c6b14610ef7bcadf5e4936a262c660896a32526$
|
||||
//
|
||||
|
||||
#include "libcef_dll/cpptoc/response_cpptoc.h"
|
||||
@@ -119,10 +119,7 @@ void CEF_CALLBACK response_set_status_text(struct _cef_response_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: statusText; type: string_byref_const
|
||||
DCHECK(statusText);
|
||||
if (!statusText)
|
||||
return;
|
||||
// Unverified params: statusText
|
||||
|
||||
// Execute
|
||||
CefResponseCppToC::Get(self)->SetStatusText(CefString(statusText));
|
||||
@@ -150,10 +147,7 @@ void CEF_CALLBACK response_set_mime_type(struct _cef_response_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: mimeType; type: string_byref_const
|
||||
DCHECK(mimeType);
|
||||
if (!mimeType)
|
||||
return;
|
||||
// Unverified params: mimeType
|
||||
|
||||
// Execute
|
||||
CefResponseCppToC::Get(self)->SetMimeType(CefString(mimeType));
|
||||
@@ -181,10 +175,7 @@ void CEF_CALLBACK response_set_charset(struct _cef_response_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: charset; type: string_byref_const
|
||||
DCHECK(charset);
|
||||
if (!charset)
|
||||
return;
|
||||
// Unverified params: charset
|
||||
|
||||
// Execute
|
||||
CefResponseCppToC::Get(self)->SetCharset(CefString(charset));
|
||||
@@ -275,10 +266,7 @@ void CEF_CALLBACK response_set_url(struct _cef_response_t* self,
|
||||
DCHECK(self);
|
||||
if (!self)
|
||||
return;
|
||||
// Verify param: url; type: string_byref_const
|
||||
DCHECK(url);
|
||||
if (!url)
|
||||
return;
|
||||
// Unverified params: url
|
||||
|
||||
// Execute
|
||||
CefResponseCppToC::Get(self)->SetURL(CefString(url));
|
||||
|
Reference in New Issue
Block a user