diff options
-rw-r--r-- | src/history.c | 1 | ||||
-rw-r--r-- | src/ui/documentwidget.c | 13 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/history.c b/src/history.c index 50db33dd..91416020 100644 --- a/src/history.c +++ b/src/history.c | |||
@@ -412,6 +412,7 @@ void setCachedResponse_History(iHistory *d, const iGmResponse *response) { | |||
412 | void setCachedDocument_History(iHistory *d, iGmDocument *doc, iBool openedFromSidebar) { | 412 | void setCachedDocument_History(iHistory *d, iGmDocument *doc, iBool openedFromSidebar) { |
413 | lock_Mutex(d->mtx); | 413 | lock_Mutex(d->mtx); |
414 | iRecentUrl *item = mostRecentUrl_History(d); | 414 | iRecentUrl *item = mostRecentUrl_History(d); |
415 | iAssert(size_GmDocument(doc).x > 0); | ||
415 | if (item) { | 416 | if (item) { |
416 | #if !defined (NDEBUG) | 417 | #if !defined (NDEBUG) |
417 | if (!equal_String(url_GmDocument(doc), &item->url)) { | 418 | if (!equal_String(url_GmDocument(doc), &item->url)) { |
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c index e68af4d8..bd3fe7ad 100644 --- a/src/ui/documentwidget.c +++ b/src/ui/documentwidget.c | |||
@@ -1881,6 +1881,7 @@ static void addBannerWarnings_DocumentWidget_(iDocumentWidget *d) { | |||
1881 | 1881 | ||
1882 | static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float normScrollY, | 1882 | static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float normScrollY, |
1883 | const iGmResponse *resp, iGmDocument *cachedDoc) { | 1883 | const iGmResponse *resp, iGmDocument *cachedDoc) { |
1884 | iAssert(width_Widget(d) > 0); /* must be laid out by now */ | ||
1884 | setLinkNumberMode_DocumentWidget_(d, iFalse); | 1885 | setLinkNumberMode_DocumentWidget_(d, iFalse); |
1885 | clear_ObjectList(d->media); | 1886 | clear_ObjectList(d->media); |
1886 | delete_Gempub(d->sourceGempub); | 1887 | delete_Gempub(d->sourceGempub); |
@@ -1901,9 +1902,13 @@ static void updateFromCachedResponse_DocumentWidget_(iDocumentWidget *d, float n | |||
1901 | d->sourceStatus = success_GmStatusCode; | 1902 | d->sourceStatus = success_GmStatusCode; |
1902 | format_String(&d->sourceHeader, cstr_Lang("pageinfo.header.cached")); | 1903 | format_String(&d->sourceHeader, cstr_Lang("pageinfo.header.cached")); |
1903 | set_Block(&d->sourceContent, &resp->body); | 1904 | set_Block(&d->sourceContent, &resp->body); |
1905 | if (!cachedDoc) { | ||
1906 | setWidth_GmDocument(d->doc, documentWidth_DocumentWidget_(d), width_Widget(d)); | ||
1907 | } | ||
1904 | updateDocument_DocumentWidget_(d, resp, cachedDoc, iTrue); | 1908 | updateDocument_DocumentWidget_(d, resp, cachedDoc, iTrue); |
1905 | // setCachedDocument_History(d->mod.history, d->doc, | 1909 | // if (!cachedDoc) { |
1906 | // (d->flags & openedFromSidebar_DocumentWidgetFlag) != 0); | 1910 | // setCachedDocument_History(d->mod.history, d->doc, iFalse); |
1911 | // } | ||
1907 | clear_Banner(d->banner); | 1912 | clear_Banner(d->banner); |
1908 | updateBanner_DocumentWidget_(d); | 1913 | updateBanner_DocumentWidget_(d); |
1909 | addBannerWarnings_DocumentWidget_(d); | 1914 | addBannerWarnings_DocumentWidget_(d); |
@@ -1932,6 +1937,10 @@ static iBool updateFromHistory_DocumentWidget_(iDocumentWidget *d) { | |||
1932 | recent->flags.openedFromSidebar); | 1937 | recent->flags.openedFromSidebar); |
1933 | updateFromCachedResponse_DocumentWidget_( | 1938 | updateFromCachedResponse_DocumentWidget_( |
1934 | d, recent->normScrollY, recent->cachedResponse, recent->cachedDoc); | 1939 | d, recent->normScrollY, recent->cachedResponse, recent->cachedDoc); |
1940 | if (!recent->cachedDoc) { | ||
1941 | /* We have a cached copy now. */ | ||
1942 | setCachedDocument_History(d->mod.history, d->doc, iFalse); | ||
1943 | } | ||
1935 | return iTrue; | 1944 | return iTrue; |
1936 | } | 1945 | } |
1937 | else if (!isEmpty_String(d->mod.url)) { | 1946 | else if (!isEmpty_String(d->mod.url)) { |