Firefox google demo

This looks almost identical to some of the code in demo_common/ux.js, except here uses self.port.on instead of window.freedom.on.  Is there any way to refactor this so we share the same JS for display on both firefox and chrome?  Would it make sense to set window.freedom.on=self.port.on in firefox?