about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-09-10 17:28:20 +0200
committerbptato <nincsnevem662@gmail.com>2024-09-10 17:28:20 +0200
commit55e98ed332ac9b10fdd22d24f39413fc4e916ac4 (patch)
tree089fb35c11bfee24064e3309eb51e6aba573589a
parent5034921d6a02c2f38f0d2387261709468f726c78 (diff)
downloadchawan-55e98ed332ac9b10fdd22d24f39413fc4e916ac4.tar.gz
pager: fix rewrite-url weirdness
saveSource's URL overriding mechanism conflicted with rewrite-url,
since the latter wouldn't change the overriding URL (which was not
optional either).

Remove the former since a) it's just cosmetic and b) not really visible
to the user at all.
-rw-r--r--src/local/container.nim4
-rw-r--r--src/local/pager.nim8
2 files changed, 4 insertions, 8 deletions
diff --git a/src/local/container.nim b/src/local/container.nim
index cb7738b8..7e1326a6 100644
--- a/src/local/container.nim
+++ b/src/local/container.nim
@@ -60,7 +60,6 @@ type
       tvalue*: string
     of cetOpen:
       request*: Request
-      url*: URL
       save*: bool
     of cetAnchor, cetNoAnchor:
       anchor*: string
@@ -1893,8 +1892,7 @@ proc saveSource*(container: Container) {.jsfunc.} =
   container.triggerEvent(ContainerEvent(
     t: cetOpen,
     request: newRequest(newURL("cache:" & $container.cacheId).get),
-    save: true,
-    url: container.url
+    save: true
   ))
 
 proc windowChange*(container: Container; attrs: WindowAttributes) =
diff --git a/src/local/pager.nim b/src/local/pager.nim
index b0521706..87c2e9d2 100644
--- a/src/local/pager.nim
+++ b/src/local/pager.nim
@@ -1218,11 +1218,10 @@ proc applySiteconf(pager: Pager; url: var URL; charsetOverride: Charset;
 proc gotoURL(pager: Pager; request: Request; prevurl = none(URL);
     contentType = none(string); cs = CHARSET_UNKNOWN; replace: Container = nil;
     replaceBackup: Container = nil; redirectDepth = 0;
-    referrer: Container = nil; save = false; url: URL = nil): Container =
+    referrer: Container = nil; save = false): Container =
   pager.navDirection = ndNext
   if referrer != nil and referrer.config.refererFrom:
     request.referrer = referrer.url
-  let url = if url != nil: url else: request.url
   var loaderConfig: LoaderClientConfig
   var bufferConfig = pager.applySiteconf(request.url, cs, loaderConfig)
   if prevurl.isNone or not prevurl.get.equals(request.url, true) or
@@ -1245,7 +1244,7 @@ proc gotoURL(pager: Pager; request: Request; prevurl = none(URL);
       redirectDepth = redirectDepth,
       contentType = contentType,
       flags = flags,
-      url = url
+      url = request.url
     )
     if replace != nil:
       pager.replace(replace, container)
@@ -2085,9 +2084,8 @@ proc handleEvent0(pager: Pager; container: Container; event: ContainerEvent):
             referrer = pager.container, save = event.save)
       )
     else:
-      let url = if event.url != nil: event.url else: event.request.url
       discard pager.gotoURL(event.request, some(container.url),
-        referrer = pager.container, save = event.save, url = url)
+        referrer = pager.container, save = event.save)
   of cetStatus:
     if pager.container == container:
       pager.showAlerts()