aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-03-06 18:09:41 +0100
committerbptato <nincsnevem662@gmail.com>2025-03-06 18:38:55 +0100
commitdd22a568b7de36193e0e2b71ae623f5bd75eb535 (patch)
tree2fb9b25d6c30521606525564fe7bb709b5da44be /lib
parente156ca34f760e700b15b76a13230e08a617e03df (diff)
downloadchawan-dd22a568b7de36193e0e2b71ae623f5bd75eb535.tar.gz
javascript: remove ishtmldda from registerType
It's simpler and more efficient to handle this in the DOM. (The interface was also confusing/broken in that it only really accepted one htmldda class.)
Diffstat (limited to 'lib')
-rw-r--r--lib/monoucha0/doc/manual.md2
-rw-r--r--lib/monoucha0/monoucha/javascript.nim12
-rw-r--r--lib/monoucha0/monoucha/jsopaque.nim1
-rw-r--r--lib/monoucha0/monoucha/tojs.nim2
4 files changed, 6 insertions, 11 deletions
diff --git a/lib/monoucha0/doc/manual.md b/lib/monoucha0/doc/manual.md
index bc79bbd0..7bfed135 100644
--- a/lib/monoucha0/doc/manual.md
+++ b/lib/monoucha0/doc/manual.md
@@ -155,7 +155,7 @@ macro registerType*(ctx: JSContext; t: typed; parent: JSClassID = 0;
asglobal: static bool = false; nointerface = false;
name: static string = ""; hasExtraGetSet: static bool = false;
extraGetSet: static openArray[TabGetSet] = []; namespace = JS_NULL;
- errid = opt(JSErrorEnum); ishtmldda = false): JSClassID
+ errid = opt(JSErrorEnum)): JSClassID
```
Typically, you would do this using Nim reference types. Non-reference
diff --git a/lib/monoucha0/monoucha/javascript.nim b/lib/monoucha0/monoucha/javascript.nim
index b63b2a58..2a811ce6 100644
--- a/lib/monoucha0/monoucha/javascript.nim
+++ b/lib/monoucha0/monoucha/javascript.nim
@@ -300,7 +300,7 @@ proc newCtorFunFromParentClass(ctx: JSContext; ctor: JSCFunction;
func newJSClass*(ctx: JSContext; cdef: JSClassDefConst; nimt: pointer;
ctor: JSCFunction; funcs: JSFunctionList; parent: JSClassID;
- asglobal, nointerface, ishtmldda: bool; finalizer: JSFinalizerFunction;
+ asglobal, nointerface: bool; finalizer: JSFinalizerFunction;
namespace: JSValue; errid: Opt[JSErrorEnum];
unforgeable, staticfuns: JSFunctionList): JSClassID
{.discardable.} =
@@ -317,8 +317,6 @@ func newJSClass*(ctx: JSContext; cdef: JSClassDefConst; nimt: pointer;
if ctxOpaque.parents.len <= int(result):
ctxOpaque.parents.setLen(int(result) + 1)
ctxOpaque.parents[result] = parent
- if ishtmldda:
- ctxOpaque.htmldda = result
if finalizer != nil:
rtOpaque.fins[nimt] = finalizer
let proto = ctx.newProtoFromParentClass(parent)
@@ -1490,7 +1488,7 @@ macro registerType*(ctx: JSContext; t: typed; parent: JSClassID = 0;
nointerface = false; name: static string = "";
hasExtraGetSet: static bool = false;
extraGetSet: static openArray[TabGetSet] = []; namespace = JS_NULL;
- errid = Opt[JSErrorEnum].err(); ishtmldda = false): JSClassID =
+ errid = Opt[JSErrorEnum].err()): JSClassID =
var stmts = newStmtList()
var info = BoundFunctions.getOrDefault(t.strVal)
if info == nil:
@@ -1529,9 +1527,9 @@ macro registerType*(ctx: JSContext; t: typed; parent: JSClassID = 0;
let staticfuns = info.tabStatic
let global = asglobal and not globalparent
endstmts.add(quote do:
- `ctx`.newJSClass(classDef, getTypePtr(`t`), `sctr`, `tabList`,
- `parent`, `global`, `nointerface`, `ishtmldda`, `finName`, `namespace`,
- `errid`, `unforgeable`, `staticfuns`)
+ `ctx`.newJSClass(classDef, getTypePtr(`t`), `sctr`, `tabList`, `parent`,
+ `global`, `nointerface`, `finName`, `namespace`, `errid`, `unforgeable`,
+ `staticfuns`)
)
stmts.add(newBlockStmt(endstmts))
return stmts
diff --git a/lib/monoucha0/monoucha/jsopaque.nim b/lib/monoucha0/monoucha/jsopaque.nim
index e7920ea2..d1dce5a7 100644
--- a/lib/monoucha0/monoucha/jsopaque.nim
+++ b/lib/monoucha0/monoucha/jsopaque.nim
@@ -40,7 +40,6 @@ type
strRefs*: array[JSStrRef, JSAtom]
valRefs*: array[JSValueRef, JSValue]
errCtorRefs*: array[JSErrorEnum, JSValue]
- htmldda*: JSClassID # only one of these exists: document.all.
globalUnref*: JSEmptyOpaqueCallback
JSFinalizerFunction* = proc(rt: JSRuntime; opaque: pointer) {.nimcall,
diff --git a/lib/monoucha0/monoucha/tojs.nim b/lib/monoucha0/monoucha/tojs.nim
index 5eadbba3..526b41fb 100644
--- a/lib/monoucha0/monoucha/tojs.nim
+++ b/lib/monoucha0/monoucha/tojs.nim
@@ -279,8 +279,6 @@ proc toJSP0(ctx: JSContext; p, tp, toRef: pointer; ctor: JSValue): JSValue =
JS_SetPropertyFunctionList(ctx, jsObj, ufp,
cint(ctxOpaque.unforgeable[int(class)].len))
GC_ref(cast[RootRef](toRef))
- if unlikely(ctxOpaque.htmldda == class):
- JS_SetIsHTMLDDA(ctx, jsObj)
return jsObj
type NonInheritable = (object and not RootObj) or (ref object and not RootRef)