about summary refs log tree commit diff stats
path: root/src/html/env.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2023-08-27 15:36:19 +0200
committerbptato <nincsnevem662@gmail.com>2023-08-28 20:08:35 +0200
commit1aafbc1d8adc69ea593efb4c0b9a7c5c2f3b9fa5 (patch)
treef247b2a52820f608f6d8e8d41b8027e521bbf6f9 /src/html/env.nim
parent9991bd3393483158ab0d1b9d995f695dee3c65dc (diff)
downloadchawan-1aafbc1d8adc69ea593efb4c0b9a7c5c2f3b9fa5.tar.gz
javascript: de-ref some interfaces
Also, make ActionMap use getters/hasprop instead of a table copy.

peakmem remains up +200M at 950M after commit
9991bd3393483158ab0d1b9d995f695dee3c65dc. :(
Diffstat (limited to 'src/html/env.nim')
-rw-r--r--src/html/env.nim50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/html/env.nim b/src/html/env.nim
index 6e81e614..82ed163b 100644
--- a/src/html/env.nim
+++ b/src/html/env.nim
@@ -20,24 +20,24 @@ import xhr/formdata
 import xhr/xmlhttprequest
 
 # NavigatorID
-proc appCodeName(navigator: Navigator): string {.jsfget.} = "Mozilla"
-proc appName(navigator: Navigator): string {.jsfget.} = "Netscape"
-proc appVersion(navigator: Navigator): string {.jsfget.} = "5.0 (Windows)"
-proc platform(navigator: Navigator): string {.jsfget.} = "Win32"
-proc product(navigator: Navigator): string {.jsfget.} = "Gecko"
-proc productSub(navigator: Navigator): string {.jsfget.} = "20100101"
-proc userAgent(navigator: Navigator): string {.jsfget.} = "chawan" #TODO TODO TODO this should be configurable
-proc vendor(navigator: Navigator): string {.jsfget.} = ""
-proc vendorSub(navigator: Navigator): string {.jsfget.} = ""
-proc taintEnabled(navigator: Navigator): bool {.jsfget.} = false
-proc oscpu(navigator: Navigator): string {.jsfget.} = "Windows NT 10.0"
+proc appCodeName(navigator: ptr Navigator): string {.jsfget.} = "Mozilla"
+proc appName(navigator: ptr Navigator): string {.jsfget.} = "Netscape"
+proc appVersion(navigator: ptr Navigator): string {.jsfget.} = "5.0 (Windows)"
+proc platform(navigator: ptr Navigator): string {.jsfget.} = "Win32"
+proc product(navigator: ptr Navigator): string {.jsfget.} = "Gecko"
+proc productSub(navigator: ptr Navigator): string {.jsfget.} = "20100101"
+proc userAgent(navigator: ptr Navigator): string {.jsfget.} = "chawan" #TODO TODO TODO this should be configurable
+proc vendor(navigator: ptr Navigator): string {.jsfget.} = ""
+proc vendorSub(navigator: ptr Navigator): string {.jsfget.} = ""
+proc taintEnabled(navigator: ptr Navigator): bool {.jsfget.} = false
+proc oscpu(navigator: ptr Navigator): string {.jsfget.} = "Windows NT 10.0"
 
 # NavigatorLanguage
-proc language(navigator: Navigator): string {.jsfget.} = "en-US"
-proc languages(navigator: Navigator): seq[string] {.jsfget.} = @["en-US"] #TODO frozen array?
+proc language(navigator: ptr Navigator): string {.jsfget.} = "en-US"
+proc languages(navigator: ptr Navigator): seq[string] {.jsfget.} = @["en-US"] #TODO frozen array?
 
 # NavigatorOnline
-proc onLine(navigator: Navigator): bool {.jsfget.} =
+proc onLine(navigator: ptr Navigator): bool {.jsfget.} =
   true # at the very least, the terminal is on-line :)
 
 #TODO NavigatorContentUtils
@@ -45,19 +45,19 @@ proc onLine(navigator: Navigator): bool {.jsfget.} =
 # NavigatorCookies
 # "this website needs cookies to be enabled to function correctly"
 # It's probably better to lie here.
-proc cookieEnabled(navigator: Navigator): bool {.jsfget.} = true
+proc cookieEnabled(navigator: ptr Navigator): bool {.jsfget.} = true
 
 # NavigatorPlugins
-proc pdfViewerEnabled(navigator: Navigator): bool {.jsfget.} = false
-proc javaEnabled(navigator: Navigator): bool {.jsfunc.} = false
-proc namedItem(pluginArray: PluginArray): string {.jsfunc.} = ""
-proc namedItem(mimeTypeArray: MimeTypeArray): string {.jsfunc.} = ""
-proc item(pluginArray: PluginArray): JSValue {.jsfunc.} = JS_NULL
-proc length(pluginArray: PluginArray): int {.jsfget.} = 0
-proc item(mimeTypeArray: MimeTypeArray): JSValue {.jsfunc.} = JS_NULL
-proc length(mimeTypeArray: MimeTypeArray): int {.jsfget.} = 0
-proc getter(pluginArray: PluginArray, i: int): Option[JSValue] {.jsgetprop.} = discard
-proc getter(mimeTypeArray: MimeTypeArray, i: int): Option[JSValue] {.jsgetprop.} = discard
+proc pdfViewerEnabled(navigator: ptr Navigator): bool {.jsfget.} = false
+proc javaEnabled(navigator: ptr Navigator): bool {.jsfunc.} = false
+proc namedItem(pluginArray: ptr PluginArray): string {.jsfunc.} = ""
+proc namedItem(mimeTypeArray: ptr MimeTypeArray): string {.jsfunc.} = ""
+proc item(pluginArray: ptr PluginArray): JSValue {.jsfunc.} = JS_NULL
+proc length(pluginArray: ptr PluginArray): int {.jsfget.} = 0
+proc item(mimeTypeArray: ptr MimeTypeArray): JSValue {.jsfunc.} = JS_NULL
+proc length(mimeTypeArray: ptr MimeTypeArray): int {.jsfget.} = 0
+proc getter(pluginArray: ptr PluginArray, i: int): Option[JSValue] {.jsgetprop.} = discard
+proc getter(mimeTypeArray: ptr MimeTypeArray, i: int): Option[JSValue] {.jsgetprop.} = discard
 
 proc addNavigatorModule(ctx: JSContext) =
   ctx.registerType(Navigator)