October 30, 2009

Override default firefox behavior from an extension

Filed under: programming — Tags: — alexezh @ 8:27 pm

There are number of ways to replace the default behavior for the firefox. If you want to replace a method on the object, following code will do the trick

eval("object.method =" + object[method].toString().replace('{', '{ your code here ;'));

In case if code is event handler for XUL object, you have to create a handler with the same event and return false to prevent further processing

  <binding id="my-id"
      <handler event="event to override">
        your code here;

        return false;

New home

Filed under: Uncategorized — alexezh @ 7:11 pm

New home for notes.

October 4, 2009

convert jscript to html

Filed under: Uncategorized — alexezh @ 9:12 pm

Very simple yet good jscript to html code formatting tool

disable venkman output to console

Filed under: Uncategorized — alexezh @ 6:41 pm

Venkman produces a lot of output to console which makes it hard to see the output from your extensions. To disable output from venkman, you can update venkman_utils.js in venkman.jar by replacing dd function with an empty function dd = function (){};

debug output from firefox extension

Filed under: Uncategorized — alexezh @ 5:47 pm

Start firefox with -console flag

Call dumpln function from your code (copy of code from venkman)

var dumpln;

if (typeof document == "undefined") /* in xpcshell */
dumpln = print;
if (typeof dump == "function") {
dumpln = function (str) {dump (str + "\n");}
} else if (jsenv.HAS_RHINO) {
dumpln = function (str) {
var out = java.lang.System.out;
out.println(str); out.flush();
else {
dumpln = function () {} /* no suitable function */

Blog at WordPress.com.