|
1 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
2 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
4 |
|
5 #ifndef nsScriptElement_h |
|
6 #define nsScriptElement_h |
|
7 |
|
8 #include "mozilla/Attributes.h" |
|
9 #include "nsIScriptLoaderObserver.h" |
|
10 #include "nsIScriptElement.h" |
|
11 #include "nsStubMutationObserver.h" |
|
12 |
|
13 /** |
|
14 * Baseclass useful for script elements (such as <xhtml:script> and |
|
15 * <svg:script>). Currently the class assumes that only the 'src' |
|
16 * attribute and the children of the class affect what script to execute. |
|
17 */ |
|
18 |
|
19 class nsScriptElement : public nsIScriptElement, |
|
20 public nsStubMutationObserver |
|
21 { |
|
22 public: |
|
23 // nsIScriptLoaderObserver |
|
24 NS_DECL_NSISCRIPTLOADEROBSERVER |
|
25 |
|
26 // nsIMutationObserver |
|
27 NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED |
|
28 NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED |
|
29 NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED |
|
30 NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED |
|
31 |
|
32 nsScriptElement(mozilla::dom::FromParser aFromParser) |
|
33 : nsIScriptElement(aFromParser) |
|
34 { |
|
35 } |
|
36 |
|
37 virtual nsresult FireErrorEvent() MOZ_OVERRIDE; |
|
38 |
|
39 protected: |
|
40 // Internal methods |
|
41 |
|
42 /** |
|
43 * Check if this element contains any script, linked or inline |
|
44 */ |
|
45 virtual bool HasScriptContent() = 0; |
|
46 |
|
47 virtual bool MaybeProcessScript() MOZ_OVERRIDE; |
|
48 }; |
|
49 |
|
50 #endif // nsScriptElement_h |