1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/base/nsIScriptTimeoutHandler.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 sw=2 et tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 +#ifndef nsIScriptTimeoutHandler_h___ 1.10 +#define nsIScriptTimeoutHandler_h___ 1.11 + 1.12 +#include "nsTArray.h" 1.13 +#include "js/TypeDecls.h" 1.14 + 1.15 +namespace mozilla { 1.16 +namespace dom { 1.17 +class Function; 1.18 +} // namespace dom 1.19 +} // namespace mozilla 1.20 + 1.21 +#define NS_ISCRIPTTIMEOUTHANDLER_IID \ 1.22 +{ 0x53c8e80e, 0xcc78, 0x48bc, \ 1.23 + { 0xba, 0x63, 0x0c, 0xb9, 0xdb, 0xf7, 0x06, 0x34 } } 1.24 + 1.25 +/** 1.26 + * Abstraction of the script objects etc required to do timeouts in a 1.27 + * language agnostic way. 1.28 + */ 1.29 + 1.30 +class nsIScriptTimeoutHandler : public nsISupports 1.31 +{ 1.32 +public: 1.33 + NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTTIMEOUTHANDLER_IID) 1.34 + 1.35 + // Get the Function to call. If this returns nullptr, GetHandlerText() will 1.36 + // be called to get the string. 1.37 + virtual mozilla::dom::Function *GetCallback() = 0; 1.38 + 1.39 + // Get the handler text of not a compiled object. 1.40 + virtual const char16_t *GetHandlerText() = 0; 1.41 + 1.42 + // Get the location of the script. 1.43 + // Note: The memory pointed to by aFileName is owned by the 1.44 + // nsIScriptTimeoutHandler and should not be freed by the caller. 1.45 + virtual void GetLocation(const char **aFileName, uint32_t *aLineNo) = 0; 1.46 + 1.47 + // If we have a Function, get the arguments for passing to it. 1.48 + virtual const nsTArray<JS::Value>& GetArgs() = 0; 1.49 +}; 1.50 + 1.51 +NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptTimeoutHandler, 1.52 + NS_ISCRIPTTIMEOUTHANDLER_IID) 1.53 + 1.54 +#endif // nsIScriptTimeoutHandler_h___