Closed Bug 1722712 Opened 4 years ago Closed 4 years ago

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)

Thunderbird 91
x86
Windows 7
defect

Tracking

(thunderbird_esr78 unaffected, thunderbird91 fixed)

RESOLVED FIXED
92 Branch
Tracking Status
thunderbird_esr78 --- unaffected
thunderbird91 --- fixed

People

(Reporter: cmgaudry33, Assigned: rnons)

References

Details

Attachments

(2 files)

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.

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;
}

This patch can be applied to Thunderbird 91.0b4.

  • Keep the original case of attribute names in getAttributes
  • Ignore the case of attribute name in getValues and getBinaryValues
Assignee: nobody → remotenonsense
Status: NEW → ASSIGNED

Good catch, thanks.

Target Milestone: --- → 92 Branch

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

Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED

Please request uplift to TB 91 beta.

Flags: needinfo?(remotenonsense)
Flags: needinfo?(chris.m.gaudry)

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

Flags: needinfo?(remotenonsense)
Flags: needinfo?(chris.m.gaudry)
Attachment #9233641 - Flags: approval-comm-beta?

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

Attachment #9233641 - Flags: approval-comm-beta? → approval-comm-beta+

That's OK !

Thank you.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: