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 #ifndef mozilla_dom_WorkerTestUtils__
8 #define mozilla_dom_WorkerTestUtils__
9 
10 namespace mozilla {
11 
12 class ErrorResult;
13 
14 namespace dom {
15 
16 /**
17  * dom/webidl/WorkerTestUtils.webidl defines APIs to expose worker's internal
18  * status for glass-box testing. The APIs are only exposed to Workers with prefs
19  * dom.workers.testing.enabled.
20  *
21  * WorkerTestUtils is the implementation of dom/webidl/WorkerTestUtils.webidl
22  */
23 class WorkerTestUtils final {
24  public:
25   /**
26    *  Expose the worker's current timer nesting level.
27    *
28    *  The worker's current timer nesting level means the executing timer
29    *  handler's timer nesting level. When there is no executing timer handler, 0
30    *  should be returned by this API. The maximum timer nesting level is 5.
31    *
32    *  https://html.spec.whatwg.org/#timer-initialisation-steps
33    */
34   static uint32_t CurrentTimerNestingLevel(const GlobalObject&,
35                                            ErrorResult& aErr);
36 };
37 
38 }  // namespace dom
39 }  // namespace mozilla
40 #endif
41