navigate methods of nsIAccessNode throws exception

RESOLVED FIXED

Status

()

Core
Disability Access APIs
RESOLVED FIXED
12 years ago
11 years ago

People

(Reporter: surkov, Assigned: surkov)

Tracking

({access})

Trunk
access
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

757 bytes, application/xhtml+xml
Details
3.34 KB, patch
Aaron Leventhal
: review+
Details | Diff | Splinter Review
(Assignee)

Description

12 years ago
When DOM node of nsIAccessNode object hans't children/siblings/parent then corresponding method of nsIAccessNode throws exception. F.x.
For <input type="text"/> accInput.firstChildNode throws exception since <input/> hasn't any child. Probably the behavious is used somewhere but on the first sight it confuse. I guess more appropriate behaviour is navigate methods will return null instead exception throwing.
(Assignee)

Comment 1

12 years ago
Created attachment 221777 [details]
testcase

Updated

12 years ago
Blocks: 342901

Updated

12 years ago
Keywords: access

Comment 2

11 years ago
Similar to bug 347019. The a11y module uses error codes wrong.

Alexander, would you like to take these?
Assignee: aaronleventhal → surkov.alexander
(Assignee)

Comment 3

11 years ago
Created attachment 253609 [details] [diff] [review]
patch
Attachment #253609 - Flags: review?(aaronleventhal)
(Assignee)

Updated

11 years ago
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true

Comment 4

11 years ago
Comment on attachment 253609 [details] [diff] [review]
patch

r+ if you add the line:
*aAccessNode = nsnull; at the top of each of these methods.

Need to clear it out, otherwise this code will crash:
nsIAccessNode *myNode;
if (NS_SUCCEEDED(origNode->GetFirstChildNode(&myNode))) {
  myNode->Foo();
}
Attachment #253609 - Flags: review?(aaronleventhal) → review+
(Assignee)

Comment 5

11 years ago
(In reply to comment #4)
> (From update of attachment 253609 [details] [diff] [review])
> r+ if you add the line:
> *aAccessNode = nsnull; at the top of each of these methods.
> 
> Need to clear it out, otherwise this code will crash:
> nsIAccessNode *myNode;
> if (NS_SUCCEEDED(origNode->GetFirstChildNode(&myNode))) {
>   myNode->Foo();
> }
> 

Is it better to do it inside MakeAccessNode method?
(Assignee)

Comment 6

11 years ago
(In reply to comment #5)

> Is it better to do it inside MakeAccessNode method?
> 

Aaron, what about this?

Comment 7

11 years ago
That would be smaller code, but I like to null out out parameters before anything else happens. Habit taught by Brendan Eich. You can't go wrong that way.

Updated

11 years ago
Status: ASSIGNED → RESOLVED
Last Resolved: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.