about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-10 17:27:41 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-10 17:27:41 +0200
commit5034921d6a02c2f38f0d2387261709468f726c78 (patch)
tree6080030c27f6c089e64b0ac14cc92565e4c710e0
parente42102dfb68083441db19af2f2c571f456945eb8 (diff)
downloadchawan-5034921d6a02c2f38f0d2387261709468f726c78.tar.gz
dom: fix crash on wrong CSS content type
-rw-r--r--src/html/dom.nim4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 9fc393c0..b31802bc 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -3119,9 +3119,7 @@ proc loadResource(window: Window; link: HTMLLinkElement) =
         if res.getContentType() == "text/css":
           return res.text()
         res.close()
-      let p = newPromise[JSResult[string]]()
-      p.resolve(JSResult[string].err(res.error))
-      return p
+      return newResolvedPromise(JSResult[string].err(nil))
     ).then(proc(s: JSResult[string]) =
       if s.isSome:
         #TODO non-utf-8 css?