зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1533288 - Don't assume HasMoreElements() is called before GetNext() in nsIEHistoryEnumerator. r=jaws
Differential Revision: https://phabricator.services.mozilla.com/D22843 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
67e8bf685b
Коммит
84b6afec6f
|
@ -93,7 +93,21 @@ NS_IMETHODIMP
|
|||
nsIEHistoryEnumerator::GetNext(nsISupports** _retval) {
|
||||
*_retval = nullptr;
|
||||
|
||||
if (!mCachedNextEntry) return NS_ERROR_FAILURE;
|
||||
EnsureInitialized();
|
||||
MOZ_ASSERT(mURLEnumerator,
|
||||
"Should have instanced an IE History URLEnumerator");
|
||||
if (!mURLEnumerator) return NS_OK;
|
||||
|
||||
if (!mCachedNextEntry) {
|
||||
bool hasMore = false;
|
||||
nsresult rv = this->HasMoreElements(&hasMore);
|
||||
if (NS_FAILED(rv)) {
|
||||
return rv;
|
||||
}
|
||||
if (!hasMore) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
NS_ADDREF(*_retval = mCachedNextEntry);
|
||||
// Release the cached entry, so it can't be returned twice.
|
||||
|
|
Загрузка…
Ссылка в новой задаче