aboutsummaryrefslogtreecommitdiffstats
path: root/src/js
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2024-05-20 18:12:09 +0200
committerbptato <nincsnevem662@gmail.com>2024-05-20 18:12:09 +0200
commit7c4bb940410c8f5ad59e1d21d5565364a9a0cd71 (patch)
treed46d682ce9d4f308232c961985d8411c2a70197c /src/js
parent723613b0a02605dbf715d74c70b9ec29f1092c76 (diff)
downloadchawan-7c4bb940410c8f5ad59e1d21d5565364a9a0cd71.tar.gz
html: improve Request, derive Client from Window
* make Client an instance of Window (for less special casing) * misc work on Request & fetch * improve origin comparison (opaque origins of same URLs are now considered the same)
Diffstat (limited to 'src/js')
-rw-r--r--src/js/javascript.nim8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/js/javascript.nim b/src/js/javascript.nim
index bfe45aae..a697bb2f 100644
--- a/src/js/javascript.nim
+++ b/src/js/javascript.nim
@@ -1601,8 +1601,9 @@ proc bindEndStmts(endstmts: NimNode; info: RegistryInfo) =
let `classDef` = JSClassDefConst(addr cd))
macro registerType*(ctx: JSContext; t: typed; parent: JSClassID = 0;
- asglobal: static bool = false; nointerface = false;
- name: static string = ""; has_extra_getset: static bool = false;
+ asglobal: static bool = false; globalparent: static bool = false;
+ nointerface = false; name: static string = "";
+ has_extra_getset: static bool = false;
extra_getset: static openArray[TabGetSet] = []; namespace = JS_NULL;
errid = opt(JSErrorEnum); ishtmldda = false): JSClassID =
var stmts = newStmtList()
@@ -1636,9 +1637,10 @@ macro registerType*(ctx: JSContext; t: typed; parent: JSClassID = 0;
let tname = info.tname
let unforgeable = info.tabUnforgeable
let staticfuns = info.tabStatic
+ let global = asglobal and not globalparent
endstmts.add(quote do:
`ctx`.newJSClass(`classDef`, `tname`, getTypePtr(`t`), `sctr`, `tabList`,
- `parent`, bool(`asglobal`), `nointerface`, `finName`, `namespace`,
+ `parent`, bool(`global`), `nointerface`, `finName`, `namespace`,
`errid`, `unforgeable`, `staticfuns`, `ishtmldda`)
)
stmts.add(newBlockStmt(endstmts))