aboutsummaryrefslogtreecommitdiffstats
path: root/src/html
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-12-12 20:14:10 +0100
committerbptato <nincsnevem662@gmail.com>2024-12-12 20:22:38 +0100
commit8428f0cb34147e32b4b77ee9af06f77b92c82fa5 (patch)
tree94f12d56da3fdbab8de240721a911d86a29c1449 /src/html
parent038ecf98013d7073ad31ec31468603a3b21d90d2 (diff)
downloadchawan-8428f0cb34147e32b4b77ee9af06f77b92c82fa5.tar.gz
twtstr: reduce copying in atob
Diffstat (limited to 'src/html')
-rw-r--r--src/html/env.nim6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index 7ce0bb4f..311496af 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -228,11 +228,11 @@ func getParent(window: Window): Window {.jsfget: "parent".} =
# See twtstr for the actual implementations.
proc atob(ctx: JSContext; window: Window; data: string): JSValue {.jsfunc.} =
- let r = atob0(data)
- if r.isNone:
+ var s = ""
+ if (let r = s.atob(data); r.isNone):
let ex = newDOMException($r.error, "InvalidCharacterError")
return JS_Throw(ctx, ctx.toJS(ex))
- return ctx.toJS(NarrowString(r.get))
+ return ctx.toJS(NarrowString(s))
proc btoa(ctx: JSContext; window: Window; data: JSValue): JSValue
{.jsfunc.} =