Webkit backend for Hulahop

From Sugar Labs

Jump to: navigation, search

Contents

[This was a backup proposal, I got accepted for the other one.]

About you

Lucian Branescu Mihaila

lucian dot braNOSPAMnescu at gmail dot com

lucian

lucian. backups are lucian1900 and sindbad1900

English and Romanian, either is fine.

Mostly in the UK, perhaps a short while in Romania during the summer break. I don't have a 'coding time' in my schedule, anything goes. I also often stay up late at night.

I've started a small project on freshmeat called statusPidgin that fetched text from various sources and made it a status message in Pidgin. It's now abandoned, but you can find the source on softpedia
I have also released one of my school projects as open source (a small web imap/pop3 client), but I doubt it's still hosted anywhere. You can get it from my dropbox. I haven't contributed in a significant way to open source projects before, beside bug reports and small patches.
I am a user of open source (linux, KDE, gcc, python, firefox, webkit) and am absolutely delighted by the concept. I am convinced it is the most efficient way of developing software, and perhaps not only software.
I am especially interested in the Sugar project, as I have myself experienced the closed-mindedness that schools instill in their students by teaching them using closed source software. I have been fortunate enough to get some exposure to linux and kde early enough and I would like to help others by showing them the alternatives.

About your project

Webkit backend for Hulahop

I will be attempting to write a Webkit backend for Hulahop. This will require minimal modifications of Hulahop's APIs where they expose PyXPCOM or xulrunner internals (mostly just a few renames).

Hulahop has a rather nice, simple, python API for integrating browsers in PyGTK applications. It embeds XULrunner with a small chrome and provides simple enough interaction between Python and the DOM inside the chrome. It is built on PyXPCOM, which allows interaction between Python and XPCOM components.

PyWebkitGTK unsurprisingly provides a PyGTK widget with a browser inside. It's API is lower level than Hulahop and more specific to Webkit, so it should be both feasible and beneficial to the community at large to wrap PyWebkitGTK in Hulahop's API..

I intend to provide an alternative WebView implementation for Hulahop that embeds Webkit. Hulahop's API does have places where PyXPCOM bleeds through, so I will attempt to provide a WebView class with as little dependency on a specific engine as possible. This project is not aimed at providing a complete a drop-in replacement for the current (Gecko) version of hulahop. Firstly, activities (like Browse) that use hulahop do not restrict themselves to an engine-independent subset of the API, so they will have to be modified in order to work with hulahop-webkit. Secondly, XUL extensions only work on Gecko, not on Webkit.
The motivation for this project is the fact that there is a lot of empirical data that shows Webkit is significantly faster and uses significantly less memory than Gecko. Some experimentation was already done on the XO. I have made some of my own tests that confirm most of these results, both on OS X natively and on linux in VirtualBox. Webkit ends up being anywhere from 1.2 to 9 times faster than Gecko on benchmarks.

Besides these synthetic benchmarks, there is also a significant difference in the (decidedly subjective) user experience. While running the more intensive benchmarks, the Webkit demo browser was much more responsive than Gecko, which frequently locked up. The same trend is observed on the Chrome Experiments. There may be some bias on the part of the builders of these experiments that may make the observation invalid, since Chrome uses Webkit. However, these experiments stress the JavaScript engine much more than anything else and Chrome has a different engine (v8) to Webkit. This may have to do with better threading and different interactions with the Python and gobject bindings, but considering that both bindings use GTK and have Cairo rendering, it is at least reasonable to conclude that the browser widget in PyWebkitGTK has better user responsiveness than the one in Hulahop-gecko.

  1. Browse-WebKit is mostly incomplete.
  2. Some other GTK WebKit browser. They would have to be sugarized.

Both of these would only provide WebKit for Browse. Other activities that need a browser GTK widget, like SocialCalc would have to recycle Browse source, which is less than optimal.

Hulahop can load some Firefox extensions right now, and this ability would be lost for the Webkit version. However, it's not that big a problem because 1) many XUL extensions target the Firefox chrome, which does not exist in Browse and 2) userscripts (GreaseMonkey) are lighter-weight extensions that work in many browsers (GreaseMonkey for Firefox, GreaseKit for Safari, Opera, Chrome, etc.). Although userscripts do not have the same access to browser and native APIs as XUL extensions, they are still very capable. Some even envision userscripts getting APIs to supplement some of the capabilities they are currently lacking.

I plan to get a small WebView class working with both webkit and gecko in the first 2-3 weeks. Two weeks at most should be necessary to build a demo browser with controls (and change the WebView class where necessary). The rest could be spent on investigating and refactoring Browse and polishing things up or for emergencies. Milestones:

  1. Replacement WebView class instantiates and displays google.com successfully
  2. hulahop-webkit works with this snippet, with adjustments if necessary
  3. Browse modified to use the the Hulahop API with can load google.com
  4. Browse can browse history and make/load bookmarks
  5. Browse can save/restore to/from the Journal

Python is my favourite programming language and JavaScript is a close enough second. I have some experience with python and I've built various things, from small utilities to websites with it. My most interesting project was helping to port a scientific application from c++ and Qt3 to Python and Qt4. It involved writing some Pyrex as well. It was lovely to see just how much the code shrunk, while keeping the application itself just as speedy.

I have used JavaScript and HTML to build a small web game, Mousebuster (not online, get it from my dropbox). Although at first I did not like javascript at all, I quickly realised it's immense advantage: huge existing install base.

I also had some contact with C# and Java and have been thoroughly disappointed by their general lack of expressiveness. I did one small schoolwork in C#, that dealt with a database of students. Recently, I did another small schoolwork in Java, dealing with a cricket club. After finishing each, I was amazed at how much of my code was just boilerplate or fighting the type system, code that I wouldn't have had to write in a more dynamic language.

I also used various linux distros for several years, until last year. I got a macbook as a gift and broadcom drivers are still a mess, but that'll get fixed at some point. I found unix in general so intriguing that I set up a small home server with a 300mhz CPU. I put debian on it and used it for various purposes, from web hosting, file serving, distcc node to a router for my home.

Since I was using a lot of open source at home, I tried to push it in school as well. I managed to make students and teachers aware of GCC as a replacement for Borland C/C++, Mono and SharpDevelop as a replacement for the not-quite-free Visual Studio. With the help of a friend, I even managed to convince the head of school to install Ubuntu in one of the labs.

You and the community

I'm not familiar with schools near where I live, as I am an international student. [Any suggestions?]

Google, check Sugar Labs/OLPC forums/mailing lists/wikis. Ask on #sugar/mailing list. Ask other mentors and GSoC students or developers of related open source software.

In the worst case scenario, just emails to my mentor and commits. IRC has proven itself time and again and I intend to proudly announce any advances made. I intend to set up a blog and use that as well. Identi.ca or Twitter may also prove useful.

Miscellaneous

My development environment with the small hack.

Picture to the right.

XL

The most important thing I ever learned was to never be certain of anything and to always be prepared for the worst.

Web technologies are remarkably flexible and it would be great to encourage students to play around with them.

Personal tools
Namespaces
Variants
Actions
Sugar
Projects
Teams
Local Labs
Using the Wiki
Google translations