A Restfully Organic Firefox

June 8th 00:34
by why

I love having Leslie Wu around. She’s an Hpricot/Sandbox dev who’s always thinking about, well, everything. And oh boy is she an ace name-dropper. She can’t talk about a given tech thing without immediately grafting in a discussion about a chain of other tech things, all mulched together, acronyms stuck into adverbs, URLs tucked all over.

From her blog entry On the Future of the Fox:

I ask myself, for example, if I wanted to build my own HacketyHack, how many hoops would I have to jump through to get it working on a MozPad moon versus an Adobe Apollo or a MSFT Expression Blend?

I really don’t know if H-ety H could be done in Apollo or .NET. Because I’ve got to be cross-platform and yet insert Ruby in there and how ya gonna do it? I know I know, there are other Ruby implementations in the works. But we’re talking today. You can’t listen to promises when today is today. I had thought about using JRuby along with XULRunner’s Java hooks, but it didn’t work for me. I’m probably just more comfortable with Matz’ Ruby.

One misconception about Hackety Hack is that it has a web server built-in. That it uses Mongrel. No way, man. Yes, Camping is used, but only to deserialize sessions coming out of Moz.

Alls it is: a hack:// protocol is set up in Moz. Any request to that protocol is sent to Camping like so:


  nsCAutoString rpath, path, qs, code, spec, host;
  aURI->GetSpec(spec);
  aURI->GetHost(host);
  aURI->GetPath(rpath);

  path = rpath;
  PRInt32 f = path.FindCharInSet(NS_LITERAL_CSTRING("#?"));
  if (f != kNotFound) {
    qs = path;
    qs.Cut(0, f+1);
    path.Truncate(f);
  }

  VALUE str = Qnil;      
  code = "begin; Camping.run(StringIO.new, {:SCRIPT_NAME, '/', " +
    ":PATH_INFO, %q<" + path.get() + ">," +
    ":QUERY_STRING, %q<" + qs.get() + ">," + 
    ":REQUEST_URI, %q<" + spec.get() + ">," +
    ":REQUEST_APP, %q<" + host.get() + ">," +
    ":REQUEST_PATH, %q<" + rpath.get() + ">}).body.to_s;" +
    "rescue Object => e; e.to_s; end";
  rubyTimer->Eval(code.get(), &str);

So sorry Mongrel. That was too easy. I really like the foundation of Hackety Hack, though it would be nice to have JavaScript cut out of the equation. Which I suppose could be done with XPCOM. (Frown.)

And here’s the lovely part from lwu:

We need not fully address the question of End-user Programming of the client-side web, but even if we deCOMtaminate Mozilla-land, how much better off does that leave us? I would call for, instead, a RESTfully organic Firefox.

Yes. Oh, yes. Madly now, say it with me: yes!

3 comments

lwu

said on June 7th 21:28

(As an aside, it seems that FF hack://ery is how those GOOG’ers such as Chief Monkey Aaron Boodman implemented the “LocalServer” in Google Gears.)

Yes! :)

HankZ

said on June 8th 01:07

QuicRedFox

said on June 8th 21:16

RESTfully organic firefox? Where…where?

Comments are closed for this entry.