diff options
| author | bptato <nincsnevem662@gmail.com> | 2024-12-12 20:14:10 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2024-12-12 20:22:38 +0100 |
| commit | 8428f0cb34147e32b4b77ee9af06f77b92c82fa5 (patch) | |
| tree | 94f12d56da3fdbab8de240721a911d86a29c1449 /src/html | |
| parent | 038ecf98013d7073ad31ec31468603a3b21d90d2 (diff) | |
| download | chawan-8428f0cb34147e32b4b77ee9af06f77b92c82fa5.tar.gz | |
twtstr: reduce copying in atob
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/env.nim | 6 |
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.} = |