aboutsummaryrefslogtreecommitdiffstats
path: root/src/types
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-08-09 00:29:31 +0200
committerbptato <nincsnevem662@gmail.com>2024-08-09 00:29:31 +0200
commitb6b998bf608f2f82d5b639455b2fd6224b0919e2 (patch)
tree8dd1e2869b64ac584700b6de034db5c667200954 /src/types
parent4c64687290c908cd791a058dede9bd4f2a1c7757 (diff)
downloadchawan-b6b998bf608f2f82d5b639455b2fd6224b0919e2.tar.gz
Update monoucha
Diffstat (limited to 'src/types')
-rw-r--r--src/types/blob.nim2
-rw-r--r--src/types/url.nim9
2 files changed, 6 insertions, 5 deletions
diff --git a/src/types/blob.nim b/src/types/blob.nim
index fb0bd92a..acffedf8 100644
--- a/src/types/blob.nim
+++ b/src/types/blob.nim
@@ -52,7 +52,7 @@ proc newWebFile*(name: string; fd: FileHandle): WebFile =
type
BlobPropertyBag = object of JSDict
- `type`: string
+ `type` {.jsdefault.}: string
#TODO endings
FilePropertyBag = object of BlobPropertyBag
diff --git a/src/types/url.nim b/src/types/url.nim
index 23485602..7ecc9531 100644
--- a/src/types/url.nim
+++ b/src/types/url.nim
@@ -1060,11 +1060,12 @@ proc newURL*(url: URL): URL =
result = URL()
url.cloneInto(result)
-proc setHref(url: URL; s: string): Err[JSError] {.jsfset: "href".} =
+proc setHref(ctx: JSContext; url: URL; s: string) {.jsfset: "href".} =
let purl = basicParseURL(s)
- if purl.isNone:
- return errTypeError(s & " is not a valid URL")
- purl.get.cloneInto(url)
+ if purl.isSome:
+ purl.get.cloneInto(url)
+ else:
+ JS_ThrowTypeError(ctx, "%s is not a valid URL", s)
func isIP*(url: URL): bool =
return url.host.t in {htIpv4, htIpv6}