diff --git a/content/html/parser/public/nsHtml5Module.h b/content/html/parser/public/nsHtml5Module.h
index 93d3ae7b8c69..4c67c7d74135 100644
--- a/content/html/parser/public/nsHtml5Module.h
+++ b/content/html/parser/public/nsHtml5Module.h
@@ -47,6 +47,10 @@ class nsHtml5Module
static void ReleaseStatics();
static already_AddRefed NewHtml5Parser();
static nsresult Initialize(nsIParser* aParser, nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel);
+#ifdef DEBUG
+ private:
+ static PRBool sNsHtml5ModuleInitialized;
+#endif
};
#endif // nsHtml5Module_h__
diff --git a/content/html/parser/src/nsHtml5Module.cpp b/content/html/parser/src/nsHtml5Module.cpp
index 61d62d8a9661..9b729e258523 100644
--- a/content/html/parser/src/nsHtml5Module.cpp
+++ b/content/html/parser/src/nsHtml5Module.cpp
@@ -63,12 +63,18 @@ nsHtml5Module::InitializeStatics()
nsHtml5Tokenizer::initializeStatics();
nsHtml5TreeBuilder::initializeStatics();
nsHtml5UTF16Buffer::initializeStatics();
+#ifdef DEBUG
+ sNsHtml5ModuleInitialized = PR_TRUE;
+#endif
}
// static
void
nsHtml5Module::ReleaseStatics()
{
+#ifdef DEBUG
+ sNsHtml5ModuleInitialized = PR_FALSE;
+#endif
nsHtml5AttributeName::releaseStatics();
nsHtml5ElementName::releaseStatics();
nsHtml5HtmlAttributes::releaseStatics();
@@ -85,6 +91,7 @@ nsHtml5Module::ReleaseStatics()
already_AddRefed
nsHtml5Module::NewHtml5Parser()
{
+ NS_ABORT_IF_FALSE(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized.");
nsIParser* rv = static_cast (new nsHtml5Parser());
NS_ADDREF(rv);
return rv;
@@ -95,7 +102,11 @@ nsHtml5Module::NewHtml5Parser()
nsresult
nsHtml5Module::Initialize(nsIParser* aParser, nsIDocument* aDoc, nsIURI* aURI, nsISupports* aContainer, nsIChannel* aChannel)
{
+ NS_ABORT_IF_FALSE(sNsHtml5ModuleInitialized, "nsHtml5Module not initialized.");
nsHtml5Parser* parser = static_cast (aParser);
return parser->Initialize(aDoc, aURI, aContainer, aChannel);
}
+#ifdef DEBUG
+PRBool nsHtml5Module::sNsHtml5ModuleInitialized = PR_FALSE;
+#endif