Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
There is a fatal bug in the doOnBeforePopup function
Re: There is a fatal bug in the doOnBeforePopup function
So maybe in cef there is some kind of nibul functional that allows you to programmatically create popap without js. Tell me what causes the BeforePopap event where to look at this code where doBeforePopap will be called
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: There is a fatal bug in the doOnBeforePopup function
As far as I know, that code is not in CEF.
Chromium's code uses those callbacks that CEF4Delphi exposes as events.
Chromium's code uses those callbacks that CEF4Delphi exposes as events.
Re: There is a fatal bug in the doOnBeforePopup function
noJavascriptAccess means what?salvadordf wrote: Tue Aug 06, 2019 7:19 pm I opened this URL using SimpleBrowser2 and MiniBrowser because SimpleBrowser2 blocks all popups but MiniBrowser allows all popups :
https://search.daum.net/search?w=tot&DA=YZR&t__nil_searchbox=btn&sug=&sugo=&q=%EC%A3%BC%EC%98%A5%EC%88%9C
MiniBrowser opened the popup window when I clicked that search result marked in red.
SimpleBrowser2 blocked the popup window when I clicked that search result marked in red.
I also tested https://www.daum.net/ and I clicked several ads with SimpleBrowser2 and MiniBrowser. MiniBrowser opened popup windows when I clicked the ads but SimpleBrowser2 blocked all of them.
I tested all this in Delphi 10.3 and Lazarus 2.0.2
Please, download the latest CEF4Delphi version and replace TChromium.doOnBeforePopup with this code in uCEFChromium.pas :Enable the log in NinjaBrowser setting these properties :Code: Select all
function TChromium.doOnBeforePopup(const browser : ICefBrowser; const frame : ICefFrame; const targetUrl : ustring; const targetFrameName : ustring; targetDisposition : TCefWindowOpenDisposition; userGesture : Boolean; const popupFeatures : TCefPopupFeatures; var windowInfo : TCefWindowInfo; var client : ICefClient; var settings : TCefBrowserSettings; var extra_info : ICefDictionaryValue; var noJavascriptAccess : Boolean): Boolean; begin Result := False; if Assigned(FOnBeforePopup) then FOnBeforePopup(Self, browser, frame, targetUrl, targetFrameName, targetDisposition, userGesture, popupFeatures, windowInfo, client, settings, extra_info, noJavascriptAccess, Result); CefDebugLog('Result value : ' + BoolToStr(Result, true)); end;
Build CEF4Delphi and NinjaBrowser, navigate to the previous URL, click on the search result marked in red, close the browser and the open the debug.log file.Code: Select all
GlobalCEFApp.LogFile := 'debug.log'; GlobalCEFApp.LogSeverity := LOGSEVERITY_VERBOSE;
If you see a text line with "Result value : false" and you set Result to true inside NinjaBrowser then there's an issue passing a "var" parameter from C++ to CEF4Delphi.
If I set it to true, error will happened.
- salvadordf
- Posts: 4564
- Joined: Thu Feb 02, 2017 12:24 pm
- Location: Spain
- Contact:
Re: There is a fatal bug in the doOnBeforePopup function
It's explained in the code comments for the TChromiumCore.OnBeforePopup event :
https://github.com/salvadordf/CEF4Delphi/blob/8e5b4e4ef38cf9bbcd11509dbf6a7926f9e35422/source/uCEFChromiumCore.pas#L2682
https://github.com/salvadordf/CEF4Delphi/blob/8e5b4e4ef38cf9bbcd11509dbf6a7926f9e35422/source/uCEFChromiumCore.pas#L2682
Re: There is a fatal bug in the doOnBeforePopup function
no_javascript_access|
/// value is set to false (0) the new browser will not be scriptable and may
/// not be hosted in the same renderer process as the source browser.
Thank you very much!
/// value is set to false (0) the new browser will not be scriptable and may
/// not be hosted in the same renderer process as the source browser.
Thank you very much!