From ff2729cb15ccbbaecf07dc040466ffbdb655939f Mon Sep 17 00:00:00 2001 From: Jesse Schwartzentruber Date: Thu, 16 Nov 2017 16:42:39 -0500 Subject: [PATCH] Bug 1348028 - Implement fuzzPriv.enableAccessibility() in FuzzingFunctions r=smaug,surkov This enables accessibility until the next GC, which is also how fuzzPriv worked. --- dom/base/FuzzingFunctions.cpp | 15 +++++++++++++++ dom/base/FuzzingFunctions.h | 3 +++ dom/webidl/FuzzingFunctions.webidl | 6 ++++++ 3 files changed, 24 insertions(+) diff --git a/dom/base/FuzzingFunctions.cpp b/dom/base/FuzzingFunctions.cpp index 08d408a3d0c4..15ba1339e545 100644 --- a/dom/base/FuzzingFunctions.cpp +++ b/dom/base/FuzzingFunctions.cpp @@ -8,6 +8,8 @@ #include "nsJSEnvironment.h" #include "js/GCAPI.h" +#include "nsIAccessibilityService.h" +#include "xpcAccessibilityService.h" namespace mozilla { namespace dom { @@ -26,5 +28,18 @@ FuzzingFunctions::CycleCollect(const GlobalObject&) nsJSContext::CycleCollectNow(); } +/* static */ void +FuzzingFunctions::EnableAccessibility(const GlobalObject&, + ErrorResult& aRv) +{ + RefPtr a11y; + nsresult rv; + + rv = NS_GetAccessibilityService(getter_AddRefs(a11y)); + if (NS_FAILED(rv)) { + aRv.Throw(rv); + } +} + } // namespace dom } // namespace mozilla diff --git a/dom/base/FuzzingFunctions.h b/dom/base/FuzzingFunctions.h index 98799012f1f2..93aad43befb7 100644 --- a/dom/base/FuzzingFunctions.h +++ b/dom/base/FuzzingFunctions.h @@ -20,6 +20,9 @@ public: static void CycleCollect(const GlobalObject&); + + static void + EnableAccessibility(const GlobalObject&, ErrorResult& aRv); }; } // namespace dom diff --git a/dom/webidl/FuzzingFunctions.webidl b/dom/webidl/FuzzingFunctions.webidl index b8f362c86db0..268db55436a2 100644 --- a/dom/webidl/FuzzingFunctions.webidl +++ b/dom/webidl/FuzzingFunctions.webidl @@ -21,4 +21,10 @@ interface FuzzingFunctions { * Synchronously perform a cycle collection. */ static void cycleCollect(); + + /** + * Enable accessibility. + */ + [Throws] + static void enableAccessibility(); };