2
votes

I'm using TChromium for authorisation. I have variable Chromium1: TChromium;. I need to destroy chromium on form hide and show on form show. (Because chromium some times raises exception "EExternal Exception in module libcef.dll" and crashes my app, I think that destruction of Chromium when it no uses will help). I have:

procedure TAuthForm.FormShow(Sender: TObject);
begin
  Chromium1 := TChromium.Create(self);
  Chromium1.Align := alClient;
  Chromium1.OnJsdialog := Chromium1Jsdialog;
  Chromium1.OnBeforePopup := Chromium1BeforePopup;
  Chromium1.DefaultUrl := 'about:blank';
  Chromium1.Parent := Self;
  Chromium1.Load(AUTH_URL);
end;

procedure TAuthForm.FormHide(Sender: TObject);
begin
  Chromium1.Free;
end;

The problem is that when TAuthForm.FormShow called first, page loads correctly, but when I hide form and show it again browser displays page incorrectly, don't now how to explain here is an example for http://google.com/:

Google(function(){ window.google={kEI:"oKRKUZ2iHafP4QTXwYCwDw",getEI:function(a)    {for(var b;a&&(!a.getAttribute||!(b=a.getAttribute("eid")));)a=a.parentNode;return b||google.kEI},https:function(){return"https:"==window.location.protocol},kEXPI:"17259,39523,4000116,4001076,4001568,4001948,4001959,4001975,4002562,4002734,4002855,4003178,4003387,4003495,4003917,4004181,4004213,4004257,4004334,4004340,4004479,4004652,4004653,4004697,4004730,4004755,4004759,4004766,4004898,4004905,4004949,4004953,4005154",kCSI:{e:"17259,39523,4000116,4001076,4001568,4001948,4001959,4001975,4002562,4002734,4002855,4003178,4003387,4003495,4003917,4004181,4004213,4004257,4004334,4004340,4004479,4004652,4004653,4004697,4004730,4004755,4004759,4004766,4004898,4004905,4004949,4004953,4005154",ei:"oKRKUZ2iHafP4QTXwYCwDw"},authuser:0,ml:function(){},pageState:"#",kHL:"ru",time:function(){return(new Date).getTime()},log:function(a, b,c,h){var d=new Image,f=google.lc,e=google.li,g="";d.onerror=d.onload=d.onabort=function(){delete f[e]};f[e]=d;!c&&-1==b.search("&ei=")&&(g="&ei="+google.getEI(h));c=c||"/gen_204?........

it shows the content of all blocks including <title> and <script> as you can see here...

I've tried to find the solution, but found only the same error(I mean libcef.dll exception without solution), here: https://stackguides.com/questions/13784792/cef3-application-crash-fault-module-kernelbase-dll in comments...

1

1 Answers

0
votes

Chromium1.Free; is the pbm it destroys your chrom instance , son you can't re see it again

just do :

Chromium1.visible := false; // if you wish to hide it