Execute JS Before Tampering

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Execute JS Before Tampering

Postby cretz » Mon Aug 14, 2017 12:01 am

I have an issue where I need to exec some JS that instantiates a window.MutationObserver, but I can't let it be tampered with (i.e. for an ad blocker). Where can I do this? I can tamper with window.MutationObserver in a <head> script and it is changed before CefLoadHandler::OnLoadStart is called. CefRenderProcessHandler::OnContextCreated isn't even called on pages without JS but when it is, it's actually early enough for me to get in there (but I'm suffering some node issues where some are already half added which is a different problem).

Is there a clean way to do this? Or should I call a no-op JS call in OnLoadStart so OnContextCreated is fired so I can run JS there? As some work is being done around web extension support, how is run_at implemented for document_start?
cretz
Techie
 
Posts: 34
Joined: Mon Jun 26, 2017 11:41 am

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 34 guests