MathJax

Syntax Highlighter CSS (shCore.css)

Syntax Highlighter CSS (shThemeDefault.css)

Syntax Highlighter JS (shCore.js)

Syntax Highlighter JS (shAutoloader)

Highlight CSS (default.css)

Highlight JS (highlight.pack.js)

Syntax Highlighter CSS (custom.css)

Monday, May 10, 2010

Peeking inside Components.classes for Firefox 3.5.8

For the longest time, I had wondered what kind of magical smurfs, krakens, and leprechauns lived inside of Components.classes; but today I felt like sort of an idiot because I realized I could just do this:

echo "for(var p in Components.classes){print(p)}" | xpcshell | sort > cc.txt
echo "for(var p in Components.interfaces){print(p)}" | xpcshell | sort > ci.txt

The xpcshell function is just a little bash function I have for running XPCShell (on Debian, XULRunner binaries are located in /usr/lib/xulrunner-1.9.1; they may vary for the reader):

function xpcshell {
  local DIR=/usr/lib/xulrunner-1.9.1
  $DIR/run-mozilla.sh $DIR/xpcshell $@
}

This is a pretty good tool for testing extension code out, as long as you don't want to do anything with a ChromeWindow; it'll crash if you try to get fresh with it like that!

$ xpcshell
[loading 'xpcshell.js'...]
js> var app = Components.classes["@mozilla.org/appshell/appShellService;1"].
  getService(Components.interfaces.nsIAppShellService);
js> var uri = Components.classes["@mozilla.org/network/io-service;1"].
  getService(Components.interfaces.nsIIOService).
  newURI("http://developer.mozilla.org", null, null);
js> app.createTopLevelWindow(null, uri, 0, 0, 0, null);

(process:8032): Gdk-CRITICAL **: gdk_screen_get_rgb_visual: assertion `GDK_IS_SCREEN (screen)' failed
/usr/lib/xulrunner-1.9.1/run-mozilla.sh: line 131:  8032 Segmentation fault      "$prog" ${1+"$@"}

Sources

https://developer.mozilla.org/en/XPCOM_Interface_Reference/nsIAppShellService
https://developer.mozilla.org/En/NsIURL
Post a Comment