Closed
Bug 110422
Opened 23 years ago
Closed 23 years ago
Active Accessibility: Optimize nsIAccessibleProvider implementations in XBL
Categories
(SeaMonkey :: General, defect, P4)
Tracking
(Not tracked)
RESOLVED
FIXED
mozilla0.9.8
People
(Reporter: aaronlev, Assigned: mozilla)
Details
(Keywords: access)
Attachments
(1 file, 2 obsolete files)
18.14 KB,
patch
|
rginda
:
review+
jag+mozilla
:
superreview+
|
Details | Diff | Splinter Review |
Jag has suggested some javascript improvements for the same lines of code we repeated in many XBL bindings: var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService); return (accService? accService.createXULTextAccessible(this): null); Quoted from Jag: There is no need to check whether accService is null. If anything fails, an exception will be thrown and you'll never reach that line, so: var accService = Components.classes["@mozilla.org/accessibilityService;1"].getService(Components.interfaces.nsIAccessibilityService); return accService.createXULTextAccessible(this); This is assuming that in normal situations the getService won't fail. If there's a chance this service isn't included while these xul widgets are, you'll need to do something like: const ACCESSIBILITYSERVICE_CONTRACTID = "@mozilla.org/accessibilityService;1"; if (ACCESSIBILITYSERVICE_CONTRACTID in Components.classes) { var accService = Components.classes[(ACCESSIBILITYSERVICE_CONTRACTID].getService(Components.interfaces.nsIAccessibilityService); return accService.createXULTextAccessible(this); } return null; =================== Brendan, what do you think?
Reporter | ||
Updated•23 years ago
|
Priority: -- → P4
Target Milestone: --- → Future
Reporter | ||
Comment 1•23 years ago
|
||
Brendan, do you have any comments on the javascript recommended here?
Comment 2•23 years ago
|
||
Sure, jag has good JS fu. I don't need to bless his advice, in general. Yes, use const. Use the in operator when you need to (and not otherwise!). And let exceptions get thrown. /be
Reporter | ||
Comment 3•23 years ago
|
||
-> John
Assignee: aaronl → jgaunt
Whiteboard: Waiting for Brendan's feedback
Assignee | ||
Comment 4•23 years ago
|
||
building right now to test these.
Assignee | ||
Comment 5•23 years ago
|
||
Hmmm...finally got a build completed and testing this approach. It totally breaks venkman because it doesn't call through the MSAA api, but just enumerates all the JS properties. So there is no service and kerplunk, kerpluey. I'll be going with door #2 then, and will be posting a patch shortly. btw - I think I see a significant increase in the speed of gettin accessible objects with this fix right now, unfortunatly I think door # 2 is going to slow us back down.
Status: NEW → ASSIGNED
Target Milestone: Future → mozilla0.9.8
Assignee | ||
Comment 6•23 years ago
|
||
doesn't cause venkman fits ( Yay! ) but I don't think it's really a performance win. trading one comparison for an additional variable and a comparison. Is the old way really that bad?
Attachment #64350 -
Attachment is obsolete: true
Comment 7•23 years ago
|
||
Comment on attachment 64425 [details] [diff] [review] patch using door #2, r=rginda
Attachment #64425 -
Flags: review+
Comment 8•23 years ago
|
||
As jag mentioned, the old way had a useless test. If your service wasn't there, you never would have reached the ?: test. I'm not sure why the exception caused a problem for venkman though. Is the code that calls into this XBL not dealing with the exception properly?
Comment 9•23 years ago
|
||
Comment on attachment 64425 [details] [diff] [review] patch using door #2, revoking r= per discussion with jgaunt
Attachment #64425 -
Flags: review+
Assignee | ||
Comment 10•23 years ago
|
||
After some closer investigation spurred on by rginda, it turns out I was wrong. It was causing venkman problems. So we get the perf win. Yay! Also taking out a WARN_IF_FALSE that pops up and replacing with a regular if statement.
Attachment #64425 -
Attachment is obsolete: true
Comment 11•23 years ago
|
||
Comment on attachment 64437 [details] [diff] [review] My bad, back to the original diff sr=jag
Attachment #64437 -
Flags: superreview+
Comment 12•23 years ago
|
||
Though I'm surprised you're seeing a significant increase, you're only removing one ?: statement.
Comment 13•23 years ago
|
||
Comment on attachment 64437 [details] [diff] [review] My bad, back to the original diff r=rginda
Attachment #64437 -
Flags: review+
Assignee | ||
Comment 14•23 years ago
|
||
checked in to the trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Updated•20 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•