1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 sw=2 et 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 #ifndef nsIScriptTimeoutHandler_h___
7 #define nsIScriptTimeoutHandler_h___
10 #include "js/TypeDecls.h"
16 } // namespace mozilla
18 #define NS_ISCRIPTTIMEOUTHANDLER_IID \
19 { 0x53c8e80e, 0xcc78, 0x48bc, \
20 { 0xba, 0x63, 0x0c, 0xb9, 0xdb, 0xf7, 0x06, 0x34 } }
23 * Abstraction of the script objects etc required to do timeouts in a
24 * language agnostic way.
27 class nsIScriptTimeoutHandler
: public nsISupports
30 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTTIMEOUTHANDLER_IID
)
32 // Get the Function to call. If this returns nullptr, GetHandlerText() will
33 // be called to get the string.
34 virtual mozilla::dom::Function
*GetCallback() = 0;
36 // Get the handler text of not a compiled object.
37 virtual const char16_t
*GetHandlerText() = 0;
39 // Get the location of the script.
40 // Note: The memory pointed to by aFileName is owned by the
41 // nsIScriptTimeoutHandler and should not be freed by the caller.
42 virtual void GetLocation(const char **aFileName
, uint32_t *aLineNo
) = 0;
44 // If we have a Function, get the arguments for passing to it.
45 virtual const nsTArray
<JS::Value
>& GetArgs() = 0;
48 NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptTimeoutHandler
,
49 NS_ISCRIPTTIMEOUTHANDLER_IID
)
51 #endif // nsIScriptTimeoutHandler_h___