NS_IMETHODIMP ResourceReader::OnDocumentReady(nsIWebBrowserPersistDocument* aDocument) { mVisitor->VisitDocument(mParent, aDocument); DocumentDone(NS_OK); return NS_OK; }
nsresult ResourceReader::OnWalkSubframe(nsINode* aNode) { RefPtr<nsFrameLoaderOwner> loaderOwner = do_QueryObject(aNode); NS_ENSURE_STATE(loaderOwner); RefPtr<nsFrameLoader> loader = loaderOwner->GetFrameLoader(); NS_ENSURE_STATE(loader); ++mOutstandingDocuments; // Pass in 0 as the outer window ID so that we start // persisting the root of this subframe, and not some other // subframe child of this subframe. ErrorResult err; loader->StartPersistence(0, this, err); nsresult rv = err.StealNSResult(); if (NS_FAILED(rv)) { if (rv == NS_ERROR_NO_CONTENT) { // Just ignore frames with no content document. rv = NS_OK; } // StartPersistence won't eventually call this if it failed, // so this does so (to keep mOutstandingDocuments correct). DocumentDone(rv); } return rv; }
NS_IMETHODIMP ResourceReader::OnError(nsresult aFailure) { DocumentDone(aFailure); return NS_OK; }