diff options
| author | bptato <nincsnevem662@gmail.com> | 2025-01-06 17:53:03 +0100 |
|---|---|---|
| committer | bptato <nincsnevem662@gmail.com> | 2025-01-06 17:53:03 +0100 |
| commit | 48db2527dfb3496d85e4b797a3196ffa7f21baa3 (patch) | |
| tree | 6e73e167bc3cd089cc4c7c12e72b39caa85e9e7a /src/html | |
| parent | e0f3655cb0dc5a45206d4e53f0243c7d96452279 (diff) | |
| download | chawan-48db2527dfb3496d85e4b797a3196ffa7f21baa3.tar.gz | |
dom: add document.referrer
Only works if referer-from is enabled.
Diffstat (limited to 'src/html')
| -rw-r--r-- | src/html/dom.nim | 7 | ||||
| -rw-r--r-- | src/html/env.nim | 3 |
2 files changed, 6 insertions, 4 deletions
diff --git a/src/html/dom.nim b/src/html/dom.nim index 7cb6c5b4..96970d7b 100644 --- a/src/html/dom.nim +++ b/src/html/dom.nim @@ -113,6 +113,7 @@ type urandom*: PosixStream imageTypes*: Table[string, string] userAgent*: string + referrer* {.jsget.}: string autofocus*: bool maybeRestyle*: proc() @@ -1473,11 +1474,11 @@ func forms(document: Document): HTMLCollection {.jsfget.} = ) return document.cachedForms -func cookie(ctx: JSContext; document: Document): string {.jsfget.} = +#TODO take cookie jar from loader +func cookie(document: Document): string {.jsfget.} = return document.internalCookie -proc setCookie(ctx: JSContext; document: Document; cookie: string) - {.jsfset: "cookie".} = +proc setCookie(document: Document; cookie: string) {.jsfset: "cookie".} = document.internalCookie = cookie # DOMTokenList diff --git a/src/html/env.nim b/src/html/env.nim index 2db9a294..63ae6e21 100644 --- a/src/html/env.nim +++ b/src/html/env.nim @@ -379,7 +379,7 @@ proc runJSJobs*(window: Window) = proc newWindow*(scripting: ScriptingMode; images, styling, autofocus: bool; attrsp: ptr WindowAttributes; factory: CAtomFactory; loader: FileLoader; url: URL; urandom: PosixStream; imageTypes: Table[string, string]; - userAgent: string): Window = + userAgent, referrer: string): Window = let err = newDynFileStream(stderr) let window = Window( attrsp: attrsp, @@ -396,6 +396,7 @@ proc newWindow*(scripting: ScriptingMode; images, styling, autofocus: bool; urandom: urandom, imageTypes: imageTypes, userAgent: userAgent, + referrer: referrer, autofocus: autofocus ) window.location = window.newLocation() |