1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #include "FuzzingFunctions.h" 8 9 #include "nsJSEnvironment.h" 10 #include "js/GCAPI.h" 11 #include "mozilla/ErrorResult.h" 12 #include "nsIAccessibilityService.h" 13 #include "xpcAccessibilityService.h" 14 15 namespace mozilla { 16 namespace dom { 17 GarbageCollect(const GlobalObject &)18/* static */ void FuzzingFunctions::GarbageCollect(const GlobalObject&) { 19 nsJSContext::GarbageCollectNow(JS::gcreason::COMPONENT_UTILS, 20 nsJSContext::NonIncrementalGC, 21 nsJSContext::NonShrinkingGC); 22 } 23 CycleCollect(const GlobalObject &)24/* static */ void FuzzingFunctions::CycleCollect(const GlobalObject&) { 25 nsJSContext::CycleCollectNow(); 26 } 27 EnableAccessibility(const GlobalObject &,ErrorResult & aRv)28/* static */ void FuzzingFunctions::EnableAccessibility(const GlobalObject&, 29 ErrorResult& aRv) { 30 RefPtr<nsIAccessibilityService> a11y; 31 nsresult rv; 32 33 rv = NS_GetAccessibilityService(getter_AddRefs(a11y)); 34 if (NS_FAILED(rv)) { 35 aRv.Throw(rv); 36 } 37 } 38 39 } // namespace dom 40 } // namespace mozilla 41