summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2022-02-07 20:06:15 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2022-02-07 20:06:15 +0200
commit63797b8909fe2e38e87cf80e2d9d7b62df070e79 (patch)
treeafa7f68add407db9650139eb339d28a637fb3887 /src
parent97b10dfbf4e126d7ba01abd41f2578bdce0be200 (diff)
DocumentWidget: Fixed handling of quick inline media request
If a request was already completed when it was moved inline, the content wasn't marked as finished and did not appear.
Diffstat (limited to 'src')
-rw-r--r--src/ui/documentwidget.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/ui/documentwidget.c b/src/ui/documentwidget.c
index 25559890..03d430cb 100644
--- a/src/ui/documentwidget.c
+++ b/src/ui/documentwidget.c
@@ -3095,12 +3095,14 @@ static const char *humanReadableStatusCode_(enum iGmStatusCode code) {
3095 return format_CStr("%d ", code); 3095 return format_CStr("%d ", code);
3096} 3096}
3097 3097
3098static void setUrl_DocumentWidget_(iDocumentWidget *d, const iString *url) { 3098static iBool setUrl_DocumentWidget_(iDocumentWidget *d, const iString *url) {
3099 url = canonicalUrl_String(url); 3099 url = canonicalUrl_String(url);
3100 if (!equal_String(d->mod.url, url)) { 3100 if (!equal_String(d->mod.url, url)) {
3101 d->flags |= urlChanged_DocumentWidgetFlag; 3101 d->flags |= urlChanged_DocumentWidgetFlag;
3102 set_String(d->mod.url, url); 3102 set_String(d->mod.url, url);
3103 return iTrue;
3103 } 3104 }
3105 return iFalse;
3104} 3106}
3105 3107
3106static void checkResponse_DocumentWidget_(iDocumentWidget *d) { 3108static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
@@ -3125,7 +3127,9 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
3125 iMediaRequest *mr = newReused_MediaRequest(d, d->requestLinkId, d->request); 3127 iMediaRequest *mr = newReused_MediaRequest(d, d->requestLinkId, d->request);
3126 unlockResponse_GmRequest(d->request); 3128 unlockResponse_GmRequest(d->request);
3127 d->request = NULL; /* ownership moved */ 3129 d->request = NULL; /* ownership moved */
3128 postCommand_Widget(d, "document.request.cancelled doc:%p", d); 3130 if (!isFinished_GmRequest(mr->req)) {
3131 postCommand_Widget(d, "document.request.cancelled doc:%p", d);
3132 }
3129 pushBack_ObjectList(d->media, mr); 3133 pushBack_ObjectList(d->media, mr);
3130 iRelease(mr); 3134 iRelease(mr);
3131 /* Reset the fetch state, returning to the originating page. */ 3135 /* Reset the fetch state, returning to the originating page. */
@@ -3133,9 +3137,14 @@ static void checkResponse_DocumentWidget_(iDocumentWidget *d) {
3133 if (equal_String(&mostRecentUrl_History(d->mod.history)->url, url_GmRequest(mr->req))) { 3137 if (equal_String(&mostRecentUrl_History(d->mod.history)->url, url_GmRequest(mr->req))) {
3134 undo_History(d->mod.history); 3138 undo_History(d->mod.history);
3135 } 3139 }
3136 setUrl_DocumentWidget_(d, url_GmDocument(d->view.doc)); 3140 if (setUrl_DocumentWidget_(d, url_GmDocument(d->view.doc))) {
3141 postCommand_Widget(d, "!document.changed doc:%p url:%s", d, cstr_String(d->mod.url));
3142 }
3137 updateFetchProgress_DocumentWidget_(d); 3143 updateFetchProgress_DocumentWidget_(d);
3138 postCommand_Widget(d, "media.updated link:%u request:%p", d->requestLinkId, mr); 3144 postCommand_Widget(d, "media.updated link:%u request:%p", d->requestLinkId, mr);
3145 if (isFinished_GmRequest(mr->req)) {
3146 postCommand_Widget(d, "media.finished link:%u request:%p", d->requestLinkId, mr);
3147 }
3139 return; 3148 return;
3140 } 3149 }
3141 /* Get ready for the incoming new document. */ 3150 /* Get ready for the incoming new document. */