1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef MOZILLA_DOM_SCRIPT_NSISCRIPTLOADEROBSERVER_H_
7 #define MOZILLA_DOM_SCRIPT_NSISCRIPTLOADEROBSERVER_H_
9 #include "nsISupports.h"
10 #include "js/GCAnnotations.h"
12 class nsIScriptElement
;
15 #define NS_ISCRIPTLOADEROBSERVER_IID \
17 0x7b787204, 0x76fb, 0x4764, { \
18 0x96, 0xf1, 0xfb, 0x7a, 0x66, 0x6d, 0xb4, 0xf4 \
22 class NS_NO_VTABLE nsIScriptLoaderObserver
: public nsISupports
{
24 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTLOADEROBSERVER_IID
)
27 * The script is available for evaluation. For inline scripts, this
28 * method will be called synchronously. For externally loaded scripts,
29 * this method will be called when the load completes.
31 * @param aResult A result code representing the result of loading
32 * a script. If this is a failure code, script evaluation
34 * @param aElement The element being processed.
35 * @param aIsInline Is this an inline classic script (as opposed to an
36 * externally loaded classic script or module script)?
37 * @param aURI What is the URI of the script (the document URI if
39 * @param aLineNo At what line does the script appear (generally 1
40 * if it is a loaded script).
42 JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD
ScriptAvailable(nsresult aResult
,
43 nsIScriptElement
* aElement
,
44 bool aIsInlineClassicScript
,
46 uint32_t aLineNo
) = 0;
49 * The script has been evaluated.
51 * @param aResult A result code representing the success or failure of
52 * the script evaluation.
53 * @param aElement The element being processed.
54 * @param aIsInline Is this an inline script or externally loaded?
56 JS_HAZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT NS_IMETHOD
ScriptEvaluated(
57 nsresult aResult
, nsIScriptElement
* aElement
, bool aIsInline
) = 0;
60 NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptLoaderObserver
,
61 NS_ISCRIPTLOADEROBSERVER_IID
)
63 #define NS_DECL_NSISCRIPTLOADEROBSERVER \
64 NS_IMETHOD ScriptAvailable(nsresult aResult, nsIScriptElement* aElement, \
65 bool aIsInlineClassicScript, nsIURI* aURI, \
66 uint32_t aLineNo) override; \
67 MOZ_CAN_RUN_SCRIPT NS_IMETHOD ScriptEvaluated( \
68 nsresult aResult, nsIScriptElement* aElement, bool aIsInline) override;
70 #endif // MOZILLA_DOM_SCRIPT_NSISCRIPTLOADEROBSERVER_H_