Closed Bug 1348028 Opened 7 years ago Closed 7 years ago

Implement fuzzPriv.enableAccessibility() in FuzzingFunctions

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: mccr8, Assigned: truber)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 obsolete file)

      No description provided.
Priority: -- → P3
Attached patch bug1238028.patch (obsolete) — Splinter Review
The fuzzPriv implementation is here for reference: https://github.com/MozillaSecurity/domfuzz/blob/master/dom/extension/components/domfuzzhelperobserver.js#L116

I've verified that this flips "Accessibility / Activated: true" in about:support.
Attachment #8929633 - Flags: review?(bugs)
Assignee: nobody → jschwartzentruber
Status: NEW → ASSIGNED
Comment on attachment 8929633 [details] [diff] [review]
bug1238028.patch

+  if (rv != NS_OK) {
is not the way to check return values.
if (NS_FAILED(rv)) {
  aRv.Throw(rv);
}

r+ for the .webidl, but I'd prefer if surkov said whether just accessing the service is enough.
Attachment #8929633 - Flags: review?(surkov.alexander)
Attachment #8929633 - Flags: review?(bugs)
Attachment #8929633 - Flags: review+
Comment on attachment 8929633 [details] [diff] [review]
bug1238028.patch

Review of attachment 8929633 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/base/FuzzingFunctions.cpp
@@ +34,5 @@
> +{
> +  RefPtr<nsIAccessibilityService> a11y;
> +  nsresult rv;
> +
> +  rv = NS_GetAccessibilityService(getter_AddRefs(a11y));

It probably won't last long. I suppose the a11y will get shutdown as soon as all a11y objects, you requested after, are garbage collected, so that's probably the way for intermittent failures if you don't have a global variable to keep a11y alive.
Attachment #8929633 - Flags: review?(surkov.alexander) → review+
cc'ing Yura as he's author of most of the a11y shutdown code.
Flags: needinfo?(yzenevich)
Yes, if accessibility is enabled like that, it will be disabled after garbage collection if there are no references to the accessibility service or accessible objects that it creates. The consequences depend on when/if you force garbage collection, if that happens between tests and if accessibility is intended to persist between tests.
Flags: needinfo?(yzenevich)
Thanks! I talked to eeejay and yzen about optionally keeping a global reference to the service, and about force-disabling accessibility in the future.

For now I'm matching the old behaviour since it has found bugs and we can set `GNOME_ACCESSIBILITY=1` for enabling it persistently while fuzzing on Linux. We typically force garbage collection before closing the test tab, each fuzzed testcase gets a new tab, and we're randomly forcing garbage collection during the test too.
(In reply to Jesse Schwartzentruber (:truber) from comment #6)
> Thanks! I talked to eeejay and yzen about optionally keeping a global
> reference to the service, and about force-disabling accessibility in the
> future.

It probably make sense then to return an a11y service object from enableAccessibility(), so the script may control a life cycle of a11y.

Another option, if you want to keep a11y on as long as you want, then you could add a new a11y consumer nsAccessibilityService::ServiceConsumer, for example, eFuzz and then do GetOrCreateAccessible(aFuzz). You'd have release it though when you don't longer need it.
Update to use NS_FAILED.
Attachment #8929633 - Attachment is obsolete: true
(In reply to alexander :surkov from comment #7)
> It probably make sense then to return an a11y service object from
> enableAccessibility(), so the script may control a life cycle of a11y.

Yeah, this sounds like an easy way of controlling lifetime from within the script.

For now, enabling temporarily until GC will behave like the XUL add-on this is replacing.
Keywords: checkin-needed
Comment on attachment 8930168 [details] [diff] [review]
bug1238028v2.patch

Carrying r+ from previous with Comment 2 updated.
Attachment #8930168 - Flags: review+
Pushed by rgurzau@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/efdeb2172fe4
Implement fuzzPriv.enableAccessibility() in FuzzingFunctions r=smaug,surkov
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/efdeb2172fe4
Status: ASSIGNED → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: