зеркало из https://github.com/mozilla/pjs.git
Bug 494375 - Date folders in history not recreated when revisiting pages, r=dietrich
This commit is contained in:
Родитель
abd7cc16bd
Коммит
9b3fa49ccf
|
@ -4453,8 +4453,37 @@ nsNavHistoryResult::OnVisit(nsIURI* aURI, PRInt64 aVisitId, PRTime aTime,
|
|||
ENUMERATE_HISTORY_OBSERVERS(OnVisit(aURI, aVisitId, aTime, aSessionId,
|
||||
aReferringId, aTransitionType, &added));
|
||||
|
||||
if (!added && mRootNode->mExpanded) {
|
||||
// None of registered query observers has accepted our URI, this means,
|
||||
if (!mRootNode->mExpanded)
|
||||
return NS_OK;
|
||||
|
||||
// If this visit is accepted by an overlapped container, and not all
|
||||
// overlapped containers are visible, we should still call Refresh if the
|
||||
// visit falls into any of them.
|
||||
PRBool todayIsMissing = PR_FALSE;
|
||||
PRUint32 resultType = mRootNode->mOptions->ResultType();
|
||||
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY ||
|
||||
resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_SITE_QUERY) {
|
||||
PRUint32 childCount;
|
||||
nsresult rv = mRootNode->GetChildCount(&childCount);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
if (childCount) {
|
||||
nsCOMPtr<nsINavHistoryResultNode> firstChild;
|
||||
rv = mRootNode->GetChild(0, getter_AddRefs(firstChild));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCAutoString title;
|
||||
rv = firstChild->GetTitle(title);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsNavHistory* history = nsNavHistory::GetHistoryService();
|
||||
NS_ENSURE_TRUE(history, 0);
|
||||
nsCAutoString todayLabel;
|
||||
history->GetStringFromName(
|
||||
NS_LITERAL_STRING("finduri-AgeInDays-is-0").get(), todayLabel);
|
||||
todayIsMissing = !todayLabel.Equals(title);
|
||||
}
|
||||
}
|
||||
|
||||
if (!added || todayIsMissing) {
|
||||
// None of registered query observers has accepted our URI. This means,
|
||||
// that a matching query either was not expanded or it does not exist.
|
||||
PRUint32 resultType = mRootNode->mOptions->ResultType();
|
||||
if (resultType == nsINavHistoryQueryOptions::RESULTS_AS_DATE_QUERY ||
|
||||
|
|
|
@ -388,10 +388,19 @@ function test_date_liveupdate(aResultType) {
|
|||
// Remove "Today".
|
||||
hs.removePagesByTimeframe(midnight.getTime() * 1000, Date.now() * 1000);
|
||||
do_check_eq(root.childCount, visibleContainers.length - 1);
|
||||
// Add a visit for "Today".
|
||||
|
||||
// Open "Last 7 days" container, this way we will have a container accepting
|
||||
// the new visit, but we should still add back "Today" container.
|
||||
var last7Days = root.getChild(1)
|
||||
.QueryInterface(Ci.nsINavHistoryContainerResultNode);
|
||||
last7Days.containerOpen = true;
|
||||
|
||||
// Add a visit for "Today". This should add back the missing "Today"
|
||||
// container.
|
||||
add_normalized_visit(uri("http://www.mozilla.org/"), nowObj.getTime(), 0);
|
||||
do_check_eq(root.childCount, visibleContainers.length);
|
||||
|
||||
last7Days.containerOpen = false;
|
||||
root.containerOpen = false;
|
||||
|
||||
// TEST 2. Test that the query correctly updates even if it is not root.
|
||||
|
|
Загрузка…
Ссылка в новой задаче