about summary refs log tree commit diff stats
path: root/src/local/client.nim
diff options
context:
space:
mode:
Diffstat (limited to 'src/local/client.nim')
-rw-r--r--src/local/client.nim14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/local/client.nim b/src/local/client.nim
index 7947ce15..60bdf411 100644
--- a/src/local/client.nim
+++ b/src/local/client.nim
@@ -774,8 +774,9 @@ proc dumpBuffers(client: Client) =
       quit(1)
   stdout.close()
 
-proc launchClient*(client: Client, pages: seq[string],
-    contentType: Option[string], cs: Charset, dump: bool) =
+proc launchClient*(client: Client; pages: seq[string];
+    contentType: Option[string]; cs: Charset; dump: bool;
+    warnings: seq[string]) =
   var infile: File
   var dump = dump
   if not dump:
@@ -794,6 +795,7 @@ proc launchClient*(client: Client, pages: seq[string],
   client.loader.unregisterFun = proc(fd: int) =
     selector.unregister(fd)
   client.pager.launchPager(infile, selector)
+  client.pager.alerts.add(warnings)
   let clearFun = proc() =
     client.clearConsole()
   let showFun = proc() =
@@ -881,17 +883,17 @@ proc addJSModules(client: Client, ctx: JSContext) =
 func getClient(client: Client): Client {.jsfget: "client".} =
   return client
 
-proc newClient*(config: Config, forkserver: ForkServer): Client =
+proc newClient*(config: Config; forkserver: ForkServer; jsctx: JSContext):
+    Client =
   setControlCHook(proc() {.noconv.} = quit(1))
-  let jsrt = newJSRuntime()
+  let jsrt = JS_GetRuntime(jsctx)
   JS_SetModuleLoaderFunc(jsrt, normalizeModuleName, clientLoadJSModule, nil)
-  let jsctx = jsrt.newJSContext()
   let pager = newPager(config, forkserver, jsctx)
   let loader = forkserver.newFileLoader(LoaderConfig(
     urimethodmap: config.getURIMethodMap(),
     w3mCGICompat: config.external.w3m_cgi_compat,
     cgiDir: pager.cgiDir,
-    tmpdir: pager.tmpdir
+    tmpdir: config.external.tmpdir
   ))
   pager.setLoader(loader)
   let client = Client(