Log in

No account? Create an account
JSBorg - brad's life [entries|archive|friends|userinfo]
Brad Fitzpatrick

[ website | bradfitz.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

JSBorg [Nov. 14th, 2005|09:08 pm]
Brad Fitzpatrick
[Tags|, ]

Problem statement:

-- JavaScript debugging/testing blows (blows = inconvenient/slow)
-- DOM support varies so much
-- some DOM inspectors are good, some are okay, some are non-existent
-- Reloading 7 browsers with Alt-Tab, F5, Control-R, Alt-R, and moving the mouse gets tedious (even with x2vnc, Synergy, etc)


.... controlling all the browsers from one console

Basically I wrote:

-- a Perlbal plugin to implement a stupid message bus between JavaScript clients (just using HTTP)
-- a stupid JavaScript library to XmlHttpRequest GET a command and eval it
-- a stupid readline app that injects commands into the bus.

And there you go.... I now have a JavaScript shell that evaluates on all browsers in parallel now:

(Not pictured: Windows w/ Opera and IE.... you get the idea)

Next up: a JSBorg.log(...) function so I can do:

JSBorg> log = JSBorg.log;
JSBorg> log($("someStupidDiv").offsetTop)
IE 5.5: 234
Firefox 1.5: 237
Firefox 1.0.7: 234
Safari: 752
(end results)
JSBorg> log(is(DOM.someFunc(node), 54, "someFunc works"))
IE 5.5: pass
Firefox 1.5: pass
Firefox 1.0.7: pass
Safari: fail
(end results)

And basically then have automated test suites of JavaScript libraries, writing stuff on top of the injector. (or write an injector library, more likely)

And then I'm thinking a global DOM inspector that checks all the DOMs in parallel.

[User Picture]From: caladri
2005-11-15 05:44 am (UTC)
Every piece of production JS should have that, then you can evilly control all browsers arbitrarily.
(Reply) (Thread)
[User Picture]From: xaosenkosmos
2005-11-15 06:02 am (UTC)
What, OCX isn't good enough for you? It's even cross-platform: Wine runs on FreeBSD, right?
(Reply) (Parent) (Thread)
[User Picture]From: caladri
2005-11-15 05:15 pm (UTC)
It's harder, these days, to run random OCX than random JavaScript. That said, I don't really know. I know that I've never tried hooking up a browser so that it used Wine to run ActiveX controls and similar. That just sounds retarded. Though maybe a good idea since I'm trying to get some shit to work at work that requires browser plugins.
(Reply) (Parent) (Thread)
[User Picture]From: jproulx
2005-11-15 07:37 am (UTC)
(Reply) (Thread)
[User Picture]From: mart
2005-11-15 08:08 am (UTC)


(Reply) (Parent) (Thread)
[User Picture]From: robflynn
2005-11-15 08:37 am (UTC)
I think I love you ... but what am I so afraid of?
(Reply) (Thread)
[User Picture]From: djenigma
2005-11-15 01:46 pm (UTC)
you are my hero. i hope you release this at some point, i could definitely use something like this at work. (oh, if i only had to develop my stuff to be firefox-compatible.. my life would be so much easier..)
(Reply) (Thread)
[User Picture]From: perlmonger
2005-11-15 02:23 pm (UTC)
*drools unpleasantly*

that's so cool, I want it now.
(Reply) (Thread)
[User Picture]From: jarodrussell
2005-11-15 02:45 pm (UTC)
Very cool.
(Reply) (Thread)
[User Picture]From: da_lj
2005-11-15 03:35 pm (UTC)
That rocks. I hope you can put a tarball somewhere for people to play with, because I can really see this being useful.

In case this is helpful: publius_ovidius's use.perl journal has mentioned Test.Simple, a test harness for javascript.
(Reply) (Thread)
[User Picture]From: crackmonkey
2005-11-15 04:46 pm (UTC)

Where's the source?

If you want, I can walk the 5 blocks over to your offices and pick it up by hand even.

Seriously tho, this is pretty neat and I can think of a few guys at work that could use it. And if you release it, I don't have to rewrite it in python/java/lisp.
(Reply) (Thread)
[User Picture]From: brad
2005-11-15 05:27 pm (UTC)

Re: Where's the source?

I'll release it when it's a bit more polished.
(Reply) (Parent) (Thread)