I tried to make a WebExtension for Firefox following this tutorial: Your first Firefox (Web)extension in Kotlin | by Kirill Rakhman | Medium
My problem occurs when I try to iterate over ArrayLists of org.w3c.dom.Element, for Example
document.getElementsByTagName("div")
.asList()
.toList()
.forEach { console.info(it) }
crashes with TypeError: throwCCE is not a function
at
ArrayList.prototype.get_za3lpa$ = function (index) {
var tmp$;
return (tmp$ = this.array_hd7ov6$_0[this.rangeCheck_xcmk5o$_0(index)]) == null || Kotlin.isType(tmp$, Any) ? tmp$ : throwCCE();
};
I also don’t know why throwCCE
is not defined at this point but i think the actual problem lies in the Koltin.isType
function, as
console.info(js("Kotlin.isType(document.getElementsByTagName(\"div\")[0], Object)"))
prints false
which would explain the error (I think Object
in this context is the same as Any
in the previous snippet?)
I created a project to reproduce the error here: Bitbucket
Hope someone can help me