nsIScriptLoaderObserver.h (2833B)
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/. */ 5 6 #ifndef MOZILLA_DOM_SCRIPT_NSISCRIPTLOADEROBSERVER_H_ 7 #define MOZILLA_DOM_SCRIPT_NSISCRIPTLOADEROBSERVER_H_ 8 9 #include "js/GCAnnotations.h" 10 #include "nsISupports.h" 11 12 class nsIScriptElement; 13 class nsIURI; 14 15 #define NS_ISCRIPTLOADEROBSERVER_IID \ 16 {0x7b787204, 0x76fb, 0x4764, {0x96, 0xf1, 0xfb, 0x7a, 0x66, 0x6d, 0xb4, 0xf4}} 17 18 class NS_NO_VTABLE nsIScriptLoaderObserver : public nsISupports { 19 public: 20 NS_INLINE_DECL_STATIC_IID(NS_ISCRIPTLOADEROBSERVER_IID) 21 22 /** 23 * The script is available for evaluation. For inline scripts, this 24 * method will be called synchronously. For externally loaded scripts, 25 * this method will be called when the load completes. 26 * 27 * @param aResult A result code representing the result of loading 28 * a script. If this is a failure code, script evaluation 29 * will not occur. 30 * @param aElement The element being processed. 31 * @param aIsInline Is this an inline classic script (as opposed to an 32 * externally loaded classic script or module script)? 33 * @param aURI What is the URI of the script (the document URI if 34 * it is inline). 35 * @param aLineNo At what line does the script appear (generally 1 36 * if it is a loaded script). 37 */ 38 JS_HAZ_CAN_RUN_SCRIPT NS_IMETHOD ScriptAvailable(nsresult aResult, 39 nsIScriptElement* aElement, 40 bool aIsInlineClassicScript, 41 nsIURI* aURI, 42 uint32_t aLineNo) = 0; 43 44 /** 45 * The script has been evaluated. 46 * 47 * @param aResult A result code representing the success or failure of 48 * the script evaluation. 49 * @param aElement The element being processed. 50 * @param aIsInline Is this an inline script or externally loaded? 51 */ 52 JS_HAZ_CAN_RUN_SCRIPT MOZ_CAN_RUN_SCRIPT NS_IMETHOD ScriptEvaluated( 53 nsresult aResult, nsIScriptElement* aElement, bool aIsInline) = 0; 54 }; 55 56 #define NS_DECL_NSISCRIPTLOADEROBSERVER \ 57 NS_IMETHOD ScriptAvailable(nsresult aResult, nsIScriptElement* aElement, \ 58 bool aIsInlineClassicScript, nsIURI* aURI, \ 59 uint32_t aLineNo) override; \ 60 MOZ_CAN_RUN_SCRIPT NS_IMETHOD ScriptEvaluated( \ 61 nsresult aResult, nsIScriptElement* aElement, bool aIsInline) override; 62 63 #endif // MOZILLA_DOM_SCRIPT_NSISCRIPTLOADEROBSERVER_H_