diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-08-09 00:29:31 +0200 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-08-09 00:29:31 +0200 |
| commit | b6b998bf608f2f82d5b639455b2fd6224b0919e2 (patch) | |
| tree | 8dd1e2869b64ac584700b6de034db5c667200954 /src/types | |
| parent | 4c64687290c908cd791a058dede9bd4f2a1c7757 (diff) | |
| download | chawan-b6b998bf608f2f82d5b639455b2fd6224b0919e2.tar.gz | |
Update monoucha
Diffstat (limited to 'src/types')
| -rw-r--r-- | src/types/blob.nim | 2 | ||||
| -rw-r--r-- | src/types/url.nim | 9 |
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} |