I'll continue to debug further, but my first suspect is that get_all_msg_headers() method. Thanks for the report,
Re: Javascript weirdness
By: Digital Man to deon on Tue Apr 19 2022 10:15 pm
I'll continue to debug further, but my first suspect is that get_all_msg_headers() method. Thanks for the report,
No problem - glad you see it too :)
BTW: Not sure if it is related, but is the result of get_all_msg_headers() supposed to be read-only?
Originally I was iterating through through that result to update the messages, but I was noticing the following behaviour:
* call get_all_msg_headers()
* iterate through each item "for (hdr in hdrs)"
* set hdr.tag to "foo"
* pass hdr to put_msg_header();
But the items were not updating.
If, for example hdr.tag = "bar", if I had a writeln(hdr.tag) after setting it to "foo", it would report "foo". But if I JSON.stringify(hdr), the result shows that the tags field is still "bar".
My workaround was to redo a call to "get_msg_header(hdr.number)" and use that result to update and pass back to put_msg_header(), but (IMHO) that is a waste calls (if get_all_msg_headers is not meant to be r/o)... I also tried JSON.parse(JSON.stringify(hdr)) that worked too.
Not sure if that is related?
Originally I was iterating through through that result to update the messages, but I was noticing the following behaviour:
* call get_all_msg_headers()
* iterate through each item "for (hdr in hdrs)"
* set hdr.tag to "foo"
* pass hdr to put_msg_header();
But the items were not updating.
Does put_msg_header() return false when you try to use it in that manner?
Originally I was iterating through through that result to update the messages, but I was noticing the following behaviour:
* call get_all_msg_headers()
* iterate through each item "for (hdr in hdrs)"
* set hdr.tag to "foo"
* pass hdr to put_msg_header();
But the items were not updating.
Does put_msg_header() return false when you try to use it in that manner?
So I cant reproduce this now. I'll revert my code to use get_all_msg_headers and if I can reproduce it, I'll provide a log and the
status returned.
On the originally reported issue with Tags, I found:
- the issue still happens when using get_msg_header() instead
- the issue does not happen on Win32 builds
- the issue goes away when changing one line in js_msgbase.c, but it's clear
why
- LAZY_STRING_TRUNCSP_NULL("tags", p->msg.tags, JSPROP_ENUMERATE);
+ LAZY_STRING_TRUNCSP("tags", p->msg.tags, JSPROP_ENUMERATE);
still looking into it.
Re: Javascript weirdness
By: Digital Man to deon on Thu Apr 21 2022 06:17 pm
On the originally reported issue with Tags, I found:
- the issue still happens when using get_msg_header() instead
- the issue does not happen on Win32 builds
- the issue goes away when changing one line in js_msgbase.c, but it's clear
why
- LAZY_STRING_TRUNCSP_NULL("tags", p->msg.tags, JSPROP_ENUMERATE); + LAZY_STRING_TRUNCSP("tags", p->msg.tags, JSPROP_ENUMERATE);
still looking into it.
How did you go, any luck?
Sysop: | Nelgin |
---|---|
Location: | Plano, TX |
Users: | 510 |
Nodes: | 10 (1 / 9) |
Uptime: | 121:12:14 |
Calls: | 8,198 |
Calls today: | 5 |
Files: | 15,442 |
Messages: | 913,539 |
Posted today: | 8 |