about summary refs log tree commit diff stats
path: root/src/buffer/buffer.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-05-14 13:57:37 +0200
committerbptato <nincsnevem662@gmail.com>2023-05-14 13:57:37 +0200
commit755c1b7ece20de688c3f103f11b71055f6a4c727 (patch)
treeadda4e83ed8f2be8f199f6b2a2459d7c26285cff /src/buffer/buffer.nim
parentb080ed197b1f027aa6f400840a4136d1451f9624 (diff)
downloadchawan-755c1b7ece20de688c3f103f11b71055f6a4c727.tar.gz
Set buffer state to LOADED on finishLoad
Diffstat (limited to 'src/buffer/buffer.nim')
-rw-r--r--src/buffer/buffer.nim4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/buffer/buffer.nim b/src/buffer/buffer.nim
index 2d93214a..4a091091 100644
--- a/src/buffer/buffer.nim
+++ b/src/buffer/buffer.nim
@@ -652,12 +652,11 @@ proc finishLoad(buffer: Buffer): EmptyPromise =
       buffer.sstream.setPosition(0)
       let (doc, _) = parseHTML(buffer.sstream, cs = some(cs), window = buffer.window, url = buffer.url)
       buffer.document = doc
-    p = buffer.loadResources(buffer.document)
     buffer.state = LOADING_RESOURCES
+    p = buffer.loadResources(buffer.document)
   else:
     p = EmptyPromise()
     p.resolve()
-    buffer.state = LOADED
   buffer.selector.unregister(buffer.fd)
   buffer.fd = -1
   buffer.istream.close()
@@ -715,6 +714,7 @@ proc onload(buffer: Buffer) =
     if buffer.istream.atEnd():
       res.atend = true
       buffer.finishLoad().then(proc() =
+        buffer.state = LOADED
         buffer.resolveTask(LOAD, res))
       return
     buffer.resolveTask(LOAD, res)