# State of Mozilla in Ruby - rbXPCOM, Ruby-Gtk/MozEmbed

**URL:** <https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548>\
**Category:** Ruby\
**Created:** [May 6, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548 "2006-05-06T14:02:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 2:02pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/1 "2006-05-06T14:02:04Z")

</div>

Hello,

I have been asking this more times here but did not got even a single  
answer - not even a ‘we don’t know’ so please this time send me a ‘we  
don’t know’ at least (I have no clue who should send this, though 😉

ATM i am working on an open-source web extraction product - it will be a  
mozilla based screen scraping tool, which will need minimal user  
interaction to mine the relevant data (more or less you will have to  
draw a box around the data you would like to extract and it will be  
extracted automatically). As i am working in a web extraction company  
for the 5th year now, i know that this will be a killer app, and my  
employer’s 150.000 EUR software is nowhere near this effectivity (at  
least not w.r.t the screen scraping part).

This is all very nice, but why i am writing this here? Because so far  
this cool product is in Java - for two reasons:

1. When i begun with it i did not know Ruby
2. Even if 1) would not true, we had (and still have) every tool we  
needed in Java, whereas this is not true for Ruby(?) Or? This is the  
question i would like to ask.

Alternatively, 1) could be replaced somehow in a fashion that the IDE  
would be a mozilla browser and i would call Ruby through JS from the  
browser.

The app is based on mozilla, i need 2 things there:

1. A widget that can be embedded into a GTK (or something equal) Ruby TK  
GUI or alternatively a way to call Ruby code from mozilla
2. rbXPCOM or something similar binding to access the Mozilla DOM via  
XPCOM.

Basically i need to render a page, and get the nsIDOMDOCument of that  
page to get started.

I have already contacted the author of 1), however i have no clue about  
2). Does anybody have idea about it, or about the whole stuff in general  
(i.e. if it could be moved from Java to Ruby)

It would be a pity to not gain some + attention to Ruby through this,  
since i would like to launch a web portal with this product later, and  
if i can not do it in Ruby, i has to stay with Java (which i don’t  
really like anyway, mainly when compared to Ruby)

Cheers,  
Peter

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 2:08pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/2 "2006-05-06T14:08:14Z")

</div>

This goes to the second 1):

> Alternatively, 1) could be replaced somehow in a fashion that the IDE  
> would be a mozilla browser and i would call Ruby through JS from the  
> browser.  
> here:

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 3:02pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/3 "2006-05-06T15:02:22Z")

</div>

Hi,

On Sat, 6 May 2006 20:59:56 +0900  
Peter S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hello,

> The app is based on mozilla, i need 2 things there:
> 
> 1. A widget that can be embedded into a GTK (or something equal) Ruby TK  
> GUI or alternatively a way to call Ruby code from mozilla
> 2. rbXPCOM or something similar binding to access the Mozilla DOM via  
> XPCOM.

Ruby/GtkMozEmbed has already been included Ruby-GNOME2.  
And there is a movie to build mozilla based WWW browser using  
Ruby-GNOME2.  
[http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyZilla](http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyZilla)

Though, it’s not support rbXPCOM.

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 4:30pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/4 "2006-05-06T16:30:18Z")

</div>

> Ruby/GtkMozEmbed has already been included Ruby-GNOME2.  
> And there is a movie to build mozilla based WWW browser using Ruby-GNOME2.  
> [http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyZilla](http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyZilla)
> 
> Though, it’s not support rbXPCOM.

Thx for the answer. So it seems my question is reduced to ‘how can i get  
access  
the mozilla DOM of a page which has been rendered inside a Ruby-GNOME2  
based  
WWW browser’

C’mon guys, is this really impossible in Ruby ATM? I can’t believe Java  
beats Ruby in this…

Cheers,  
Peter

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 4:42pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/5 "2006-05-06T16:42:32Z")

</div>

Quoting Peter S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

What about trying Korundum and building the web browser around KHTML? If  
it  
works for Apple, it could work for you.

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 8:49pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/6 "2006-05-06T20:49:01Z")

</div>

> > C’mon guys, is this really impossible in Ruby ATM? I can’t believe  
> > Java beats Ruby in this…
> 
> Of course it’s not impossible! You just have to improve GtkMozEmbed  
> yourself. =) You should also look into Korundum, I suppose.

I know that this is definitely not impossible, since it was done in C,  
Java, and even Python (PyXPCOM), i even know how to do it, but i don’t  
have time for it (I have very limited time even for the ‘parent’  
project, and writing rbXPCOM or similar does not fit into this at  
all…)

OK, i will try to propose this for the google SOC (PyXPCOM was proposed  
last summer, too) and i’ll see. Well, if not… I guess i will have to  
stick with java (…sigh…)

Cheers,  
Peter

---

<div class="post-metadata">

**Author:** ![splattael](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/858c86/32.png) [@splattael](https://www.ruby-forum.com/u/splattael)\
**Post date:** [May 6, 2006, 8:27pm UTC](https://www.ruby-forum.com/t/state-of-mozilla-in-ruby-rbxpcom-ruby-gtk-mozembed/94548/7 "2006-05-06T20:27:19Z")

</div>

Peter S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) writes:

> > Ruby/GtkMozEmbed has already been included Ruby-GNOME2.  
> > And there is a movie to build mozilla based WWW browser using Ruby-GNOME2.  
> > [http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyZilla](http://ruby-gnome2.sourceforge.jp/hiki.cgi?RubyZilla)
> > 
> > Though, it’s not support rbXPCOM.
> 
> Thx for the answer. So it seems my question is reduced to ‘how can i  
> get access the mozilla DOM of a page which has been rendered inside  
> a Ruby-GNOME2 based WWW browser’

I was playing a bit with the Ruby GtkMozEmbed bindings, and it seemed  
they were rather superficial. That is, you could drop a mozilla widget  
into your app, and said widget could browse just like real Mozilla,  
but the interaction between Ruby and the widget was more on the level  
of “browse this url” and “what url are you at now?” rather than  
offering any access to the contents of the DOM itself or even such  
basic things as scrolling the Mozilla widget.

Of course, I was just looking at the documentation and not at the  
source itself. Perhaps it has more features that are undocumented.

> C’mon guys, is this really impossible in Ruby ATM? I can’t believe  
> Java beats Ruby in this…

Of course it’s not impossible! You just have to improve GtkMozEmbed  
yourself. =) You should also look into Korundum, I suppose.

-Phil
