Page 2 of 2

Re: Update to CEF 78.3.9

Posted: Sat Nov 30, 2019 12:06 pm
by thefunkyjoint
Your demos all work fine, no crashes on my machine !

It seems the problem has to do with the way i'm creating the components ; i create on runtime, instead of placing them on the form in design time.

Here is a sample app that i get the crash when navigating to www.bing.com

Code: Select all

unit princ;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, uCEFChromium, uCEFWindowParent, ExtCtrls, OleCtrls, SHDocVw,
  uCEFInterfaces, uCEFConstants, uCEFChromiumWindow, uCEFWinControl;

type
  TForm1 = class(TForm)
    Panel1: TPanel;
    Edit1: TEdit;
    Button1: TButton;
    pweb: TPanel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure webAfterCreated(Sender: TObject; const browser: ICefBrowser);
  private
    { Private declarations }
  public
  webc:TChromium;
  cefwindowparent1 : TCEFWindowParent;
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
begin
  cefwindowparent1.bringtofront;
  webc.LoadURL(edit1.text);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
webc := TChromium.Create(pweb);
cefwindowparent1 := TCEFWindowParent.Create(pweb);
cefwindowparent1.Align := alclient;
cefwindowparent1.Parent := pweb;
webc.CreateBrowser(cefwindowparent1);
end;

procedure TForm1.webAfterCreated(Sender: TObject; const browser: ICefBrowser);
begin
PostMessage(Handle, CEF_AFTERCREATED, 0, 0);
end;

end.

Re: Update to CEF 78.3.9

Posted: Sun Dec 01, 2019 12:24 pm
by thefunkyjoint
Finally after a lot of tests, i could find out what is crashing my app when i navigate to www.bing.com.br , and i could also reproduce the issue on the SimpleBrowser demo. Just add this line :

GlobalCEFAPP.SingleProcess := true;

And the demo will crash when navigating to www.bing.com , at least on Delphi 2007.

I only use singleprocess in development time, in production i use a different EXE file for subprocess.

If i don't use singleprocess in development time, i can't debug my app, a lot of weird stuff happens like Delphi popping up the CPU window and that
'System exception (code 0xc000001d)' crash.

What should i do in development time ? Is there a way to NOT use singleprocess and avoid Delphi to popping up CPU Window all the time ?

Re: Update to CEF 78.3.9

Posted: Sun Dec 01, 2019 3:53 pm
by salvadordf
I just added two pinned forum threads in the issues section : The first link has the step-by-step guide to get the call stack trace with WinDbg that I promised.

I also added the second thread to warn CEF4Delphi developers about the most common issues they might have.

There are some alternatives to the "Single process" mode described in this page :
https://www.briskbard.com/index.php?lan ... #debugging

The most common is using the "Run->Run Without Debugging..." and "Run->Attach To Process..." menu options in Delphi to debug one of the render processes in case you need to debug some code that is only executed in that process.

Another option is to add calls to the CefDebugLog function with custom text and variable values. Use it in the procedures that might give problems and remember to disable them in the final version of your application.

Add these property values before the GlobalCEFApp.StartMainProcess and GlobalCEFApp.StartSubProcess calls to enable logging :

Code: Select all

  GlobalCEFApp.LogFile             := 'debug.log';
  GlobalCEFApp.LogSeverity         := LOGSEVERITY_VERBOSE;
The "debug.log" file will have all the text and values used in the CefDebugLog calls.

Re: Update to CEF 78.3.9

Posted: Mon Dec 02, 2019 12:38 pm
by salvadordf
I just experienced another 'System exception (code 0xc000001d)' crash using the debug libraries in Windows 10.

Read this for more information and a workaround :
https://www.briskbard.com/forum/viewtop ... 4641#p4641

Re: Update to CEF 78.3.9

Posted: Wed Dec 04, 2019 9:45 am
by dilfich

Code: Select all

GlobalCEFApp.SitePerProcess:= False;
GlobalCEFApp.DisableWebSecurity:= True;
GlobalCEFApp.AllowRunningInsecureContent:= True;
What's wrong, why doesn't it work?

JS: Uncaught SecurityError: Blocked a frame with origin

Re: Update to CEF 78.3.9

Posted: Wed Dec 04, 2019 10:36 am
by salvadordf
You can try 3 properties to disable cross origin security :
  • Set GlobalCEFApp.DisableWebSecurity to true before the GlobalCEFApp.StartMainProcess call (you already tried this)
  • Set TChromium.Options.WebSecurity to STATE_DISABLED before the TChromium.CreateBrowser call. This should the same as GlobalCEFApp.DisableWebSecurity.
  • Set GlobalCEFApp.DisableSiteIsolationTrials to true before the GlobalCEFApp.StartMainProcess call. This property was added to CEF4Delphi today. Download CEF4Delphi from GitHub to test it.

Re: Update to CEF 78.3.9

Posted: Thu Dec 05, 2019 4:34 pm
by thefunkyjoint
salvadordf wrote: Sun Dec 01, 2019 3:53 pm I just added two pinned forum threads in the issues section : The first link has the step-by-step guide to get the call stack trace with WinDbg that I promised.

I also added the second thread to warn CEF4Delphi developers about the most common issues they might have.

There are some alternatives to the "Single process" mode described in this page :
https://www.briskbard.com/index.php?lan ... #debugging

The most common is using the "Run->Run Without Debugging..." and "Run->Attach To Process..." menu options in Delphi to debug one of the render processes in case you need to debug some code that is only executed in that process.

Another option is to add calls to the CefDebugLog function with custom text and variable values. Use it in the procedures that might give problems and remember to disable them in the final version of your application.

Add these property values before the GlobalCEFApp.StartMainProcess and GlobalCEFApp.StartSubProcess calls to enable logging :

Code: Select all

  GlobalCEFApp.LogFile             := 'debug.log';
  GlobalCEFApp.LogSeverity         := LOGSEVERITY_VERBOSE;
The "debug.log" file will have all the text and values used in the CefDebugLog calls.
Indeed, after i reinstalled Delphi again and stopped to use SingleProcess := true, the random crashes also stopped ! :D