Recent

Author Topic: Status of Gecko SDK Port  (Read 83356 times)

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #15 on: November 07, 2009, 12:25:51 am »
Hi,

I made 2 small changes so it compiles on Linux 64-bit.
Is yours code checked-in somewhere in a version system so I can
create some diffs or how do I communicate changes ?

I think that this component is so important that it should actually be
distributed with Lazarus; It may be a good idea to ask if it can be
committed in their components directory. If you get write permission on
this directory, you can do the maintenance yourself.

If that's not possible/allowed, I suggest trying lazarus-ccr.


I have access to ccr, but it might be a good idea to merge with Takanori's SourceForge code instead. The number of changes I've made has been small so it shouldn't be hard to maintain a single code base.

In any case, I'll create a ccr wiki page at a minimum. There isn't much information other than the code at this point. Takanori's English on his blog looks fine so I don't think it's that he's only comfortable writing in Japanese.

But let's get this thing working first. Please send me your changes.

Thanks.

-Phil



Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #16 on: November 09, 2009, 01:19:47 am »
I've uploaded a .zip file with the following changes:

- Fixes outlined above to eliminate range check errors.
- On Windows, now assumes that Gecko libraries are in xulrunner folder below app instead of assuming that Firefox is installed.

http://web.fastermac.net/~MacPgmr/Lazarus/

Thanks.

-Phil

kri2512

  • New member
  • *
  • Posts: 8
Re: Status of Gecko SDK Port
« Reply #17 on: November 10, 2009, 09:35:33 am »
Hello,
new to this xulRunner / GeckoBrowser code, i tried to test it with Delphi 2007.
it begins to work, but i have one question :
- with others versions (this one : http://ftp.newbielabs.com/Delphi%20Gecko%20SDK/Readme.htm), the LoadURI method worked fine when i was calling it in the OnCreate of the form.
- with this version, it seems that the loadURI have to be in the OnShow event.

i get this error in the OnCreate event : Cannot create instance of nsIURI by URI '10.'  (EGeckoError).

Do you have an idea why it fails in the onCreate event ?

Regards,
christophe



Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #18 on: November 10, 2009, 04:29:00 pm »
I can't tell what sample app you're referring to.

Did you test the BrowseWin.dpr app included in the .zip. That app uses LoadURI in FormCreate and works with Delphi.

Thanks.

-Phil

kri2512

  • New member
  • *
  • Posts: 8
Re: Status of Gecko SDK Port
« Reply #19 on: November 10, 2009, 04:39:54 pm »
Hello,
thanks for answering.
sorry i am talking about my personnal application.

but i just have done the test with the other sample app : GBrowser.dpr, and if you move the LoadURI code into a FormCreate Event instead of the OnShow event, it crashes...
a "safecall" exception, and in debug it stops while a painting event... ?

Regards,
Christophe

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #20 on: November 10, 2009, 04:48:02 pm »
Maybe that's why the call is in FormShow (I didn't write these sample apps).

Can you track down where the exception is occurring?

Thanks.

-Phil

kri2512

  • New member
  • *
  • Posts: 8
Re: Status of Gecko SDK Port
« Reply #21 on: November 10, 2009, 05:04:41 pm »
I talk about that, because i was using an "old" GeckoSDK, GeckoComponents, GRE library (extract from here : http://ftp.newbielabs.com/Delphi%20Gecko%20SDK/Readme.htm) and with this version in the OnCreate, the LoadURI call didn't cause problem.

But it is not problematic for me, i move my code in the OnShow  ;)

for information the safecall error is in GeckoBrowser.pas, TCustomGeckoBrowser.Paint : baseWin.Repaint(True); line 1727.

Another question : is it possible to insert dynamically the html source code in the TGeckoBrowser ?

Regards,
Christophe


Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #22 on: November 10, 2009, 07:22:19 pm »
I started with the old SDK but couldn't get anything to work with it on Delphi.

Is this exception occurring before FormCreate is exiting? With Delphi the sequence with a new form is:

OnCreate
OnShow
OnActivate
OnPaint

Yet it looks like maybe InitWebBrowser is causing the TGeckoBrowser to paint itself, maybe before everything is ready.

For inserting HTML, you could probably generate a temporary file containing the HTML, then load it.

Thanks.

-Phil

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #23 on: November 11, 2009, 03:08:46 am »
I've posted an updated .zip with these changes:

- Glyph for TGeckoBrowser on Lazarus palette.
- Michael Van Canneyt's Linux changes - it should compile okay on Linux now.
- Now compiles okay on PowerPC Mac.

http://web.fastermac.net/~MacPgmr/Lazarus/

Keep testing!

Thanks.

-Phil

kri2512

  • New member
  • *
  • Posts: 8
Re: Status of Gecko SDK Port
« Reply #24 on: November 12, 2009, 10:53:58 am »
Hello,
about the insertion of HTML code, i already generate a html file, and load it after.

but i 've found a code that was nearly working with the an old version of bagel components, here it is :

Code: [Select]
procedure TGeckoBrowser.LoadHTML(htmlcode: String);
var
  wbchrome: nsIWebBrowserChrome;
  wb: nsIWebBrowser;
  domwindow: nsIDOMWindow;
  domdoc: nsIDOMDocument;
  domhtmldoc: nsIDOMHTMLDocument;
  nsstr: IInterfacedString;
begin
  wbchrome := Self as nsIWebBrowserChrome;
  wbchrome.GetWebBrowser(wb);
  wb.GetContentDOMWindow(domwindow);
  domwindow.GetDocument(domdoc);
  domhtmldoc:= domdoc as nsIDOMHTMLDocument;

  nsstr:= NewString;
  nsstr.Assign(htmlcode);
  domhtmldoc.Write(nsstr.AString);
end;

what do you think of that ?

Regards,
Christophe

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #25 on: November 12, 2009, 07:23:11 pm »
Does it work?

You probably know more about this than I do.

Thanks.

-Phil

kri2512

  • New member
  • *
  • Posts: 8
Re: Status of Gecko SDK Port
« Reply #26 on: November 13, 2009, 11:47:43 am »
Hi,
it used to work with the "TBagelBrowser" components, but not with these one.

i get a message "Interface not supported" on the line :
wbchrome := self as nsiWebBrowserChrome;

would be nice if it could work... any help is welcome ;-)

Regards,
Christophe

Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #27 on: November 13, 2009, 04:50:24 pm »
Not sure what you're trying to do there. Offhand I don't think casting Self (descendant of TCustomControl) as an interface would work!

If you need an instance of nsIWebBrowser, just use the WebBrowser property of TGeckoBrowser.

See also TCustomGeckoBrowser.InitWebBrowser.

Thanks.

-Phil

kri2512

  • New member
  • *
  • Posts: 8
Re: Status of Gecko SDK Port
« Reply #28 on: November 13, 2009, 05:00:44 pm »
You are right,
i've rewritten the procedure Loadhtml, it looks like this now :
Code: [Select]
procedure TCustomGeckoBrowser.LoadHTML(htmlcode: string);
var domwindow: nsIDOMWindow;
    domdoc: nsIDOMDocument;
    domhtmldoc: nsIDOMHTMLDocument;
    nsstr: IInterfacedString;
begin
  domwindow:=GetContentWindow;
  domdoc:=GetContentDocument;
  domhtmldoc:=domdoc as nsIDOMHTMLDocument;

  nsstr:= NewString;
  nsstr.Assign(htmlcode);
  domhtmldoc.Write(nsstr.AString);
end;

but i get a different error on the domhtmldoc.write : "OLE ERROR 805303E8"
i've check this error and it corresponds to NS_ERROR_DOM_SECURITY_ERR
but it does not really advance me...





Phil

  • Hero Member
  • *****
  • Posts: 2737
Re: Status of Gecko SDK Port
« Reply #29 on: November 13, 2009, 10:05:17 pm »
I would use the property names (ContentWindow, ContentDocument) instead of the getter functions.

Can you do anything with dochtmldoc? For example, get the page's title or HTML?

You could search the Web and see if you can find a C++ or Java example of what you're trying to do. I have a feeling that Write doesn't do what you think it does.

Thanks.

-Phil

 

TinyPortal © 2005-2018