Skip to content
This repository has been archived by the owner on Jul 22, 2024. It is now read-only.

Commit

Permalink
Keep preload history. Fixes #1806
Browse files Browse the repository at this point in the history
  • Loading branch information
daoshengmu committed Sep 13, 2019
1 parent 1ce2c16 commit d983eb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,7 @@ class HistoryStore constructor(val context: Context) {
storage.getDetailedVisits(0, excludeTypes = listOf(
VisitType.NOT_A_VISIT,
VisitType.REDIRECT_TEMPORARY,
VisitType.REDIRECT_PERMANENT,
VisitType.RELOAD))
VisitType.REDIRECT_PERMANENT))
}

fun recordVisit(aURL: String, visitType: VisitType) = GlobalScope.future {
Expand Down Expand Up @@ -90,7 +89,8 @@ class HistoryStore constructor(val context: Context) {
}

fun isInHistory(aURL: String): CompletableFuture<Boolean> = GlobalScope.future {
storage.getVisited(listOf(aURL)).isNotEmpty()
var result = storage.getVisited(listOf(aURL))
result.isNotEmpty() && result[0]
}

private fun notifyListeners() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1479,22 +1479,19 @@ public GeckoResult<Boolean> onVisited(@NonNull GeckoSession geckoSession, @NonNu
VisitType visitType;
if (isReload) {
visitType = VisitType.RELOAD;

} else {
if ((flags & VISIT_REDIRECT_SOURCE_PERMANENT) != 0) {
visitType = VisitType.REDIRECT_PERMANENT;

} else if ((flags & VISIT_REDIRECT_SOURCE) != 0) {
visitType = VisitType.REDIRECT_TEMPORARY;

} else {
visitType = VisitType.LINK;
}
}

SessionStore.get().getHistoryStore().deleteVisitsFor(url);
SessionStore.get().getHistoryStore().recordVisit(url, visitType);

SessionStore.get().getHistoryStore().deleteVisitsFor(url).thenAcceptAsync(result -> {
SessionStore.get().getHistoryStore().recordVisit(url, visitType);
});
return GeckoResult.fromValue(true);
}

Expand Down

0 comments on commit d983eb2

Please sign in to comment.