Closed Bug 476209 Opened 15 years ago Closed 15 years ago

refactor test_nsIAccessibleDocument.html

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: davidb, Assigned: davidb)

References

Details

Attachments

(1 file, 4 obsolete files)

Might as well use our newish testStates function.
Attachment #359824 - Flags: review?(marco.zehe) → review-
Comment on attachment 359824 [details] [diff] [review]
imports some common scripts, uses nice testStates function

>     var gAccRetrieval = null;
> 
>     function doTest()
>     {
>       gAccRetrieval = Components.classes["@mozilla.org/accessibleRetrieval;1"].
>                       getService(nsIAccessibleRetrieval);
 
All of this is in common.js and is done on load. No need to do it here, in fact it may even mess things up. To retrieve the accessible, simply use the getAccessible(document) function call.

>+        testStates(docAcc, STATE_READONLY);
>+        testStates(docAcc, STATE_FOCUSABLE)

No need to call testStates twice here, just write:
testStates(docAcc, (STATE_READONLY | STATE_FOCUSABLE));
Attached patch addresses Marco's comments (obsolete) — Splinter Review
Marco, nice catches, I might as well do more cleanup while I'm here.
Attachment #359824 - Attachment is obsolete: true
Attachment #359913 - Flags: review?(marco.zehe)
Attachment #359913 - Flags: review?(marco.zehe) → review+
Comment on attachment 359913 [details] [diff] [review]
addresses Marco's comments

>       // Get accessible for body tag.
>
>       var docAcc = null;
>
>       try {
>
>         docAcc = gAccRetrieval.getAccessibleFor(document).
>
>                  QueryInterface(nsIAccessibleDocument);
>
>       } catch(e) {}
>
>       ok(docAcc, "No accessible with interface for document!");
>
> 

Nit: Use the getAccessible function from common.js instead, and pass in the document element and wanted interfaces as the param. it will do all failure handling for you. Then continue with the if block as you already do.

r=me with that fixed.
Attached patch patch to push (obsolete) — Splinter Review
Thanks Marco. I use the getAccessible convenience here.
Attached patch better (thanks Marco) (obsolete) — Splinter Review
Attachment #360077 - Attachment is obsolete: true
Attached patch Patch to pushSplinter Review
Final tweak. Marco, good to push?
Attachment #359913 - Attachment is obsolete: true
Attachment #360079 - Attachment is obsolete: true
Attachment #360109 - Flags: review?(marco.zehe)
Attachment #360109 - Flags: review?(marco.zehe) → review+
Comment on attachment 360109 [details] [diff] [review]
Patch to push

>+      var docAcc = getAccessible(document, [nsIAccessibleDocument])

Missing ; at the end. I'll add that and push.
Pushed on Davidb's behalf in changeset:
http://hg.mozilla.org/mozilla-central/rev/764a7cdc905b
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 3.2a1
David, please file similar bugs to Core->Disability Access API (because the component you choosed is for pure Firefox a11y related bugs).
Assignee: david.bolter → nobody
Component: Disability Access → Disability Access APIs
Product: Firefox → Core
QA Contact: disability.access → accessibility-apis
Target Milestone: Firefox 3.2a1 → ---
Target Milestone: --- → mozilla1.9.2a1
Assignee: nobody → david.bolter
Version: unspecified → Trunk
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: