diff options
author | bptato <nincsnevem662@gmail.com> | 2024-02-19 12:27:24 +0100 |
---|---|---|
committer | bptato <nincsnevem662@gmail.com> | 2024-02-19 12:29:01 +0100 |
commit | e1e12551c0eb8b1ad0366706e1e456e4d4a0b446 (patch) | |
tree | b14fa64b3ecec9ea8c3440901d4990059f6c0a71 /src | |
parent | 01b083bada3ad8ceb7d89cc215536ff738bfe876 (diff) | |
download | chawan-e1e12551c0eb8b1ad0366706e1e456e4d4a0b446.tar.gz |
container: fix crash on clone -> view source
* set loaderPid in clones too * handle URL in container the same way as in buffer
Diffstat (limited to 'src')
-rw-r--r-- | src/local/container.nim | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/local/container.nim b/src/local/container.nim index f57690ce..3814f43d 100644 --- a/src/local/container.nim +++ b/src/local/container.nim @@ -88,6 +88,9 @@ type cmd*: string Container* = ref object + # note: this is not the same as source.request.url (but should be synced + # with buffer.url) + url: URL parent* {.jsget.}: Container children* {.jsget.}: seq[Container] config*: BufferConfig @@ -145,6 +148,7 @@ proc newBuffer*(forkserver: ForkServer, config: BufferConfig, else: discard close(fd) return Container( + url: source.request.url, process: process, loaderPid: loaderPid, source: source, @@ -169,6 +173,7 @@ proc newBufferFrom*(forkserver: ForkServer, attrs: WindowAttributes, let bufferPid = forkserver.forkBufferWithLoader(source, config, attrs, loaderPid) return Container( + url: source.request.url, source: source, width: container.width, height: container.height, @@ -183,7 +188,7 @@ proc newBufferFrom*(forkserver: ForkServer, attrs: WindowAttributes, ) func location*(container: Container): URL {.jsfget.} = - return container.source.request.url + return container.url proc clone*(container: Container, newurl: URL): Promise[Container] = let url = if newurl != nil: @@ -193,7 +198,8 @@ proc clone*(container: Container, newurl: URL): Promise[Container] = return container.iface.clone(url).then(proc(pid: Pid): Container = if pid == -1: return nil - let ncontainer = Container( + return Container( + url: url, config: container.config, iface: container.iface, # changed later in setStream width: container.width, @@ -206,6 +212,7 @@ proc clone*(container: Container, newurl: URL): Promise[Container] = bpos: container.bpos, highlights: container.highlights, process: pid, + loaderPid: container.loaderPid, loadinfo: container.loadinfo, lines: container.lines, lineshift: container.lineshift, @@ -224,9 +231,6 @@ proc clone*(container: Container, newurl: URL): Promise[Container] = ishtml: container.ishtml, cloned: true ) - if newurl != nil: - ncontainer.source.request.url = newurl - return ncontainer ) func charset*(container: Container): Charset = |