Clean Links - disappearing button

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

Moderators: FranklinDM, Lootyhoof

_yuyu_
Lunatic
Lunatic
Posts: 253
Joined: 2015-03-02, 14:18

Re: Clean Links - disappearing button

Unread post by _yuyu_ » 2018-09-21, 17:08

It would be great to toggle extensions.cleanlinks.enabled state by a CustomButton script, but as far as I know, it affects only on/off state, i.e. yellow/grey icon.
Pale Moon 32-bit on Win 7 x64

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

Re: Clean Links - disappearing button

Unread post by riiis » 2018-09-21, 17:43

Try changing line 34 of browser.js. ("cleanlinks = {" does not look like a constant to me).

Change from:

Code: Select all

const cleanlinks = {
Change to:

Code: Select all

var cleanlinks = {
Note that the Clean Links toolbar button is stable (doesn't disappear) on my installation of PM28. However, I had not used the Clean Links extension, prior to today and prior to this change. Accordingly, this change may not continue to work long-term or for other users.

User avatar
Kruppt
Apollo supporter
Apollo supporter
Posts: 47
Joined: 2018-07-23, 22:32

Re: Clean Links - disappearing button

Unread post by Kruppt » 2018-09-22, 04:08

riiis wrote:Try changing line 34 of browser.js. ("cleanlinks = {" does not look like a constant to me).

Change from:

Code: Select all

const cleanlinks = {
Change to:

Code: Select all

var cleanlinks = {
Note that the Clean Links toolbar button is stable (doesn't disappear) on my installation of PM28. However, I had not used the Clean Links extension, prior to today and prior to this change. Accordingly, this change may not continue to work long-term or for other users.
Thanks ...this works for me on PM v 28.1 32 bit running on GNU/Linux and same for 64 bit (on toolbar)

50addons

Re: Clean Links - disappearing button

Unread post by 50addons » 2018-09-22, 07:40

Kruppt wrote:
riiis wrote:Try changing line 34 of browser.js.
Thanks ...this works for me on PM v 28.1 32 bit running on GNU/Linux and same for 64 bit (on toolbar)
Kruppt, can you confirm that the disaeppering button problem disappeared for you after the code change?

Having previously tested CleanLinks in conjunction with several other extensions, it was specifically the presence of the FoxyProxy extension that made the button disappear on startup persistently. If I disable FoxyProxy the CleanLinks button automatically appears at next browser startup.

Although it is this specific extension combination that causes a problem for CleanLinks, note that the combination of these two extensions (same versions) did not cause a problem in Firefox 45ESR. So, there is something in Pale Moon 28 that causes a difference at startup.

Note: that when the button that disappears at startup CleanLinks is in disabled state.

PS: I also tried this with Pale Mon 28.1.0: makes no difference.
Last edited by 50addons on 2018-09-22, 08:44, edited 3 times in total.

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

Re: Clean Links - disappearing button

Unread post by Moonchild » 2018-09-22, 08:47

The suggested fix indicates that the extension isn't taking into account that we now use a global JS scope. Using 'let' or 'const' at the top level will no longer work properly (if you expect isolation) as a result and if there are name conflicts they will not be resolved on a modular level, but globally (usually first come first serve). Foxyproxy may introduce a name conflict.
Last edited by Moonchild on 2018-09-22, 08:47, edited 1 time in total.
"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

50addons

Re: Clean Links - disappearing button

Unread post by 50addons » 2018-09-22, 08:57

Moonchild wrote:The suggested fix indicates that the extension isn't taking into account that we now use a global JS scope. [...] Foxyproxy may introduce a name conflict.
Thanks for a great explanation. I'll check this out.
Off-topic:
Everytime I see your avatar I wonder: do you actually have a dog?

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

Re: Clean Links - disappearing button

Unread post by Moonchild » 2018-09-22, 09:52

Off-topic:
50addons wrote:Everytime I see your avatar I wonder: do you actually have a dog?
For most of my life. Currently I don't since my dog passed away earlier this year.
"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

50addons

Re: Clean Links - disappearing button

Unread post by 50addons » 2018-09-22, 19:48

Off-topic:
Moonchild wrote:
50addons wrote:Everytime I see your avatar I wonder: do you actually have a dog?
For most of my life. Currently I don't since my dog passed away earlier this year.
Och, thats' sad. They really are our best friends.
Moonchild wrote:The suggested fix indicates that the extension isn't taking into account that we now use a global JS scope. [...] Foxyproxy may introduce a name conflict.
If there was a name conflict, why then is it possible to manually enable CleanLinks after startup so both extensions work concurrently?
I tried the suggested fix but it didn't work.

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

Re: Clean Links - disappearing button

Unread post by riiis » 2018-09-23, 18:44

50addons wrote:If there was a name conflict, why then is it possible to manually enable CleanLinks after startup so both extensions work concurrently? I tried the suggested fix but it didn't work.
The "cleanlinks" variable is a "wrapper". It wraps lines 34 through 645 of "browser.js" into a single variable name (effectively preventing variable or function names (enclosed within lines 34 through 645) from conflicting with names used by other extensions).

Sorry the suggested fix, above, did not work for you. Following is another possible fix you might try.

I found 3 instances where the Clean Links code checks for browser version. The following code changes remove these version checks, removing a possible source of the errors you're experiencing.

Change lines 25 through 32 of browser.js (removes check for versions > 29 ).
Change from:

Code: Select all

try {
	let {XPIProvider:xS} = Cu.import('resource://gre/modules/'
	+(parseInt(Services.appinfo.version)>29?'addons/':'')+'XPIProvider.jsm', {});
	if((xS = xS.bootstrapScopes['{c9d31470-81c6-4e3e-9a37-46eb9237ed3a}']))
		handledElsewhere = function(n) !!xS.getProvider(n,xS.getPrefs());
} catch(e) {
	Cu.reportError(e);
}
Change to:

Code: Select all

try {
	let {XPIProvider:xS} = Cu.import('resource://gre/modules/'
	+('')+'XPIProvider.jsm', {});
	if((xS = xS.bootstrapScopes['{c9d31470-81c6-4e3e-9a37-46eb9237ed3a}']))
		handledElsewhere = function(n) !!xS.getProvider(n,xS.getPrefs());
} catch(e) {
	Cu.reportError(e);
}
Change lines 570 through 575 of bootstrap.js (removes check for versions > 29 ).
Change from:

Code: Select all

			: (
				// TODO: SeaMonkey..
				parseInt(Services.appinfo.version) > 29
					? new copyLinkController30(window)
					: new copyLinkController(window)
			);
Change to:

Code: Select all

			: (
					new copyLinkController(window)
			);
Change lines 407 through 414 of bootstrap.js (removes references to CustomizableUI).
Change from:

Code: Select all

XPCOMUtils.defineLazyGetter(this, 'aUI', function() {
	if (3!=ia) try {
		var { CustomizableUI } = Cu.import('resource:///modules/CustomizableUI.jsm', {});
	} catch(e) {
		Cu.reportError(e);
	}
	return typeof CustomizableUI !== 'undefined' && CustomizableUI;
});
Change to:

Code: Select all

XPCOMUtils.defineLazyGetter(this, 'aUI', function() {
});

50addons

Re: Clean Links - disappearing button

Unread post by 50addons » 2018-09-23, 20:15

riiis wrote:Sorry the suggested fix, above, did not work for you. Following is another possible fix you might try.
@riiis, thank you very much for all your help!

I just applied these changes and installed the new CleanLinks in my test profile, which only contains the two extensions (CleanLinks + FoxyProxy).
As before, I can bring CleanLinks and its button back with the disable/enable sequence.

The error message on startup has indeed disappeared. However, after startup CleanLinks is deactivated and the button is not there.
I am not convinced that the error messages I posted above have anything to do with the startup problem.

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

Re: Clean Links - disappearing button

Unread post by riiis » 2018-09-25, 18:35

50addons wrote:I just applied these changes and installed the new CleanLinks in my test profile, which only contains the two extensions (CleanLinks + FoxyProxy).
As before, I can bring CleanLinks and its button back with the disable/enable sequence.
I looked at this issue one more time. IMO it would probably be easier to write a new extension from scratch, to do what Clean Links does, than to fix Clean Links for FoxyProxy.

As an alternative add-on to Clean Links, you might try Pure URL (version 1.2.6). Pure URL 1.2.6 appears to be compatible with Pale Moon 28, even though AMO lists Pure URL 1.2.6 as not compatible. To install, first download Pure URL 1.2.6 from AMO. Then install Pure URL from the downloaded xpi file. Note that "Pure URL Version 1.2.4.1-signed.1-signed" is shown as compatible with Pale Moon, but really isn't compatible. Pale Moon 28 actually installed version 1.2.4 on my computer, even though it contains a "harness-options.json" file (i.e. old sdk no longer supported by Pale Moon).

The Clean Links website states that Clean Links "Converts obfuscated/nested links to genuine clean links". Ironically, Clean Links can not be easily fixed for FoxyProxy, primarily because the Clean Links xpi file includes vast quantities of obfuscated/nested javascript (rather than genuine "clean" javascript).

50addons

Re: Clean Links - disappearing button

Unread post by 50addons » 2018-09-25, 21:54

riiis wrote:I looked at this issue one more time. IMO it would probably be easier to write a new extension from scratch, to do what Clean Links does, than to fix Clean Links for FoxyProxy.
It's a shame because CleanLinks had a few good features but it does seem rather convoluted.
Many thanks for all your help.

Locked