I'm using Chromium to retrieve fiscal notes from a government website. This process requires a digital certificate, which I've implemented successfully. However, I need to switch certificates to retrieve notes from different accounts. When I try to destroy the browser and recreate it with a new context to handle different certificates, I encounter an access violation error.
I need assistance with managing browser contexts effectively. I want to destroy and recreate them to seamlessly change certificates between sessions.
Here's the existing creation code:
Code: Select all
if GlobalCEFApp = nil then
CreateGlobalCEFApp;
inherited Create(AOwner);
pvTimerInicializacao := TTimer.Create(Self);
pvTimerInicializacao.Enabled := False;
pvTimerInicializacao.Interval := 300;
pvTimerInicializacao.OnTimer := pvTimerInicializacaoTimer;
CreateBrowser(pvCEFWindow, pvWindowName, TCefRequestContextRef.New('', '', '', False, False ,False))
Code: Select all
procedure TConsisaChromium.pvTimerInicializacaoTimer(Sender: TObject);
begin
pvTimerInicializacao.Enabled := False;
if not(inherited CreateBrowser(pvCEFWindow, pvWindowName)) then
pvTimerInicializacao.Enabled := True;
end;
Code: Select all
CloseAllConnections(False);
while not(pvConexoesFinalizadas) do
Application.ProcessMessages;
CloseBrowser(True);
while not(pvBrowserDestruido) do
Application.ProcessMessages;
if pvDevTools then
CloseDevTools;