Skip to content

Commit

Permalink
Add warning to LoadRequest about INVALID_INITIATOR_ORIGIN (213) failu…
Browse files Browse the repository at this point in the history
…re condition (see issue chromiumembedded#2586)
  • Loading branch information
magreenblatt committed Oct 15, 2019
1 parent 7692d87 commit 7d243e1
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 5 additions & 1 deletion include/capi/cef_frame_capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=6bef924a259845dbf03e9cf5084ff7feb2771034$
// $hash=5f3cb132c1116a36c746c246ebeded195c917718$
//

#ifndef CEF_INCLUDE_CAPI_CEF_FRAME_CAPI_H_
Expand Down Expand Up @@ -131,6 +131,10 @@ typedef struct _cef_frame_t {

///
// 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,
struct _cef_request_t* request);
Expand Down
4 changes: 4 additions & 0 deletions include/cef_frame.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ class CefFrame : public virtual CefBaseRefCounted {

///
// 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()--*/
virtual void LoadRequest(CefRefPtr<CefRequest> request) = 0;
Expand Down
10 changes: 10 additions & 0 deletions tests/cefclient/browser/test_runner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ void RunRequestTest(CefRefPtr<CefBrowser> browser) {
// Create a new request
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
request->SetURL("http://tests/request");

Expand Down

0 comments on commit 7d243e1

Please sign in to comment.