Closed Bug 337656 Opened 19 years ago Closed 18 years ago

navigate methods of nsIAccessNode throws exception

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: surkov, Assigned: surkov)

References

Details

(Keywords: access)

Attachments

(2 files)

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.
Attached file testcase (deleted) —
Blocks: keya11y
Keywords: access
Similar to bug 347019. The a11y module uses error codes wrong. Alexander, would you like to take these?
Assignee: aaronleventhal → surkov.alexander
Attached patch patch (deleted) — Splinter Review
Attachment #253609 - Flags: review?(aaronleventhal)
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
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+
(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?
(In reply to comment #5) > Is it better to do it inside MakeAccessNode method? > Aaron, what about this?
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.
Status: ASSIGNED → RESOLVED
Closed: 18 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: