mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-16 06:45:42 +00:00
Bug 1749935 - Remove nsIDTD::WillBuildModel. r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D135883
This commit is contained in:
parent
bbfc56b73d
commit
2e0cd032d6
@ -16,12 +16,6 @@ CNavDTD::CNavDTD() {}
|
||||
|
||||
CNavDTD::~CNavDTD() {}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CNavDTD::WillBuildModel(const CParserContext& aParserContext,
|
||||
nsIContentSink* aSink) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
CNavDTD::BuildModel(nsIContentSink* aSink) {
|
||||
// NB: It is important to throw STOPPARSING if the sink is the wrong type in
|
||||
|
@ -1503,9 +1503,7 @@ RLBoxExpatSandboxData::~RLBoxExpatSandboxData() {
|
||||
MOZ_COUNT_DTOR(RLBoxExpatSandboxData);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsExpatDriver::WillBuildModel(const CParserContext& aParserContext,
|
||||
nsIContentSink* aSink) {
|
||||
nsresult nsExpatDriver::Initialize(nsIURI* aURI, nsIContentSink* aSink) {
|
||||
mSink = do_QueryInterface(aSink);
|
||||
if (!mSink) {
|
||||
NS_ERROR("nsExpatDriver didn't get an nsIExpatSink");
|
||||
@ -1576,7 +1574,7 @@ nsExpatDriver::WillBuildModel(const CParserContext& aParserContext,
|
||||
XML_PARAM_ENTITY_PARSING_ALWAYS);
|
||||
#endif
|
||||
|
||||
auto baseURI = GetExpatBaseURI(aParserContext.mScanner.GetURI());
|
||||
auto baseURI = GetExpatBaseURI(aURI);
|
||||
auto uri =
|
||||
TransferBuffer<XML_Char>(Sandbox(), &baseURI[0], ArrayLength(baseURI));
|
||||
RLBOX_EXPAT_MCALL(MOZ_XML_SetBase, *uri);
|
||||
|
@ -39,6 +39,8 @@ class nsExpatDriver : public nsIDTD, public nsITokenizer {
|
||||
|
||||
nsExpatDriver();
|
||||
|
||||
nsresult Initialize(nsIURI* aURI, nsIContentSink* aSink);
|
||||
|
||||
int HandleExternalEntityRef(const char16_t* aOpenEntityNames,
|
||||
const char16_t* aBase, const char16_t* aSystemId,
|
||||
const char16_t* aPublicId);
|
||||
|
@ -49,9 +49,6 @@ class nsIDTD : public nsISupports {
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_IDTD_IID)
|
||||
|
||||
NS_IMETHOD WillBuildModel(const CParserContext& aParserContext,
|
||||
nsIContentSink* aSink) = 0;
|
||||
|
||||
/**
|
||||
* Called by the parser after the parsing process has concluded
|
||||
*/
|
||||
@ -86,11 +83,9 @@ class nsIDTD : public nsISupports {
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIDTD, NS_IDTD_IID)
|
||||
|
||||
#define NS_DECL_NSIDTD \
|
||||
NS_IMETHOD WillBuildModel(const CParserContext& aParserContext, \
|
||||
nsIContentSink* aSink) override; \
|
||||
void DidBuildModel() override; \
|
||||
NS_IMETHOD BuildModel(nsIContentSink* aSink) override; \
|
||||
NS_IMETHOD_(void) Terminate() override; \
|
||||
#define NS_DECL_NSIDTD \
|
||||
void DidBuildModel() override; \
|
||||
NS_IMETHOD BuildModel(nsIContentSink* aSink) override; \
|
||||
NS_IMETHOD_(void) Terminate() override; \
|
||||
NS_IMETHOD_(int32_t) GetType() override;
|
||||
#endif /* nsIDTD_h___ */
|
||||
|
@ -324,7 +324,11 @@ nsresult nsParser::WillBuildModel() {
|
||||
// Now see if we're parsing XML or HTML (which, as far as we're concerned,
|
||||
// simply means "not XML").
|
||||
if (mParserContext->mDocType == eXML) {
|
||||
mDTD = new nsExpatDriver();
|
||||
RefPtr<nsExpatDriver> expat = new nsExpatDriver();
|
||||
nsresult rv = expat->Initialize(mParserContext->mScanner.GetURI(), mSink);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mDTD = expat.forget();
|
||||
} else {
|
||||
mDTD = new CNavDTD();
|
||||
}
|
||||
@ -333,16 +337,7 @@ nsresult nsParser::WillBuildModel() {
|
||||
nsresult rv = mParserContext->GetTokenizer(mDTD, mSink, tokenizer);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mDTD->WillBuildModel(*mParserContext, mSink);
|
||||
nsresult sinkResult = mSink->WillBuildModel(mParserContext->mDTDMode);
|
||||
// nsIDTD::WillBuildModel used to be responsible for calling
|
||||
// nsIContentSink::WillBuildModel, but that obligation isn't expressible
|
||||
// in the nsIDTD interface itself, so it's sounder and simpler to give that
|
||||
// responsibility back to the parser. The former behavior of the DTD was to
|
||||
// NS_ENSURE_SUCCESS the sink WillBuildModel call, so if the sink returns
|
||||
// failure we should use sinkResult instead of rv, to preserve the old error
|
||||
// handling behavior of the DTD:
|
||||
return NS_FAILED(sinkResult) ? sinkResult : rv;
|
||||
return mSink->WillBuildModel(mParserContext->mDTDMode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user