Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit 436e287

Browse files
committed
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.
1 parent 0382120 commit 436e287

3 files changed

Lines changed: 14 additions & 2 deletions

File tree

layout/build/nsLayoutStatics.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
#include "nsHtml5Atoms.h"
5454
#include "nsHtml5Module.h"
5555
#include "nsHTMLTags.h"
56+
#include "nsIRDFContentSink.h" // for RDF atom initialization
5657
#include "mozilla/dom/FallbackEncoding.h"
5758
#include "nsFocusManager.h"
5859
#include "nsListControlFrame.h"
@@ -164,6 +165,7 @@ nsLayoutStatics::Initialize()
164165
nsHtml5Atoms::AddRefAtoms();
165166
nsTextServicesDocument::RegisterAtoms();
166167
nsHTMLTags::RegisterAtoms();
168+
nsRDFAtoms::RegisterAtoms();
167169

168170
StartupJSEnvironment();
169171
rv = nsRegion::InitStatic();

rdf/base/nsIRDFContentSink.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsIRDFContentSink, NS_IRDFCONTENTSINK_IID)
5454
nsresult
5555
NS_NewRDFContentSink(nsIRDFContentSink** aResult);
5656

57+
class nsRDFAtoms {
58+
public:
59+
static void RegisterAtoms();
60+
};
61+
5762
#endif // nsIRDFContentSink_h___

rdf/base/nsRDFContentSink.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,13 @@ static const nsStaticAtom rdf_atoms[] = {
257257
#undef RDF_ATOM
258258
};
259259

260+
// static
261+
void
262+
nsRDFAtoms::RegisterAtoms()
263+
{
264+
NS_RegisterStaticAtoms(rdf_atoms);
265+
}
266+
260267
RDFContentSinkImpl::RDFContentSinkImpl()
261268
: mText(nullptr),
262269
mTextLength(0),
@@ -287,8 +294,6 @@ RDFContentSinkImpl::RDFContentSinkImpl()
287294

288295
NS_DEFINE_CID(kRDFContainerUtilsCID, NS_RDFCONTAINERUTILS_CID);
289296
rv = CallGetService(kRDFContainerUtilsCID, &gRDFContainerUtils);
290-
291-
NS_RegisterStaticAtoms(rdf_atoms);
292297
}
293298
}
294299

0 commit comments

Comments
 (0)