freedomjs / freedom-social-firebase

Firebase Social Provider
0 stars 0 forks source link

Soycode firefoxaddon #5

Closed agallant closed 9 years ago

agallant commented 9 years ago

This doesn't work yet, but I'm creating the pull request for discussion/feedback. The crux of it is: https://github.com/freedomjs/freedom-social-firebase/commit/56b38dda551dfcf20dfe0334ae0c681d3735e528#diff-c803e4398a9986a7260b55b46c215b2eR27

So far this shim creates a global WebSocket object that Firebase can construct, send, and close as expected. The problem is listening - Firebase sets listeners by just adding .onopen, .onclose, ... functions to the object. In lines 35-8 I'm trying to forward the dispatches received by the actual freedomjs websocket object to these properties that Firebase sets, but these properties never end up being defined for those forwards.

Relevant section of firebase code: https://github.com/firebase/firebase-bower/blob/master/firebase-debug.js#L6539

I've tried a number of variations without success, what I've checked in is closest to what I'd like to work. Thoughts welcome, else I'll revisit periodically with a fresh mind.

agallant commented 9 years ago

Thanks! That made a good bit of progress (https://github.com/freedomjs/freedom-social-firebase/commit/58cba92f56522d799e66d0b4914893ee0770e6b1). At this point I can see that it's successfully receiving messages, but it still seems to get held up a bit before successful login (silent failure). I'll work on pinpointing the error and updating as appropriate, but I think it's pretty close now.

agallant commented 9 years ago

And Firefox now works as of https://github.com/freedomjs/freedom-social-firebase/commit/f287785409002e94d4aaafec297d366a3037736b - in addition to onMessage field name shimming, the send method needed a field name tweak. But now the webapp works in Firefox - the Firefox addon doesn't work yet but I think that's more making ux.js work in an addon than making Firebase work in Firefox.

So, I'd say this pull request is mostly ready now, if you want to take a critical look. I'll likely add one more addon-specific commit in the near future, but I'm calling the shim part "done." Thanks!

dborkan commented 9 years ago

Awesome, thanks for working on this! :+1:

agallant commented 9 years ago

Sure, thanks for taking a look. I also just figured out how to make the addon work, though I don't really like the approach. Basically I noticed that the Firefox addon demo at https://github.com/freedomjs/freedom-social-xmpp/tree/master/src/demo_firefox_google was more strongly based on the webapp setup, so I switched the addon for this repo to that and it now works as well.

So in summary, webapp in FF/Chrome, Chrome extension, and FF addon all at least get as far as logging in and pulling buddies. Will doublecheck once more with you before merging.