Bug 1673446 Comment 150 Edit History

Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.

Thanks for the comments. I've think I know why the problem occurs but I haven't found a good fix.
The problem occurs when the login is modified. For unknown reasons (to me), oauth2 signals a change in the login a lot. My guess, not being an oauth2 expert, is that a "token" changes quite often (maybe more often for yahoo). This change is signaled to all the accounts via the Observe() call, and  each account is supposed to ignore the info when it is not for that account.

The problem originates here https://searchfox.org/mozilla-central/rev/1cfd3a3bc76a8d09cb4266576f30802753a80c83/toolkit/components/passwordmgr/storage-json.sys.mjs#430 where an "array" of values is passed to the notifiyStorageChanged(), the old and new login info. I can fix the problem by just changing this so that only "newLogin" is passed and not an array. However, this is in mozilla code which TB project normally doesn't change. The problem is also in the TB specific code here, https://searchfox.org/comm-central/rev/f33739060699f381bb6e7dd74e51ee94d9829a6c/mailnews/base/src/nsMsgIncomingServer.cpp#90. The "aSubject" contains the login info and it fails to decode it because it's an array and loginInfo ends up null. This causes the server/account to not ignore the info and it goes ahead and removes it's own password incorrectly.

I tried various tricks with query interface and casting to obtain a not-null value for loginInfo but haven't been able to get it to work yet. So what needs to happen is the Observe() call in nsMsgIncomingServer.cpp needs to be able to handle aSubject when the contents is actually an array and it can just use the first array element as the loginInfo since only the hostname is relevant and that should change.

Note: the Observer() in nsMsgIncomingServer.cpp works fine when you just delete a login line in the password mgr since aSubject is just a single item and not an array.
Thanks for the comments. I've think I know why the problem occurs but I haven't found a good fix.
The problem occurs when the login is modified. For unknown reasons (to me), oauth2 signals a change in the login a lot. My guess, not being an oauth2 expert, is that a "token" changes quite often (maybe more often for yahoo). This change is signaled to all the accounts via the Observe() call, and  each account is supposed to ignore the info when it is not for that account.

The problem originates here https://searchfox.org/mozilla-central/rev/1cfd3a3bc76a8d09cb4266576f30802753a80c83/toolkit/components/passwordmgr/storage-json.sys.mjs#430 where an "array" of values is passed to the notifiyStorageChanged(), the old and new login info. I can fix the problem by just changing this so that only "newLogin" is passed and not an array. However, this is in mozilla code which TB project normally doesn't change. The problem is also in the TB specific code here, https://searchfox.org/comm-central/rev/f33739060699f381bb6e7dd74e51ee94d9829a6c/mailnews/base/src/nsMsgIncomingServer.cpp#90. The "aSubject" contains the login info and it fails to decode it because it's an array and loginInfo ends up null. This causes the server/account to not ignore the info and it goes ahead and removes it's own password incorrectly.

I tried various tricks with query interface and casting to obtain a not-null value for loginInfo but haven't been able to get it to work yet. So what needs to happen is the Observe() call in nsMsgIncomingServer.cpp needs to be able to handle aSubject when the contents is actually an array and it can just use the first array element as the loginInfo since only the hostname is relevant and that should not change.

Note: the Observer() in nsMsgIncomingServer.cpp works fine when you just delete a login line in the password mgr since aSubject is just a single item and not an array.
Thanks for the comments. I've think I know why the problem occurs but I haven't found a good fix.
The problem occurs when the login is modified. For unknown reasons (to me), oauth2 signals a change in the login a lot. My guess, not being an oauth2 expert, is that a "token" changes quite often (maybe more often for yahoo). This change is signaled to all the accounts via the Observe() call, and  each account is supposed to ignore the info when it is not for that account.

The problem originates here https://searchfox.org/mozilla-central/rev/1cfd3a3bc76a8d09cb4266576f30802753a80c83/toolkit/components/passwordmgr/storage-json.sys.mjs#430 where an "array" of values is passed to the notifiyStorageChanged(), the old and new login info. I can fix the problem by just changing this so that only "newLogin" is passed and not an array. However, this is in mozilla code which TB project normally doesn't change. The problem is also in the TB specific code here, https://searchfox.org/comm-central/rev/f33739060699f381bb6e7dd74e51ee94d9829a6c/mailnews/base/src/nsMsgIncomingServer.cpp#90. The "aSubject" contains the login info and it fails to decode it because it's an array and loginInfo ends up null. This causes the server/account to not ignore the info and it goes ahead and removes its own password incorrectly.

I tried various tricks with query interface and casting to obtain a not-null value for loginInfo but haven't been able to get it to work yet. So what needs to happen is the Observe() call in nsMsgIncomingServer.cpp needs to be able to handle aSubject when the contents is actually an array and it can just use the first array element as the loginInfo since only the hostname is relevant and that should not change.

Note: the Observe() in nsMsgIncomingServer.cpp works fine when you just delete a login line in the password mgr since aSubject is just a single item and not an array.
Thanks for the comments. I know why the problem occurs but I haven't found a good fix.
The problem occurs when the login is modified. For unknown reasons (to me), oauth2 signals a change in the login a lot. My guess, not being an oauth2 expert, is that a "token" changes quite often (maybe more often for yahoo). This change is signaled to all the accounts via the Observe() call, and  each account is supposed to ignore the info when it is not for that account.

The problem originates here https://searchfox.org/mozilla-central/rev/1cfd3a3bc76a8d09cb4266576f30802753a80c83/toolkit/components/passwordmgr/storage-json.sys.mjs#430 where an "array" of values is passed to the notifiyStorageChanged(), the old and new login info. I can fix the problem by just changing this so that only "newLogin" is passed and not an array. However, this is in mozilla code which TB project normally doesn't change. The problem is also in the TB specific code here, https://searchfox.org/comm-central/rev/f33739060699f381bb6e7dd74e51ee94d9829a6c/mailnews/base/src/nsMsgIncomingServer.cpp#90. The "aSubject" contains the login info and it fails to decode it because it's an array and loginInfo ends up null. This causes the server/account to not ignore the info and it goes ahead and removes its own password incorrectly.

I tried various tricks with query interface and casting to obtain a not-null value for loginInfo but haven't been able to get it to work yet. So what needs to happen is the Observe() call in nsMsgIncomingServer.cpp needs to be able to handle aSubject when the contents is actually an array and it can just use the first array element as the loginInfo since only the hostname is relevant and that should not change.

Note: the Observe() in nsMsgIncomingServer.cpp works fine when you just delete a login line in the password mgr since aSubject is just a single item and not an array.

Back to Bug 1673446 Comment 150