Page 1 of 1

Frame names crash

Posted: Wed Feb 24, 2021 6:31 pm
by glamenoise
Using Delphi 10.4, windows 10, CEF 85.3.12, demo program uMiniBrowser.

I added a TButton and a TMemo to the TMiniBrowserFrm form.

Added the onclick procedure for the TButton:

procedure TMiniBrowserFrm.Button1Click(Sender: TObject);
var S: TStrings;
begin
S:= TStrings.Create;
Chromium1.GetFrameNames(S);
Memo1.Lines.Text:= S.Text;
S.Free;
end;

Run time error takes place in unit System.Classes in following function, the line "Result := GetCount;" generates 'Abstract Error'

function TStrings.Add(const S: string): Integer;
begin
Result := GetCount;
Insert(Result, S);
end;

Any Ideas?

Re: Frame names crash

Posted: Wed Feb 24, 2021 6:56 pm
by glamenoise
Removed and re-installed this time CEF 88.2.9 win32 same result...

Re: Frame names crash

Posted: Wed Feb 24, 2021 7:06 pm
by salvadordf
Hi,

I tried the "Copy HTML frame names to clipboard" context menu option in the latest MiniBrowser demo and it worked correctly.

Please, copy the code from the TMiniBrowserFrm.CopyFramesNamesMsg procedure and try again.

If you still get that error please provide the URL that you are testing to try to reproduce this issue in my computer.

Re: Frame names crash

Posted: Wed Feb 24, 2021 8:32 pm
by glamenoise
Thanks for the suggestion

The problem resides in TStrings vs TStringList. Looking at the TMiniBrowserFrm.CopyFramesNamesMsg procedure I fixed my code to emulate the same behaviour and it works, see changes in bold:

procedure TMiniBrowserFrm.Button1Click(Sender: TObject);
var S: TStringList;
begin
S:= TStringList.Create;
Chromium1.GetFrameNames(TStrings(S));
Memo1.Lines.Text:= S.Text;
S.Free;
end;