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.

Update to CEF 75.0.7

User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Update to CEF 75.0.7

Post by salvadordf »

Hi,

CEF4Delphi is now updated to CEF 75.0.7, which includes Chromium 75.0.3770.80.

This time, CEF has many API changes needed for the "Network Service" in Chromium.
All these API changes are the cause of many changes in CEF4Delphi classes and the applications upgrading to this version need some modifications.

These are all the API changes :
  • new http error codes
  • removed TCefBrowserRef.SendProcessMessage
  • added TCefFrameRef.SendProcessMessage
  • added TCefFrameRef.CreateUrlRequest
  • updated TCustomClientHandler.OnProcessMessageReceived parameters
  • updated TCefCookieManagerRef.SetSupportedSchemes and TCefCookieManagerRef.SetSupportedSchemesProc parameters
  • removed TCefCookieManagerRef.SetStoragePath and TCefCookieManagerRef.SetStoragePathProc
  • removed TCefCookieManagerRef.Blocking
  • removed TCefCookieManagerRef.New
  • removed TCefCookieManagerRef.NewProc
  • updated TCustomDragHandler.OnDraggableRegionsChanged parameters
  • updated TCustomLifeSpanHandler.OnBeforePopup parameters
  • updated TCefCustomRenderProcessHandler.OnBrowserCreated parameters
  • updated TCefCustomRenderProcessHandler.OnProcessMessageReceived parameters
  • added TCefRequestRef.GetHeaderByName
  • added TCefRequestRef.SetHeaderByName
  • renamed TCefRequestContextRef.GetDefaultCookieManager to TCefRequestContextRef.GetCookieManager
  • renamed TCefRequestContextRef.GetDefaultCookieManagerProc to TCefRequestContextRef.GetCookieManagerProc
  • removed TCefRequestContextHandlerRef.GetCookieManager
  • removed TCefRequestContextHandlerOwn.GetCookieManager
  • added TCefRequestContextHandlerRef.GetResourceRequestHandler
  • added TCefRequestContextHandlerOwn.GetResourceRequestHandler
  • removed TCustomRequestHandler.OnBeforeResourceLoad
  • removed TCustomRequestHandler.GetResourceHandler
  • removed TCustomRequestHandler.OnResourceRedirect
  • removed TCustomRequestHandler.OnResourceResponse
  • removed TCustomRequestHandler.GetResourceResponseFilter
  • removed TCustomRequestHandler.OnResourceLoadComplete
  • removed TCustomRequestHandler.OnProtocolExecution
  • added TCustomRequestHandler.GetResourceRequestHandler
  • removed TCustomRequestHandler.CanGetCookies
  • removed TCustomRequestHandler.CanSetCookie
  • added TCefResourceHandlerOwn.open
  • deprecated TCefResourceHandlerOwn.ProcessRequest
  • added TCefResourceHandlerOwn.skip
  • added TCefResourceHandlerOwn.read
  • deprecated TCefResourceHandlerOwn.ReadResponse
  • removed TCefResourceHandlerOwn.CanGetCookie
  • removed TCefResourceHandlerOwn.CanSetCookie
  • added TCefResourceHandlerRef
  • added TCustomResourceRequestHandler
  • added TCustomCookieAccessFilter
  • added TCefResponseRef.Charset
  • updated TChromium.CreateBrowser and TFMXChromium.CreateBrowser parameters
  • updated TChromium.OnProcessMessageReceived and TFMXChromium.OnProcessMessageReceived event parameters
  • updated TChromium.SendProcessMessage and TFMXChromium.SendProcessMessage parameters
  • added TChromium.CreateUrlRequest and TFMXChromium.CreateUrlRequest
  • updated TChromium.OnDraggableRegionsChanged and TFMXChromium.OnDraggableRegionsChanged event parameters
  • updated TChromium.OnBeforePopup and TFMXChromium.OnBeforePopup event parameters
  • updated TCefApplication.OnBrowserCreated (GlobalCEFApp.OnBrowserCreated) event parameters
  • updated TCefApplication.OnProcessMessageReceived (GlobalCEFApp.OnProcessMessageReceived) event parameters
  • added TChromium.OnGetResourceRequestHandler and TFMXChromium.OnGetResourceRequestHandler
  • renamed and updated TChromium.OnCanGetCookies to TChromium.OnCanSendCookie
  • renamed and updated TFMXChromium.OnCanGetCookies to TFMXChromium.OnCanSendCookie
  • renamed and updated TChromium.OnCanSetCookie to TChromium.OnCanSaveCookie
  • renamed and updated TFMXChromium.OnCanSetCookie to TFMXChromium.OnCanSaveCookie
  • added TCefApplication.RootCache (GlobalCEFApp.RootCache) property
  • added TCefApplication.ApplicationClientID (GlobalCEFApp.ApplicationClientID) property
  • added TCefApplication.EnableFeatures (GlobalCEFApp.EnableFeatures) property
  • added TCefApplication.DisableFeatures (GlobalCEFApp.DisableFeatures) property
  • added TCefApplication.EnableBlinkFeatures (GlobalCEFApp.EnableBlinkFeatures) property
  • added TCefApplication.DisableBlinkFeatures (GlobalCEFApp.DisableBlinkFeatures) property
  • removed TCefApplication.Cookies (GlobalCEFApp.Cookies) property
  • removed TCefApplication.DeleteCookies (GlobalCEFApp.DeleteCookies) property
  • updated TChromium.OnGetResourceHandler and TFMXChromium.OnGetResourceHandler parameters
  • updated TChromium.OnProtocolExecution and TFMXChromium.OnProtocolExecution parameters
The most important changes are :
  • GlobalCEFApp.Cookies has been removed from CEF because the procedure to change the cookies location no longer exists. Now the cookies are stored inside the cache directory.
  • The new GlobalCEFApp.RootCache property need to be a parent directory of GlobalCEFApp.Cache or the same directory.
  • GlobalCEFApp.ApplicationClientID is a GUID string passed to the system AV function for scanning downloaded files.
  • GlobalCEFApp.EnableFeatures and GlobalCEFApp.DisableFeatures can be used to enable or disable these features https://chromium.googlesource.com/chrom ... eatures.cc
  • GlobalCEFApp.EnableBlinkFeatures and GlobalCEFApp.DisableBlinkFeatures can be used to enable or disable these features https://cs.chromium.org/chromium/src/th ... ures.json5
Known issues :
  • Loading a "file:///" url will crash the application if the "Network Service" is enabled. Add GlobalCEFApp.DisableFeatures := 'NetworkService'; before the GlobalCEFApp.StartMainProcess call in the DPR file to avoid this problem.
  • OSR browsers don't receive TChromium.OnPaint events if you disable the "Network Service";
  • If you register a custom scheme with the "Network Service" enabled you won't be able to load external HTTPS resources.
  • There is a CEF issue that causes a crash while closing the application in some situations : https://bitbucket.org/chromiumembedded/ ... own-due-to
In general, if you detect any issue with your applications check that the parameters in procedures, functions and events are updated. Also try disabling the "Network Service" with this line before the GlobalCEFApp.StartMainProcess call in the DPR file :

Code: Select all

GlobalCEFApp.DisableFeatures := 'NetworkService';
The CEF binaries are these :
snoop
Posts: 75
Joined: Mon Jul 10, 2017 12:06 pm

Re: Update to CEF 75.0.7

Post by snoop »

hello! frames fixed in this version?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 75.0.7

Post by salvadordf »

The frame names seem to be fixed but there's still an issue when you read the frame IDs in the render process.

Test it in your application to see if this is enough in your case.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Update to CEF 75.0.7

Post by dilfich »

Why the component cannot be assigned the version number? So you can use different versions in the same IDE? For Example, TChromium70 + TChromium75.. :roll:
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 75.0.7

Post by salvadordf »

Then I would have to rename all the other classes, interfaces, etc.
Sorry but that would require too much time.
dilfich
Posts: 330
Joined: Thu Nov 30, 2017 1:17 am

Re: Update to CEF 75.0.7

Post by dilfich »

I do not understand, the directory for Cookies can no longer be specified?

Code: Select all

CookiesPatch.SetStoragePath(ExtractFilePath(Application.ExeName) + 'user_1\Cookies', True, CefBack);
If SetStoragePath removed, but now how to change this path? :?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 75.0.7

Post by salvadordf »

The cookies are stored in the same directory than the cache and there's no way to move them out of the cache.

If you need several independent browsers in your app with different cookie directories you will need to set different cache directories when you create the TCefRequestContextRef.

The cache directory is the first parameter in the TCefRequestContextRef.New call :
https://github.com/salvadordf/CEF4Delph ... m.pas#L214

Read this for more information about the CEF API changes :
https://bitbucket.org/chromiumembedded/ ... orkservice
thefunkyjoint
Posts: 459
Joined: Thu Aug 10, 2017 12:40 pm

Re: Update to CEF 75.0.7

Post by thefunkyjoint »

Great work as usual, Salvador !
rgdawson
Posts: 22
Joined: Tue Apr 10, 2018 11:05 pm

Re: Update to CEF 75.0.7

Post by rgdawson »

Uh oh. In my app cookies are (were) persistent, but the cache is memory (not persistent). I take it this means I can't do it that way anymore?
User avatar
salvadordf
Posts: 4042
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Update to CEF 75.0.7

Post by salvadordf »

rgdawson wrote: Mon Jun 17, 2019 5:22 pm Uh oh. In my app cookies are (were) persistent, but the cache is memory (not persistent). I take it this means I can't do it that way anymore?
I guess you could store the cache in a temporal directory and delete some of its files before initializing CEF in the browser process.

I could be wrong but I think that the files called "Cookies" and "Cookies-journal" store the cookies in the cache directory.

If you delete all the other files inside that directory your application should behave as if the cache was not persistent.
Post Reply