Add warning to LoadRequest about INVALID_INITIATOR_ORIGIN (213) failure condition (see issue #2586)

This commit is contained in:
Marshall Greenblatt
2019-10-15 15:06:09 +02:00
parent b560f04046
commit d28efe8797
3 changed files with 19 additions and 1 deletions

View File

@@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for // by hand. See the translator.README.txt file in the tools directory for
// more information. // more information.
// //
// $hash=6bef924a259845dbf03e9cf5084ff7feb2771034$ // $hash=5f3cb132c1116a36c746c246ebeded195c917718$
// //
#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_ #ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
@@ -131,6 +131,10 @@ typedef struct _cef_frame_t {
/// ///
// Load the request represented by the |request| object. // Load the request represented by the |request| object.
//
// WARNING: This function will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the request
// origin using some other mechanism (LoadURL, link click, etc).
/// ///
void(CEF_CALLBACK* load_request)(struct _cef_frame_t* self, void(CEF_CALLBACK* load_request)(struct _cef_frame_t* self,
struct _cef_request_t* request); struct _cef_request_t* request);

View File

@@ -131,6 +131,10 @@ class CefFrame : public virtual CefBaseRefCounted {
/// ///
// Load the request represented by the |request| object. // Load the request represented by the |request| object.
//
// WARNING: This method will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the
// request origin using some other mechanism (LoadURL, link click, etc).
/// ///
/*--cef()--*/ /*--cef()--*/
virtual void LoadRequest(CefRefPtr<CefRequest> request) = 0; virtual void LoadRequest(CefRefPtr<CefRequest> request) = 0;

View File

@@ -100,6 +100,16 @@ void RunRequestTest(CefRefPtr<CefBrowser> browser) {
// Create a new request // Create a new request
CefRefPtr<CefRequest> request(CefRequest::Create()); CefRefPtr<CefRequest> request(CefRequest::Create());
if (browser->GetMainFrame()->GetURL().ToString().find("http://tests/") != 0) {
// The LoadRequest method will fail with "bad IPC message" reason
// INVALID_INITIATOR_ORIGIN (213) unless you first navigate to the
// request origin using some other mechanism (LoadURL, link click, etc).
Alert(browser,
"Please first navigate to a http://tests/ URL. "
"For example, first load Tests > Other Tests.");
return;
}
// Set the request URL // Set the request URL
request->SetURL("http://tests/request"); request->SetURL("http://tests/request");