Redirector addon: stopped working since v28

General discussion, compatibility and contributed extensions.

Moderators: satrow, Lootyhoof, FranklinDM

User avatar
CaptainFlint
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2018-02-04, 11:54
Location: Moscow, Russia

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: 360
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.

User avatar
CaptainFlint
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2018-02-04, 11:54
Location: Moscow, Russia

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: 360
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: 360
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");

User avatar
CaptainFlint
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2018-02-04, 11:54
Location: Moscow, Russia

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: 360
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: 445
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

User avatar
CaptainFlint
Hobby Astronomer
Hobby Astronomer
Posts: 16
Joined: 2018-02-04, 11:54
Location: Moscow, Russia

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: 1101
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: 445
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: 55
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
Fanatic
Fanatic
Posts: 174
Joined: 2017-06-14, 15:20

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 157 times
"To attempt to silence a man is to pay him homage, for it is an acknowledgement that his arguments are both impossible to answer and impossible to ignore." - John Bryant

User avatar
Moonchild
Pale Moon guru
Pale Moon guru
Posts: 24817
Joined: 2011-08-28, 17:27
Location: 58°2'16"N 14°58'31"E
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.
"If you want to build a better world for yourself, you have to be willing to build one for everybody." -- Coyote Osborne
Image

Lew Rockwell Fan
Fanatic
Fanatic
Posts: 174
Joined: 2017-06-14, 15:20

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.
"To attempt to silence a man is to pay him homage, for it is an acknowledgement that his arguments are both impossible to answer and impossible to ignore." - John Bryant

User avatar
Baloo
Apollo supporter
Apollo supporter
Posts: 38
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
Fanatic
Fanatic
Posts: 174
Joined: 2017-06-14, 15:20

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.
"To attempt to silence a man is to pay him homage, for it is an acknowledgement that his arguments are both impossible to answer and impossible to ignore." - John Bryant

Post Reply