Bug 1434819 part 3. Stop using XPCOM treewalker bits in webbrowserpersist. r=qdot

MozReview-Commit-ID: GmY7L4p00D1
This commit is contained in:
Boris Zbarsky 2018-02-01 14:26:12 -05:00
Родитель 8003341ed5
Коммит 7946bcf30a
1 изменённых файлов: 10 добавлений и 8 удалений

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

@ -1186,7 +1186,7 @@ WebBrowserPersistLocalDocument::ReadResources(nsIWebBrowserPersistResourceVisito
NS_ENSURE_TRUE(mDocument, NS_ERROR_FAILURE);
ErrorResult err;
nsCOMPtr<nsIDOMTreeWalker> walker =
RefPtr<dom::TreeWalker> walker =
mDocument->CreateTreeWalker(*mDocument,
nsIDOMNodeFilter::SHOW_ELEMENT |
nsIDOMNodeFilter::SHOW_DOCUMENT |
@ -1199,18 +1199,20 @@ WebBrowserPersistLocalDocument::ReadResources(nsIWebBrowserPersistResourceVisito
MOZ_ASSERT(walker);
RefPtr<ResourceReader> reader = new ResourceReader(this, aVisitor);
nsCOMPtr<nsIDOMNode> currentNode;
walker->GetCurrentNode(getter_AddRefs(currentNode));
while (currentNode) {
rv = reader->OnWalkDOMNode(currentNode);
nsCOMPtr<nsINode> currentNode = walker->CurrentNode();
do {
rv = reader->OnWalkDOMNode(currentNode->AsDOMNode());
if (NS_WARN_IF(NS_FAILED(rv))) {
break;
}
rv = walker->NextNode(getter_AddRefs(currentNode));
if (NS_WARN_IF(NS_FAILED(rv))) {
ErrorResult err;
currentNode = walker->NextNode(err);
if (NS_WARN_IF(err.Failed())) {
err.SuppressException();
break;
}
}
} while (currentNode);
reader->DocumentDone(rv);
// If NS_FAILED(rv), it was / will be reported by an EndVisit call
// via DocumentDone. This method must return a failure if and