Backed out changeset b462e7b742d8 (bug 1908261) for causing multiple reftest failures...
[gecko.git] / dom / script / ScriptElement.h
blob568ed9f78670d80ed1be104df1d57818f47ea793
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_ScriptElement_h
8 #define mozilla_dom_ScriptElement_h
10 #include "mozilla/Attributes.h"
11 #include "nsIScriptLoaderObserver.h"
12 #include "nsIScriptElement.h"
13 #include "nsStubMutationObserver.h"
15 namespace mozilla::dom {
17 /**
18 * Baseclass useful for script elements (such as <xhtml:script> and
19 * <svg:script>). Currently the class assumes that only the 'src'
20 * attribute and the children of the class affect what script to execute.
23 class ScriptElement : public nsIScriptElement, public nsStubMutationObserver {
24 public:
25 // nsIScriptLoaderObserver
26 NS_DECL_NSISCRIPTLOADEROBSERVER
28 // nsIMutationObserver
29 NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED
30 NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED
31 NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED
32 NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED
34 explicit ScriptElement(FromParser aFromParser)
35 : nsIScriptElement(aFromParser) {}
37 virtual nsresult FireErrorEvent() override;
39 virtual bool GetScriptType(nsAString& aType) override;
41 protected:
42 // Internal methods
44 /**
45 * Check if this element contains any script, linked or inline
47 virtual bool HasScriptContent() = 0;
49 virtual bool MaybeProcessScript() override;
52 } // namespace mozilla::dom
54 #endif // mozilla_dom_ScriptElement_h