Bug 1563066, part 2 - XULContentSinkImpl::ContextStack::Push is infallible. r=bzbarsky

This lets us remove some error handling code, including some that is
incorrect.

Differential Revision: https://phabricator.services.mozilla.com/D36789

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-07-03 22:42:42 +00:00
Родитель f627a6be99
Коммит 0b5946c5f2
2 изменённых файлов: 6 добавлений и 12 удалений

Просмотреть файл

@ -67,14 +67,13 @@ XULContentSinkImpl::ContextStack::~ContextStack() {
}
}
nsresult XULContentSinkImpl::ContextStack::Push(nsXULPrototypeNode* aNode,
State aState) {
void XULContentSinkImpl::ContextStack::Push(nsXULPrototypeNode* aNode,
State aState) {
Entry* entry = new Entry(aNode, aState, mTop);
mTop = entry;
++mDepth;
return NS_OK;
}
nsresult XULContentSinkImpl::ContextStack::Pop(State* aState) {
@ -631,14 +630,10 @@ nsresult XULContentSinkImpl::OpenRoot(const char16_t** aAttributes,
// Push the element onto the context stack, so that child
// containers will hook up to us as their parent.
nsresult rv = mContextStack.Push(element, mState);
if (NS_FAILED(rv)) {
element->Release();
return rv;
}
mContextStack.Push(element, mState);
// Add the attributes
rv = AddAttributes(aAttributes, aAttrLen, element);
nsresult rv = AddAttributes(aAttributes, aAttrLen, element);
if (NS_FAILED(rv)) return rv;
mState = eInDocumentElement;
@ -683,8 +678,7 @@ nsresult XULContentSinkImpl::OpenTag(const char16_t** aAttributes,
// Push the element onto the context stack, so that child
// containers will hook up to us as their parent.
rv = mContextStack.Push(element, mState);
if (NS_FAILED(rv)) return rv;
mContextStack.Push(element, mState);
mState = eInDocumentElement;
return NS_OK;

Просмотреть файл

@ -115,7 +115,7 @@ class XULContentSinkImpl final : public nsIXMLContentSink, public nsIExpatSink {
int32_t Depth() { return mDepth; }
nsresult Push(nsXULPrototypeNode* aNode, State aState);
void Push(nsXULPrototypeNode* aNode, State aState);
nsresult Pop(State* aState);
nsresult GetTopNode(RefPtr<nsXULPrototypeNode>& aNode);