This is accomplished by having a global variable have access to the mode_line
update function, and having that global invoked upon change. I made some
attempt to do this by using:
global_update_mode_line_for_javascript =
function () { watch_pref("javascript.enabled", obj.do_update);};
However, I couldn't figure out where to call that so that it always worked at
the right moment. This solution is probably simpler in the end.