Bug 1276669 - part 4 - initialize RDF atoms in nsLayoutStatics; r=Pike

This is not the cleanest code ever, but we need to move all static atom
initialization prior to NS_SealStaticAtomTable to avoid the possibility
of dynamic atoms being transmuted into static atoms.  We therefore need
to open up an avenue for somebody else to initialize the atoms that RDF needs.
This commit is contained in:
Nathan Froyd 2017-01-26 15:43:39 -05:00
parent 0382120c9d
commit 436e287afe
3 changed files with 14 additions and 2 deletions

View File

@ -53,6 +53,7 @@
#include "nsHtml5Atoms.h"
#include "nsHtml5Module.h"
#include "nsHTMLTags.h"
#include "nsIRDFContentSink.h" // for RDF atom initialization
#include "mozilla/dom/FallbackEncoding.h"
#include "nsFocusManager.h"
#include "nsListControlFrame.h"
@ -164,6 +165,7 @@ nsLayoutStatics::Initialize()
nsHtml5Atoms::AddRefAtoms();
nsTextServicesDocument::RegisterAtoms();
nsHTMLTags::RegisterAtoms();
nsRDFAtoms::RegisterAtoms();
StartupJSEnvironment();
rv = nsRegion::InitStatic();

View File

@ -54,4 +54,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIRDFContentSink, NS_IRDFCONTENTSINK_IID)
nsresult
NS_NewRDFContentSink(nsIRDFContentSink** aResult);
class nsRDFAtoms {
public:
static void RegisterAtoms();
};
#endif // nsIRDFContentSink_h___

View File

@ -257,6 +257,13 @@ static const nsStaticAtom rdf_atoms[] = {
#undef RDF_ATOM
};
// static
void
nsRDFAtoms::RegisterAtoms()
{
NS_RegisterStaticAtoms(rdf_atoms);
}
RDFContentSinkImpl::RDFContentSinkImpl()
: mText(nullptr),
mTextLength(0),
@ -287,8 +294,6 @@ RDFContentSinkImpl::RDFContentSinkImpl()
NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
NS_RegisterStaticAtoms(rdf_atoms);
}
}