I was wondering if there is any plan to support XHR in the mid term.
I have no numbers, but I guess adding XHR support would dramatically increase the number of sites that become functional enough with Chawan.
I have no numbers, but I guess adding XHR support would dramatically increase the number of sites that become functional enough with Chawan.
I wonder about that ;)
But yes, it is in the todo file, and if you look closely there is even a half-implementation at src/html/xmlhttprequest.nim. I just never got around to finishing it, so it's quite useless in its current form.
(IIRC the problem I ran into back then was that our JS callback wrapper generator could not deal with XHR callbacks. Since then, I've realized that automatic callback wrapper generators are a waste of time, now I would just do it manually with JSValues.
Though I'm more interested in cleaning up fetch() first, the XHR standard builds on top of that anyway.)
Now that we released a new version, I can confess my secret goal was to at least pass the login screen of Agama. https://yast.opensuse.org/blog/2024-05-17/agama-8
So let's say this page renders nothing at Chawan. https://agama-online-demo.surge.sh
How can I gather logs to make sure the lack of XHR is to blame?
~ancorgs wrote:
So let's say this page renders nothing at Chawan. https://agama-online-demo.surge.sh
How can I gather logs to make sure the lack of XHR is to blame?
It's unlikely, because we now have XHR :P
(Though it's still not 100% complete, and very sparsely tested, so I've kept this ticket open.)
Anyway, to answer your question:
- check if you have scripting enabled (duh)
- check if you have module script tags - we don't support those yet.
- open the page, and check the console with M-c M-c. if you see an exception, good - you've found the issue. (I think it should even show the column number, thanks to qjs-ng.)
- otherwise, we're stuck with the Universal Debugger...
Let me know how it goes :)
Yes to number 2. The page includes the javascript using this tag:
<script type="module" src="./index.js"></script>
Which leads me to the next question regarding the sentence "we don't support those yet". How far in the roadmap is that?
~ancorgs wrote:
Which leads me to the next question regarding the sentence "we don't support those yet". How far in the roadmap is that?
Modules are in a similar state as XHR was when you opened this ticket: I've added some basic scaffolding, and got to a point where they get compiled. However, the recursive import fetching and evaluation logic is still missing.
I do hope to get it finished eventually, but again, it's relatively low priority. Patches welcome :P