URL Rewriter [not] broken by PM 33.6 Topic is solved
Moderators: FranklinDM, Lootyhoof
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
URL Rewriter [not] broken by PM 33.6
After updating to Pale Moon 33.6.0 (Nuck-TH's SSL2 GTK3 version) the URL Rewriter extension got completely broken. Settings window shows but buttons don't work at all, previously added (and working) rules dissapeared. Even its toolbar icon's tooltip is blank.
Yes, I do have latest available version (2.8.4) installed.
Could anybody please fix it, or recommend another similar extension?
Yes, I do have latest available version (2.8.4) installed.
Could anybody please fix it, or recommend another similar extension?
Last edited by Drugwash on 2025-02-10, 18:09, edited 1 time in total.
-
Night Wing
- Knows the dark side

- Posts: 5536
- Joined: 2011-10-03, 10:19
- Location: Piney Woods of Southeast Texas, USA
Re: URL Rewriter broken by PM 33.6
Your version number for this add-on is 2.8.4 by the user (papush), but I do not know whether this affects it or not, but the compatibility for Pale Moon is "29". It hasn't been worked on since August of 2021. Seems to be abandoned from what I can see.
MX Linux 23.6 (Libretto) Xfce w/Pale Moon, Waterfox, Firefox
Linux Debian 13.1 (Trixie) Xfce w/Pale Moon, Waterfox, Firefox
Linux Debian 13.1 (Trixie) Xfce w/Pale Moon, Waterfox, Firefox
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
Re: URL Rewriter broken by PM 33.6
Yes, I noticed those details. However it has been working fine up until and including 33.5.1. I can only assume the URL Base changes in 33.6 has lead to this breakage, but can't say anything for sure.
Also I do have many other installed extensions that have a lower compatible version and they still work properly.
Also I do have many other installed extensions that have a lower compatible version and they still work properly.
-
Moonchild
- Pale Moon guru

- Posts: 38382
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: URL Rewriter broken by PM 33.6
It's possible the extension used the now-removed URL constructor method that has not been in the spec for years. If so, it means the extension needs to be updated to use specced URL constructor methods instead.
"There is no point in arguing with an idiot, because then you're both idiots." - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
Re: URL Rewriter broken by PM 33.6
Yes, anything is possible. If you - or anyone else knowledgeable - could provide details/examples about the old and new URL constructor methods I could look into the code and attempt a fix - at least for testing/personal use purpose. I haven't looked into any kind of code for a while, got rusty.
-
Moonchild
- Pale Moon guru

- Posts: 38382
- Joined: 2011-08-28, 17:27
- Location: Motala, SE
Re: URL Rewriter broken by PM 33.6
The difference is that the URL() constructor can no longer accept a DOMString as its base (2nd parameter) — it only accepts a USVString. It can still use an existing URL object for the base, because it stringifies itself to the object's href attribute in that case. I don't know where in the extension this might be used but it shouldn't be too hard to correct if this is the issue.
See bug #1368950 and Issue #2557 (UXP).
See bug #1368950 and Issue #2557 (UXP).
"There is no point in arguing with an idiot, because then you're both idiots." - Anonymous
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
"Seek wisdom, not knowledge. Knowledge is of the past; wisdom is of the future." -- Native American proverb
"Linux makes everything difficult." -- Lyceus Anubite
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
Re: URL Rewriter broken by PM 33.6
Thank you, will check the resources provided and look into extension's code, maybe will find the issue(s).
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
Re: URL Rewriter broken by PM 33.6
Found the issue. Nothing to do (apparently) with URL Constructor().
The importRedirects() function in redirector.js missed a check for blank variable (rjson) which made JSON.parse() throw an error and bail out on the entire script.
Simple fix is inserting if (rjson == '') return 0; at line 162 in redirector.js.
Now, why that happened? I suspect the existing file containing the user-edited rules had somehow been "lost" or rather blanked out (?) either upon PM update or during one of the recent crashes. After the patch importing a rules file backup worked fine, and now the extension works properly.
The importRedirects() function in redirector.js missed a check for blank variable (rjson) which made JSON.parse() throw an error and bail out on the entire script.
Simple fix is inserting if (rjson == '') return 0; at line 162 in redirector.js.
Now, why that happened? I suspect the existing file containing the user-edited rules had somehow been "lost" or rather blanked out (?) either upon PM update or during one of the recent crashes. After the patch importing a rules file backup worked fine, and now the extension works properly.
-
BenFenner
- Keeps coming back

- Posts: 844
- Joined: 2015-06-01, 12:52
- Location: US Southeast
Re: URL Rewriter broken by PM 33.6
Good work. 
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
Re: URL Rewriter broken by PM 33.6
Thanks. 
Honestly, a better/more proper fix would be to enclose the JSON.parse() call in a try/catch so that any other possible glitch - such as missing/malformed JSON tags - would be caught and dealt with gracefully. But experienced coders would know that already - I'm just an amateur trying to get by the traps of modern computing.
Honestly, a better/more proper fix would be to enclose the JSON.parse() call in a try/catch so that any other possible glitch - such as missing/malformed JSON tags - would be caught and dealt with gracefully. But experienced coders would know that already - I'm just an amateur trying to get by the traps of modern computing.
-
andyprough
- Board Warrior

- Posts: 1182
- Joined: 2020-05-31, 04:33
Re: URL Rewriter broken by PM 33.6
I'm suspecting it might have been after a crash, as my installation of URL Rewriter continued to work as expected after upgrading Pale Moon to 33.6.
-
Drugwash
- Lunatic

- Posts: 316
- Joined: 2016-01-28, 12:08
- Location: Ploieşti, Romania
Re: URL Rewriter [not] broken by PM 33.6
Yes, in retrospective that must have been the reason. It was just an unfortunate coincidence with the upgrade to 33.6 after 33.5.1 started crashing on some Wordpress blog. Why that file (redirector.rjson in profile folder) got broken remains a mystery. Better back up those rules before it happens to you (or anyone else).
As for the final version of the fix this is what I added at line 162 instead of the simple fix above; should take care of any parsing error now:
As for the final version of the fix this is what I added at line 162 instead of the simple fix above; should take care of any parsing error now:
Code: Select all
try {rjson = JSON.parse(rjson);}
catch(e) {
this.debug('REDIRECTOR: error parsing rules file in importRedirects:\n' + e + '\n');
return 0;
}