echofox-team / echofon-firefox-unofficial

Echofon Unofficial - maintained version of Echofon: full featured, super clean Twitter app for Firefox.
http://echofox-team.github.io/echofon-firefox-unofficial/
70 stars 10 forks source link

Grey/Blank input after adding a new Account #51

Closed EchofonBugCrow closed 8 years ago

EchofonBugCrow commented 8 years ago

Affected OS:

MacOSX Windows 7 Fedora 23 Workstation

Firefox Version:

45.0.1

After adding a new account, the client seems completely empty. It retrieves the correct user avatar, and the signing up/oauth hook up with twitter all seems to work, but no tweets are being retrieved. Swapping between accounts while the window is open shows that the account is not 'selected' in the usual manner

Previously added accounts are unaffected, and load as normal.

Screenshot in Windows 7

When opened in window

When a 'working' account is opened

Additional: Downloaded and recompiled source code, compared to the version in the latest release. No difference.

YoruNoHikage commented 8 years ago

I encountered this bug, but didn't had that much time to look at it. If anyone has a clue, I'm interested. :)

modem commented 8 years ago

I have 2 accounts configured in echofox, 1 of them works, the other does not. While trying to understand why I have this behavior, I've noticed that the setting: extensions.twitternotifier.activeUserId get's a negative number when the not working account is selected. When I try to insert my account number there I get an error saying that the inserted value is not a number, so I guess the issue is because the account number exceeds the maximum possible value for a number.

Any ideas on how to workaround this?

EchofonBugCrow commented 8 years ago

Hmmm, this seems to be the issue. Digging around in the code I found the below.

Echofon function, components/nsEchofon.js, line 30 has this line:

this._pref = Cc['@mozilla.org/preferences-service;1'].getService(Ci.nsIPrefService).getBranch("extensions.twitternotifier.");

This seems to fetch the default preferences, of which activeUserId is one and is defaulted to Integer type.

The account that is breaking, after firing a couple of alerts, is trying to fetch userID > 4000000000 (4 billion), but then converting it to a 600000000 (600 million) number.

There seems to be an undocumented limit to Firefox's Integer preference type (if there is documentation, I can't find it Ignore that, I'm dumb, it's the max value for a signed integer in 32 bit) of 2147483647. UserID's above this (which can be matched with the sync preference as well as the oAuth data) seem to be being recalculated to an 'acceptable' number.

My suggestion would be to use a float and save this as a String preference type, however, this does depend on the core service (where we get the preferences from) being modified to pass through String instead of integer.

Alternatively, have a calculation to take an invalid userId, pass it through an algorithm to convert it to a valid one, and use the valid userID. However, that would result in potentially reusing existing users userId

modem commented 8 years ago

Hi guys,

when do you plan to release these fixes as a signed addon?

Best regards!

YoruNoHikage commented 8 years ago

Yeah, I hope we can do it in the next few days... A user has reported me that it doesn't work anymore on FF48.0.2, I need to check a few things before. Sorry. ;/