From 6ede93a040645fdc0e09ee4a5c56e5929e392439 Mon Sep 17 00:00:00 2001 From: John Foerch Date: Fri, 17 Feb 2012 19:44:00 -0500 Subject: [PATCH] do_client_redirect: fix history handling Whether the url to be skipped is or is not in the history at the point when the client-redirects are called seems to be timing-dependent, so we need to explicitly check before removing an entry from the history. --- modules/client-redirect.jsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/client-redirect.jsx b/modules/client-redirect.jsx index 63bd445..281f350 100644 --- a/modules/client-redirect.jsx +++ b/modules/client-redirect.jsx @@ -34,9 +34,11 @@ function do_client_redirect (buffer, request, location) { var redirect = handler(location); if (redirect) { var history = buffer.web_navigation.sessionHistory; - if (history.index > 0) - history.getEntryAtIndex(history.index - 1, true); - else + var entry = history.getEntryAtIndex(history.index, false); + if (history.index > 0) { + if (entry.URI.spec == location.spec) + history.getEntryAtIndex(history.index - 1, true); + } else if (entry.URI.spec == location.spec) history.PurgeHistory(1); buffer.load(redirect); return; -- 2.11.4.GIT