I'm trying to do this via CefRegisterExtension like this:
- Code: Select all
void ClientApp::OnWebKitInitialized()
{
// Register the client_app extension.
// ...
// ...
// ...
// Register the confirm() JS function intercept extension.
std::string intercept_js_code =
"(function() { "
" window.confirm = function () { "
" alert('intercepted'); "
" return true; "
" } "
"})(); "
;
CefRegisterExtension("v8/ijs", intercept_js_code,
new ClientAppExtensionHandler(this));
RenderDelegateSet::iterator it = render_delegates_.begin();
for (; it != render_delegates_.end(); ++it)
(*it)->OnWebKitInitialized(this);
}
With the intercept_js_code inserted to the frame every call of JS confirm() should result in showing an alert box with text "intercepted". But instead of this none of web-pages is ever loaded while the "v8/ijs" extension is registered.
Chromium just showing the blank page and loading forever...
So, what is wrong?
And how do i achieve the interception of confirm() JS function call?