NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS using attribute name with uppercase as argument of getValues or getBinaryValues methods (Javascript implementation)
Categories
(MailNews Core :: LDAP Integration, defect)
Tracking
(thunderbird_esr78 unaffected, thunderbird91 fixed)
| Tracking | Status | |
|---|---|---|
| thunderbird_esr78 | --- | unaffected |
| thunderbird91 | --- | fixed |
People
(Reporter: cmgaudry33, Assigned: rnons)
References
Details
Attachments
(2 files)
|
1.61 KB,
patch
|
Details | Diff | Splinter Review | |
|
48 bytes,
text/x-phabricator-request
|
wsmwk
:
approval-comm-beta+
|
Details | Review |
Hi,
The getBinaryValues is working now in Thunderbird 91.0b4, but getValues has been broken with the exception :
[JavaScript Error: "undefined has no properties" {file: "resource:///modules/LDAPOperation.jsm" line: 84}] when calling method: [nsILDAPMessage::getValues]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"
[JavaScript Error: "res.result.attributes[attr] is undefined" {file: "resource:///modules/LDAPOperation.jsm" line: 84}] when calling method: [nsILDAPMessage::getValues]" nsresult: "0x80570021 (NS_ERROR_XPC_JAVASCRIPT_ERROR_WITH_DETAILS)"
To avoid these exceptions, I need to use lowercase for the argument of the nsILDAPMessage :: getValues method. When "jsmodule" is disabled, this method does not care about the case.
I see you added a lowercase comment in the SearchResult :: parse method. Is that what everyone should be doing like this now?
Why not correct the lowercase letters at the start of the nsILDAPMessage :: getValues method, before getting the attribute value of the res.result.attributes object? Maybe you should do the same in the nsILDAPMessage :: getBinaryValues method. Thus, all consumer code could use C ++ and Javascript implementations without changing anything when the configuration changes.
| Reporter | ||
Comment 1•4 years ago
•
|
||
In addition, if the attribute sought is not present in the result, an error appears in the console:
TypeError: res.result.attributes [attr] is undefined [LDAPOperation.jsm: 84]
Why doesn't the nsILDAPMessage::getValues method just return null, like the C ++ implementation?
Isn't it the same problem for the nsILDAPMessage::getBinaryValues method?
method(attr) {
let values = res.result.attribute[attr.toLowerCase()];
if (values) {
return values.map(...);
}
return null;
}
| Reporter | ||
Comment 2•4 years ago
|
||
This patch can be applied to Thunderbird 91.0b4.
| Assignee | ||
Comment 3•4 years ago
|
||
- Keep the original case of attribute names in getAttributes
- Ignore the case of attribute name in getValues and getBinaryValues
Updated•4 years ago
|
| Assignee | ||
Comment 4•4 years ago
|
||
Good catch, thanks.
| Assignee | ||
Updated•4 years ago
|
Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/18215c2f9977
Make getValues/getBinaryValues case insenstive to attribute name in LDAPOperation.jsm r=darktrojan
Comment 6•4 years ago
|
||
Please request uplift to TB 91 beta.
| Assignee | ||
Comment 7•4 years ago
|
||
Comment on attachment 9233641 [details]
Bug 1722712 - Make getValues/getBinaryValues case insenstive to attribute name in LDAPOperation.jsm r=darktrojan
[Approval Request Comment]
Regression caused by (bug #): bug 1696625
User impact if declined: no impact to normal user, but the behavior of getValues/getBinaryValues was different from the C++ ldap code.
Testing completed (on c-c, etc.): c-c
Risk to taking this patch (and alternatives if risky): Low
Comment 8•4 years ago
|
||
Comment on attachment 9233641 [details]
Bug 1722712 - Make getValues/getBinaryValues case insenstive to attribute name in LDAPOperation.jsm r=darktrojan
[Triage Comment]
Approved for beta
Comment 9•4 years ago
•
|
||
| bugherder uplift | ||
Thunderbird 91.0b6:
https://hg.mozilla.org/releases/comm-beta/rev/bf17d8d879c4
| Reporter | ||
Comment 10•4 years ago
|
||
That's OK !
Thank you.
Description
•