1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-06-15 23:35:34 +00:00

Don't fail assertion on 0-second meta-refresh

In start_document_refresh, use register_bottom_half instead of
install_timer if the timeout is 0 because install_timer asserts that it is
given a delay greater than 0.

Add a test case, test/refresh-0timeout.html.  Note that
document.browse.minimum_refresh_time must be set to 0 to reproduce the
assertion failure.
This commit is contained in:
Miciah Dashiel Butler Masters 2009-06-03 19:21:59 +00:00
parent 2b1aedf6d1
commit 874202ef7a
3 changed files with 17 additions and 0 deletions

2
NEWS
View File

@ -43,6 +43,8 @@ Miscellaneous:
* Really retry forever when connection.retries = 0. * Really retry forever when connection.retries = 0.
* enhancement: Session-specific options. Any options changed with * enhancement: Session-specific options. Any options changed with
toggle-* actions no longer affect other tabs or other terminals. toggle-* actions no longer affect other tabs or other terminals.
* Do not crash when document.browse.minimum_refresh_time = 0 and
a document has a meta refresh with a delay of 0.
* enhancement: Domain-specific options. Use set_domain in elinks.conf * enhancement: Domain-specific options. Use set_domain in elinks.conf
to e.g. disable cookies for google.com. The option manager window to e.g. disable cookies for google.com. The option manager window
does not yet support this. does not yet support this.

View File

@ -15,6 +15,7 @@
#include "document/document.h" #include "document/document.h"
#include "document/refresh.h" #include "document/refresh.h"
#include "document/view.h" #include "document/view.h"
#include "main/select.h"
#include "main/timer.h" #include "main/timer.h"
#include "protocol/uri.h" #include "protocol/uri.h"
#include "session/download.h" #include "session/download.h"
@ -120,6 +121,14 @@ start_document_refresh(struct document_refresh *refresh,
if (compare_uri(refresh->uri, type_query->uri, URI_BASE)) if (compare_uri(refresh->uri, type_query->uri, URI_BASE))
return; return;
if (time == 0) {
/* Use register_bottom_half() instead of install_timer()
* because the latter asserts that the delay is greater
* than 0. */
register_bottom_half(do_document_refresh, doc_view);
return;
}
install_timer(&refresh->timer, time, do_document_refresh, doc_view); install_timer(&refresh->timer, time, do_document_refresh, doc_view);
} }

View File

@ -0,0 +1,6 @@
<html>
<head><meta http-equiv="refresh" content="0; url=/" /></head>
<body>
Redirect to / after 0 seconds.
</body>
</html>