Substack_Comments Won't Load

For support with specific websites

Moderator: trava90

Forum rules
Please always mention the name/domain of the website in question in your topic title.
Please one website per topic thread (to help keep things organized). While behavior on different sites might at first glance seem similar, they are not necessarily caused by the same.

Please try to include any relevant output from the Toolkit Error Console or the Developer Tools Web Console using the following procedure:
  1. Clear any current output
  2. Navigate or refresh the page in question
  3. Copy and paste Errors or seemingly relevant Warnings into a single [ code ] block.
larryg
Hobby Astronomer
Hobby Astronomer
Posts: 17
Joined: 2016-02-04, 20:06

Substack_Comments Won't Load

Unread post by larryg » 2022-08-24, 14:19

https://rwmalonemd.substack.com/p/lawsu ... wp-company

There's a link to load additional comments at the end of the article,
( scroll to article end, after the cartoon ) and click on :

"285 more comments… "

Doesn't work in PM (it used to, not sure when it stopped), OK in other browsers.

Thank you,



Timestamp: 8/24/2022 9:03:08 AM
Error: SyntaxError: invalid identity escape in regular expression
Source File: https://substackcdn.com/min/main.bundle ... 82ccb60468
Line: 50, Column: 165378
Source Code:
.trim().replace(/\s+/g,"-").replace(/&/g,"-and-").replace(n?/[^\p{L}-]+/gu:/[^\w-]+/g,"").replace(/-+/g,"-");return t&&t
[/code]

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35591
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Substack_Comments Won't Load

Unread post by Moonchild » 2022-08-24, 14:21

It's because of \p{L}
The whole "unicode categories in regex" is an obscenely complex to implement standard, especially if (like us and mozilla for that matter) you don't have the devs in house to slot it into an already complex regex engine. See https://www.regular-expressions.info/un ... l#category
Read though that. If there's a way someone can help with it, it'd be appreciated. A practical solution like using a lookup table to replace {L} and other unicode groups with something our current parser understands would be fine, too.
Otherwise, when writing regex, especially if just using it for trimming, please use normal (unicode) ranges which are fully supported, instead of shorthand like this.
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

Weasel
Apollo supporter
Apollo supporter
Posts: 35
Joined: 2016-10-10, 15:59

Re: Substack_Comments Won't Load

Unread post by Weasel » 2022-08-27, 00:58

Doesn't look so complicated to me. It has a lot of categories, yes, but they should all be in a table somewhere, no? In the spec or something.

And since unicode ranges are supported, in theory just map each category to a sequence of ranges. It shouldn't even need a lot of code, just a std::map which maps the category name to an array of ranges (with length since there can be variable number of ranges). I don't know anything about Mozilla code though, but that's how I'd code it personally, but well, maybe the browser's regex engine (from Mozilla) isn't sane and requires some refactoring.

I mean yeah it's going to take some time to make all the tables, but for me "complex" means something that requires a hard solution, not just something tedious. This is the latter, imo.

User avatar
athenian200
Contributing developer
Contributing developer
Posts: 1533
Joined: 2018-10-28, 19:56
Location: Georgia

Re: Substack_Comments Won't Load

Unread post by athenian200 » 2022-08-27, 04:14

Weasel wrote:
2022-08-27, 00:58
And since unicode ranges are supported, in theory just map each category to a sequence of ranges. It shouldn't even need a lot of code, just a std::map which maps the category name to an array of ranges (with length since there can be variable number of ranges). I don't know anything about Mozilla code though, but that's how I'd code it personally, but well, maybe the browser's regex engine (from Mozilla) isn't sane and requires some refactoring.

I mean yeah it's going to take some time to make all the tables, but for me "complex" means something that requires a hard solution, not just something tedious. This is the latter, imo.
Well, the main problem is that the regex engine we have is a half-busted ancient version of Google's Irregexp that Mozilla imported and jerry-rigged to work with their codebase. Any attempt we make to modify it to add the functionality we need results in weird stack corruption issues. The way they implemented it in the first place depended on it not doing certain things with memory, and the new functionality unfortunately does a lot of those things. Mozilla did later import a newer version of irregexp, but what they did hasn't helped us because their JS engine had changed too much by the time they did it.

https://repo.palemoon.org/MoonchildProd ... ssues/1279

https://repo.palemoon.org/MoonchildProd ... ssues/1362

Basically, every time we try to improve the regex engine we have, something breaks and we wind up having to roll it back. The easiest solution is probably to import a newer irregexp somehow, but that task has been... well... yeah. It just seems like this is an issue that no matter how we approach it, there doesn't seem to be a solution.
"The Athenians, however, represent the unity of these opposites; in them, mind or spirit has emerged from the Theban subjectivity without losing itself in the Spartan objectivity of ethical life. With the Athenians, the rights of the State and of the individual found as perfect a union as was possible at all at the level of the Greek spirit." -- Hegel's philosophy of Mind

Weasel
Apollo supporter
Apollo supporter
Posts: 35
Joined: 2016-10-10, 15:59

Re: Substack_Comments Won't Load

Unread post by Weasel » 2022-08-27, 16:57

Yuck, that does sound horrible, I guess I shouldn't be surprised it's a spaghetti mess. Thanks for the clarification.

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 35591
Joined: 2011-08-28, 17:27
Location: Motala, SE
Contact:

Re: Substack_Comments Won't Load

Unread post by Moonchild » 2022-08-27, 17:36

Honestly, at this rate I'm more tempted to actually look and see if we can go back to what Mozilla had initially for regex: a self-hosted JS module implementing regex parsing and processing in javascript. It would be a ton easier to maintain and extend than this glueing in of foreign Google code (literally the "standard" here is just a description of "what irregex implements" because Mozilla is literally using Chrome code for it -- this is why I call them "Google regex extensions")
"Sometimes, the best way to get what you want is to be a good person." -- Louis Rossmann
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite

unknownone
Moonbather
Moonbather
Posts: 52
Joined: 2017-03-29, 00:15

Re: Substack_Comments Won't Load

Unread post by unknownone » 2022-09-12, 00:00

I've experienced the same issue and it affects all buttons (including the one to subscribe an author, to visualize all comments, the "Let me read it first", the like and comment buttons, etc..) on the substack webpage and all subdomains that host the articles of all authors that publish there.

I've took my time to file a support ticket to ask them to provide a fall-back code for non-mainstream browsers, using their form https://support.substack.com/hc/en-us/requests/new. I hope they will consider and apply a fix on their side (basically reintroducing the previous button code as alternative code).

unknownone
Moonbather
Moonbather
Posts: 52
Joined: 2017-03-29, 00:15

Re: Substack_Comments Won't Load

Unread post by unknownone » 2022-09-16, 00:04

I've received a reply from Substack's support, informing me that my bug report and suggestion will be forwarded to the Product team for discussion.

Locked