Redirector addon: stopped working since v28

Add-ons for Pale Moon and other applications
General discussion, compatibility, contributed extensions, themes, plugins, and more.

Moderators: FranklinDM, Lootyhoof

CaptainFlint

Redirector addon: stopped working since v28

Unread post by CaptainFlint » 2018-09-23, 11:17

I've been using the Redirector extension version 2.9.3 which was compatible with Pale Moon up to version 27. Since the update to 28 it stopped working: the URLs are not redirected, the Settings page does not show the configured list of redirects, all buttons on it do nothing.

I tried to investigate, but I failed to find how to debug extensions, and in any case I have no experience with developing them whatsoever. As far as I could understand, the script chrome\js\redirector.js fails to load because LocaleService is undefined, and the debugger just stops executing the main script after that error, so I suspect that's the culprit. LocaleService should be initialized in chrome\js\xpcom.js:

Code: Select all

const LocaleService = Service("@mozilla.org/intl/nslocaleservice;1", "nsILocaleService");
but I don't know what happens there. This file is not listed in the debugger, so I cannot do interactive debugging on it. alert() function and console object are undefined there. When I tried to simply run the same statement in the debugger console (with all the required initializations from xpcom.js before that line) it completed successfully and returned some valid object of type XPCWrappedNative_NoHelper, not undefined.

So I'm pretty much stuck here. Any help on either this particular extension, or general extension debugging techniques would be very appreciated.
Also, I'd like to hear if there is any better way to test modified extension, than to edit the files, re-pack them into XPI, reinstall the addon into PM, restart PM, reopen the debugger, reload the page…

And one more thing, is there some option that hides errors from console by default? When I go step-by-step in the script, execute the line

Code: Select all

Components.utils.import("chrome://redirector/content/js/redirector.js");
the debugger just suddenly returns from the script without saying anything. I had to manually copy-paste the same code into the console, run it there, and only then it displayed the error message:

Code: Select all

ReferenceError: LocaleService is not defined
Why did not it show this error during debugging?
Last edited by CaptainFlint on 2018-09-23, 11:18, edited 1 time in total.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: Redirector addon: stopped working since v28

Unread post by ketmar » 2018-09-23, 11:40

this is due to ecmascript standard changes. previously, top-level `const` and `let` were the same as `var`, and now they aren't.

that is, just replace all `const` in "chrome/js/xpcom.js" with `var`, and you're there.

p.s.: also, while i'm at it, there is a typo there. "PrefServie" should be "PrefService".
Last edited by ketmar on 2018-09-23, 11:45, edited 2 times in total.

CaptainFlint

Re: Redirector addon: stopped working since v28

Unread post by CaptainFlint » 2018-09-23, 11:49

Thanks, I've just now come to the same solution after some trial and error, but I didn't know why it worked. Now I understand what happened.

Still, the other questions remain the same. It would save me at least 3/4 of the time I spent if I did not have to reinstall the plugin, and re-run every code line in the console to see the actual error message. That's very frustrating, why is there a debugger if it does not tell the results of what I'm debugging?

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: Redirector addon: stopped working since v28

Unread post by ketmar » 2018-09-23, 12:03

standard "error console" from tools->web developer->error console shows error messages just fine. and you can even click at link and get to a faulty line from it.
Last edited by ketmar on 2018-09-23, 12:03, edited 2 times in total.

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: Redirector addon: stopped working since v28

Unread post by ketmar » 2018-09-23, 12:07

p.s.: also, the easiest way to show message in error console (the one i mentioned above) is this:

var conService = Components.classes["@mozilla.org/consoleservice;1"].getService(Components.interfaces.nsIConsoleService);
conService.logStringMessage("some string");

CaptainFlint

Re: Redirector addon: stopped working since v28

Unread post by CaptainFlint » 2018-09-23, 12:52

It's a bit strange that you have to open a separate independent tool to see what happens in the debugger, with JS in web pages the errors are displayed right in the console. But maybe this is some internal restriction of how the engine works with extensions…

OK, I will keep in mind that information for the future. Thank you for your help!

User avatar
ketmar
Lunatic
Lunatic
Posts: 369
Joined: 2015-07-28, 11:10
Location: Earth

Re: Redirector addon: stopped working since v28

Unread post by ketmar » 2018-09-23, 13:03

i simply has nothing to say about debugger, as i am not using debuggers at all. that is how i am doing debug (via printing), so that is all i can tell you. ;-)

riiis
Lunatic
Lunatic
Posts: 471
Joined: 2014-05-17, 15:51
Location: USA

Re: Redirector addon: stopped working since v28

Unread post by riiis » 2018-09-28, 15:47

Redirector version 3.0.4 appears compatible with Pale Moon 28.

To install, first click "Download Anyway" to download Redirector version 3.0.4 from AMO. Then install Redirector version 3.0.4 from the downloaded xpi file.
redirector.jpg

CaptainFlint

Re: Redirector addon: stopped working since v28

Unread post by CaptainFlint » 2018-09-28, 16:34

I actually tried 3.0.4 before writing the post, and I wanted to mention it but completely forgot. When I installed 3.0.4 its configuration page indeed was working OK, but the actual redirects were not. When I opened a page with a URL that should be redirected, it wasn't, just the original page was opened, as if no Redirector is installed. I don't know why, I didn't want to spend time on it, so I just rolled back to 2.9.3 (which I definitely knew had worked for me before) and started to investigate further.

User avatar
therube
Board Warrior
Board Warrior
Posts: 1651
Joined: 2018-06-08, 17:02

Re: Redirector addon: stopped working since v28

Unread post by therube » 2018-09-28, 19:47


riiis
Lunatic
Lunatic
Posts: 471
Joined: 2014-05-17, 15:51
Location: USA

Re: Redirector addon: stopped working since v28

Unread post by riiis » 2018-09-29, 03:19

CaptainFlint wrote:When I installed 3.0.4 its configuration page indeed was working OK, but the actual redirects were not. ... I just rolled back to 2.9.3 (which I definitely knew had worked for me before)
Redirector 3.0.4 worked for me.

Edit: Redirector 3.0.4 no longer works for me, but neither does Redirector 2.9.3. After fixing and installing 2.9.3, the 2.9.3 configuration page works. But like Redirector 3.0.4, the actual redirects no longer work. Skip Redirect Version 1.0.7 may be the only choice, for removing redirects in Pale Moon 28 , at this point.
Last edited by riiis on 2018-09-29, 13:21, edited 2 times in total.

User avatar
Greywool
Moonbather
Moonbather
Posts: 58
Joined: 2015-09-10, 10:45
Location: Finland

Re: Redirector addon: stopped working since v28

Unread post by Greywool » 2018-09-29, 18:30

ketmar wrote:this is due to ecmascript standard changes. previously, top-level `const` and `let` were the same as `var`, and now they aren't.

that is, just replace all `const` in "chrome/js/xpcom.js" with `var`, and you're there.

p.s.: also, while i'm at it, there is a typo there. "PrefServie" should be "PrefService".
Did this fix on 2.9.3 and imported the backed up Redirector.json (from standard 2.9.3 on PM27). As a result, the config page works and the redirects work.

Using Pale Moon 28.1.0 64bit on Win7

Unsure what I'm doing wrong or right for it to work flawlessly. Will post again if it manages to break again somehow. :P

Gave 3.0.4 a spin, but it didn't even get an 'Options' button in Add-ons Manager

Lew Rockwell Fan

Re: Redirector addon: stopped working since v28

Unread post by Lew Rockwell Fan » 2018-10-04, 06:53

ketmar wrote:this is due to ecmascript standard changes. previously, top-level `const` and `let` were the same as `var`, and now they aren't.

that is, just replace all `const` in "chrome/js/xpcom.js" with `var`, and you're there.

p.s.: also, while i'm at it, there is a typo there. "PrefServie" should be "PrefService".
Cool!!
Thanks. I had given up on this. therube was kind enough to point this thread out to me at the end of my older one. Here is a corrected xpi for anybody who'd rather not do it themselves:
redirector_fixed.xpi
(59.93 KiB) Downloaded 625 times

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

Re: Redirector addon: stopped working since v28

Unread post by Moonchild » 2018-10-04, 08:07

Okay, considering this is MIT/X11 licensed, you're in the green posting this here, but that's an exception. Usually we don't allow altered copies of extensions to be posted on the forum because of licensing/legal reasons - also, you need to remove the signing information from the extensions (META_INF) because it will now be a mismatch. For completeness, you should include a copy of the MIT/X11 license inside the extension as a LICENSE file (I had to go look it up through the extension homepage -> AMO to find this out.
"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

Lew Rockwell Fan

Re: Redirector addon: stopped working since v28

Unread post by Lew Rockwell Fan » 2018-10-04, 18:47

Oops. sorry. I forgot about those issues. I'll try to redo it correctly and repost it.

User avatar
Baloo
Fanatic
Fanatic
Posts: 167
Joined: 2017-08-24, 15:02

Re: Redirector addon: stopped working since v28

Unread post by Baloo » 2019-04-14, 13:07

Lew Rockwell Fan wrote:
ketmar wrote:this is due to ecmascript standard changes. previously, top-level `const` and `let` were the same as `var`, and now they aren't.

that is, just replace all `const` in "chrome/js/xpcom.js" with `var`, and you're there.

p.s.: also, while i'm at it, there is a typo there. "PrefServie" should be "PrefService".
Cool!!
Thanks. I had given up on this. therube was kind enough to point this thread out to me at the end of my older one. Here is a corrected xpi for anybody who'd rather not do it themselves:redirector_fixed.xpi
Thanks so much for this add-on! I was wondering why none of the Redirector installs were working in Classic Add-Ons manager. Can you properly sign this download and add it to the Pale Moon Add-Ons list?
Image
Image

Lew Rockwell Fan

Re: Redirector addon: stopped working since v28

Unread post by Lew Rockwell Fan » 2019-05-05, 20:17

I'll add that to my to-do list. Lessee . . . maybe around July 2030. Seriously, if I get back to fiddling with this sort of thing, and nobody had already done it, and I can figure out how, sure. In the meantime, whatever I contributed, consider it CC0 - meaning be my guest and do anything you like with it that's consistent with the original license.

I'm not trying to be snide. I realize people in the real world have to take law into account, if only to avoid penalties. I'm not really an IP radical, although if I could only choose between a world where the concept is radically abused and one with no IP law at all, I'd prefer the latter. Got too much on my plate now to take the time to become a Philadelphia lawyer, just to tinker with my browser. Not trying to p' anybody off, just explaining.

TMINY

Re: Redirector addon: stopped working since v28

Unread post by TMINY » 2019-12-05, 12:53

Lew Rockwell Fan wrote:
2018-10-04, 06:53
ketmar wrote:this is due to ecmascript standard changes. previously, top-level `const` and `let` were the same as `var`, and now they aren't.

that is, just replace all `const` in "chrome/js/xpcom.js" with `var`, and you're there.

p.s.: also, while i'm at it, there is a typo there. "PrefServie" should be "PrefService".
Cool!!
Thanks. I had given up on this. therube was kind enough to point this thread out to me at the end of my older one. Here is a corrected xpi for anybody who'd rather not do it themselves:redirector_fixed.xpi
This was working great until recently. Redirects aren't working... I noticed the preferences screen is empty of my rules and the buttons are non-responsive.

Anyone have any ideas on a fix? Thanks!

doofy
Astronaut
Astronaut
Posts: 650
Joined: 2017-08-14, 23:43

Re: Redirector addon: stopped working since v28

Unread post by doofy » 2019-12-05, 13:02

TMINY wrote:
2019-12-05, 12:53
This was working great until recently. Redirects aren't working... I noticed the preferences screen is empty of my rules and the buttons are non-responsive.
Anyone have any ideas on a fix? Thanks!
redirector_fixed is working here.
My only redirect works, as do buttons.

User avatar
Baloo
Fanatic
Fanatic
Posts: 167
Joined: 2017-08-24, 15:02

Re: Redirector addon: stopped working since v28

Unread post by Baloo » 2019-12-11, 04:33

Lew Rockwell Fan wrote:
2019-05-05, 20:17
I'll add that to my to-do list. Lessee . . . maybe around July 2030. Seriously, if I get back to fiddling with this sort of thing, and nobody had already done it, and I can figure out how, sure. In the meantime, whatever I contributed, consider it CC0 - meaning be my guest and do anything you like with it that's consistent with the original license.

I'm not trying to be snide. I realize people in the real world have to take law into account, if only to avoid penalties. I'm not really an IP radical, although if I could only choose between a world where the concept is radically abused and one with no IP law at all, I'd prefer the latter. Got too much on my plate now to take the time to become a Philadelphia lawyer, just to tinker with my browser. Not trying to p' anybody off, just explaining.
I find this statement humorous as someone studying to be a lawyer in Philadelphia...but no worries. Hope you're able to come back and fix it once more, as it seems something has broken redirector again. If anyone has any similar apps to use, I'm all ears. It stinks how it seems like the best add-ons, like IPassFox and Redirector have to be continually old versions to be functioning in Pale Moon these days. I don't know a damn thing about how to code unfortunately.
Image
Image

Locked