Frame names crash

Post Reply
glamenoise
Posts: 2
Joined: Wed Feb 24, 2021 6:18 pm

Frame names crash

Post 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?
glamenoise
Posts: 2
Joined: Wed Feb 24, 2021 6:18 pm

Re: Frame names crash

Post by glamenoise »

Removed and re-installed this time CEF 88.2.9 win32 same result...
User avatar
salvadordf
Posts: 2966
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Frame names crash

Post 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.
glamenoise
Posts: 2
Joined: Wed Feb 24, 2021 6:18 pm

Re: Frame names crash

Post 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;
Last edited by glamenoise on Wed Feb 24, 2021 8:33 pm, edited 1 time in total.
Post Reply