Bug 1348028 - Implement fuzzPriv.enableAccessibility() in FuzzingFunctions r=smaug,surkov

This enables accessibility until the next GC, which is also how fuzzPriv worked.
This commit is contained in:
Jesse Schwartzentruber 2017-11-16 16:42:39 -05:00
parent 8b9701dd72
commit ff2729cb15
3 changed files with 24 additions and 0 deletions

View File

@ -8,6 +8,8 @@
#include "nsJSEnvironment.h" #include "nsJSEnvironment.h"
#include "js/GCAPI.h" #include "js/GCAPI.h"
#include "nsIAccessibilityService.h"
#include "xpcAccessibilityService.h"
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {
@ -26,5 +28,18 @@ FuzzingFunctions::CycleCollect(const GlobalObject&)
nsJSContext::CycleCollectNow(); nsJSContext::CycleCollectNow();
} }
/* static */ void
FuzzingFunctions::EnableAccessibility(const GlobalObject&,
ErrorResult& aRv)
{
RefPtr<nsIAccessibilityService> a11y;
nsresult rv;
rv = NS_GetAccessibilityService(getter_AddRefs(a11y));
if (NS_FAILED(rv)) {
aRv.Throw(rv);
}
}
} // namespace dom } // namespace dom
} // namespace mozilla } // namespace mozilla

View File

@ -20,6 +20,9 @@ public:
static void static void
CycleCollect(const GlobalObject&); CycleCollect(const GlobalObject&);
static void
EnableAccessibility(const GlobalObject&, ErrorResult& aRv);
}; };
} // namespace dom } // namespace dom

View File

@ -21,4 +21,10 @@ interface FuzzingFunctions {
* Synchronously perform a cycle collection. * Synchronously perform a cycle collection.
*/ */
static void cycleCollect(); static void cycleCollect();
/**
* Enable accessibility.
*/
[Throws]
static void enableAccessibility();
}; };