I want to display an error page when an error occurs during loading. For this, I implemented OnLoadError and used LoadString to load an HTML page tinkered up at runtime, pretty much in the same way as SimpleHandler::OnLoadError does in the cefsimple example app.
However, I noticed a strange behaviour: When navigating to an URL that doesn't exist, the page goes blank, the error page does not show up. When reloading the page through browser->Reload(), the error page would show up. I tried adding methods for OnLoadStart and OnLoadEnd and noticed OnLoadError is called before OnLoadStart! Also, OnLoadEnd always returns HTTP Status 200. Apparently, the LoadString in the OnLoadError causes CEF to get confused about the loading state. Where else should I put LoadString if not in OnLoadError?
There is another oddity: The documentation states that CefLoadHandler callbacks may be called in the browser process or in the renderer process. However, if I add a call to CEF_REQUIRE_UI_THREAD to OnLoadStart, OnLoadEnd and OnLoadError callbacks, the macro never fails, so apparently they're never called in the renderer process.
EDIT: I've just commented out the call to LoadString and realized that even now, OnLoadError is called before OnLoadStart/OnLoadEnd, and OnLoadEnd comes with an HTTP status of 200 even if the requested server does not exist! Is this a bug in CEF or am I doing something wrong?