B2g merge - WIP 95% done

NOT READY BUT NEEDS COMMENTS SUCKA!!!

      remaining conflicts:
        lib/db/mysql.js
        resources/static/common/js/user.js
        resources/static/include_js/_jschannel.js
        resources/static/test/mocks/xhr.js

Please take a look at those files and suggest how to resolve :-)