1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/base/src/nsScriptElement.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,50 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef nsScriptElement_h 1.9 +#define nsScriptElement_h 1.10 + 1.11 +#include "mozilla/Attributes.h" 1.12 +#include "nsIScriptLoaderObserver.h" 1.13 +#include "nsIScriptElement.h" 1.14 +#include "nsStubMutationObserver.h" 1.15 + 1.16 +/** 1.17 + * Baseclass useful for script elements (such as <xhtml:script> and 1.18 + * <svg:script>). Currently the class assumes that only the 'src' 1.19 + * attribute and the children of the class affect what script to execute. 1.20 + */ 1.21 + 1.22 +class nsScriptElement : public nsIScriptElement, 1.23 + public nsStubMutationObserver 1.24 +{ 1.25 +public: 1.26 + // nsIScriptLoaderObserver 1.27 + NS_DECL_NSISCRIPTLOADEROBSERVER 1.28 + 1.29 + // nsIMutationObserver 1.30 + NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED 1.31 + NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED 1.32 + NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED 1.33 + NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED 1.34 + 1.35 + nsScriptElement(mozilla::dom::FromParser aFromParser) 1.36 + : nsIScriptElement(aFromParser) 1.37 + { 1.38 + } 1.39 + 1.40 + virtual nsresult FireErrorEvent() MOZ_OVERRIDE; 1.41 + 1.42 +protected: 1.43 + // Internal methods 1.44 + 1.45 + /** 1.46 + * Check if this element contains any script, linked or inline 1.47 + */ 1.48 + virtual bool HasScriptContent() = 0; 1.49 + 1.50 + virtual bool MaybeProcessScript() MOZ_OVERRIDE; 1.51 +}; 1.52 + 1.53 +#endif // nsScriptElement_h