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 : /* ***** BEGIN LICENSE BLOCK *****
4 : * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 : *
6 : * The contents of this file are subject to the Mozilla Public License Version
7 : * 1.1 (the "License"); you may not use this file except in compliance with
8 : * the License. You may obtain a copy of the License at
9 : * http://www.mozilla.org/MPL/
10 : *
11 : * Software distributed under the License is distributed on an "AS IS" basis,
12 : * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
13 : * for the specific language governing rights and limitations under the
14 : * License.
15 : *
16 : * The Original Code is mozilla.org code.
17 : *
18 : * The Initial Developer of the Original Code is
19 : * Netscape Communications Corporation.
20 : * Portions created by the Initial Developer are Copyright (C) 1998
21 : * the Initial Developer. All Rights Reserved.
22 : *
23 : * Contributor(s):
24 : * Mark Hammond <mhammond@skippinet.com.au>
25 : *
26 : * Alternatively, the contents of this file may be used under the terms of
27 : * either of the GNU General Public License Version 2 or later (the "GPL"),
28 : * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 : * in which case the provisions of the GPL or the LGPL are applicable instead
30 : * of those above. If you wish to allow use of your version of this file only
31 : * under the terms of either the GPL or the LGPL, and not to allow others to
32 : * use your version of this file under the terms of the MPL, indicate your
33 : * decision by deleting the provisions above and replace them with the notice
34 : * and other provisions required by the GPL or the LGPL. If you do not delete
35 : * the provisions above, a recipient may use your version of this file under
36 : * the terms of any one of the MPL, the GPL or the LGPL.
37 : *
38 : * ***** END LICENSE BLOCK ***** */
39 : #ifndef nsIScriptTimeoutHandler_h___
40 : #define nsIScriptTimeoutHandler_h___
41 :
42 : class nsIArray;
43 :
44 : #define NS_ISCRIPTTIMEOUTHANDLER_IID \
45 : { /* {17a9ce1a-d73b-45d1-8145-a0ae57bcc76e} */ \
46 : 0x17a9ce1a, 0xd73b, 0x45d1, \
47 : { 0x81, 0x45, 0xa0, 0xae, 0x57, 0xbc, 0xc7, 0x6e } }
48 :
49 : /**
50 : * Abstraction of the script objects etc required to do timeouts in a
51 : * language agnostic way.
52 : */
53 :
54 : class nsIScriptTimeoutHandler : public nsISupports
55 0 : {
56 : public:
57 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTTIMEOUTHANDLER_IID)
58 :
59 : // Get the script-type (language) implementing this timeout.
60 : virtual PRUint32 GetScriptTypeID() = 0;
61 :
62 : // Get a script object for the language suitable for passing back to
63 : // the language's context as an event handler. If this returns nsnull,
64 : // GetHandlerText() will be called to get the string.
65 : virtual JSObject *GetScriptObject() = 0;
66 :
67 : // Get the handler text of not a compiled object.
68 : virtual const PRUnichar *GetHandlerText() = 0;
69 :
70 : // Get the location of the script.
71 : // Note: The memory pointed to by aFileName is owned by the
72 : // nsIScriptTimeoutHandler and should not be freed by the caller.
73 : virtual void GetLocation(const char **aFileName, PRUint32 *aLineNo) = 0;
74 :
75 : // If a script object, get the argv suitable for passing back to the
76 : // script context.
77 : virtual nsIArray *GetArgv() = 0;
78 :
79 : // Get the language version for this timeout.
80 : virtual PRUint32 GetScriptVersion() = 0;
81 : };
82 :
83 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptTimeoutHandler,
84 : NS_ISCRIPTTIMEOUTHANDLER_IID)
85 :
86 : #endif // nsIScriptTimeoutHandler_h___
|