Middle Click to Go Back stopped working again

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

Moderators: FranklinDM, Lootyhoof

User avatar
newbie123pm
Moongazer
Moongazer
Posts: 14
Joined: 2021-05-21, 00:02

Middle Click to Go Back stopped working again

Unread post by newbie123pm » 2022-10-03, 21:05

I got this modified addon somewhere and have been using it for some time.

It just stopped working awhile ago. (again)

I changed the maxVersion in the install.rdf to 39.* in case that was the problem.
That didn't do anything.
I don't know what to do.

This is the install.rdf:

Code: Select all

<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

<Description about="urn:mozilla:install-manifest">
	<em:id>MiddleClickToGoBack@lembas</em:id>
	<em:version>4.2022</em:version>
    	<em:type>2</em:type>
    	<em:targetApplication>
      	<Description>
        	<em:id>{8de7fcbb-c55c-4fbe-bfc5-fc555c87dbc4}</em:id>
        	<em:minVersion>27.0.0</em:minVersion>
        	<em:maxVersion>39.*</em:maxVersion>
      	</Description>
    	</em:targetApplication> 
	<em:name>Middle Click To Go Back</em:name>
	<em:description>Middle click on empty space to GO BACK.</em:description>
	<em:creator>lembas -- Pale Moon modded (WHD 2022)</em:creator>
	<em:optionsURL>chrome://middleclicktogoback/content/options.xul</em:optionsURL>
</Description>
</RDF>
I uncommented an alert in the content MiddleClickToGoBackClass.prototype.middleClick function
to see if it was even being executed and that is not showing.

Code: Select all

//wrapper class definition
function MiddleClickToGoBackClass(){}

//create the wrapper object
var middleClickToGoBackObject = new MiddleClickToGoBackClass();
//var xx = 0;

//this function fires Ctrl-Shift-T which opens the last closed tab
MiddleClickToGoBackClass.prototype.fireCtrlShiftT = function()
{
	var evt = document.createEvent("KeyEvents"); 
	evt.initKeyEvent(
		"keypress",//  in DOMString typeArg,
		true,//  in boolean canBubbleArg,     
		true,//  in boolean cancelableArg, 
		null,//  in nsIDOMAbstractView viewArg,  Specifies UIEvent.view. This value may be null.   
		true,//  in boolean ctrlKeyArg,   
		false,//  in boolean altKeyArg,     
		true,//  in boolean shiftKeyArg,      
		false,//  in boolean metaKeyArg,       
		0,//  in unsigned long keyCodeArg,   // evt.DOM_VK_DELETE        
		"T".charCodeAt(0)//  in unsigned long charCodeArg //"T".charCodeAt(0)	
	); 
	document.dispatchEvent(evt);
}

//this function handles middle-click
MiddleClickToGoBackClass.prototype.middleClick = function(mouseEvent)    // Define Method
{
	if(mouseEvent.button != 1)		
		return; 
	//alert("undo-close-tab= "+middleClickToGoBackObject.pref.getBoolPref("extensions.mctgb.undo-close-tab"));

	var t = mouseEvent.target;
	alert("middle-clicked on\nt="+t+"\n"+"t.id="+t.id+"\nt.getAttribute('href')="+t.getAttribute('href')+"\nt.innerWidth="+t.innerWidth+"\nwindow.innerWidth="+window.innerWidth+"\nt.offsetWidth="+t.offsetWidth+"\nwindow.offsetWidth="+window.offsetWidth);

	//alert("firefox4");
	//alert("t.id == tabbrowser-tabs"+ (t.id == "tabbrowser-tabs"));
	//alert("t instanceof XULElement"+t instanceof XULElement);

	try{
		if(middleClickToGoBackObject.pref.getBoolPref("extensions.mctgb.undo-close-tab") && (t.id == "titlebar-content" || t.id == "tabbrowser-tabs") && t instanceof XULElement){
			//alert("fireCtrlShiftT");
			mouseEvent.preventDefault();
			mouseEvent.stopPropagation();
			middleClickToGoBackObject.fireCtrlShiftT();
		}
		else{
			//alert(xx++);
			var doReturn = 0;
			try{
				var isTextBox = ((window.innerWidth - t.offsetWidth) > 30);//gmail ve yahoo'daki compose mail kismini diger sayfalardaki kisa html'lerin son kismindan ayirmak i�in
				
				if(t instanceof HTMLEmbedElement || (t instanceof HTMLHtmlElement && isTextBox) || t instanceof XULElement || t instanceof HTMLIFrameElement || t instanceof HTMLTextAreaElement || t instanceof HTMLInputElement || t.getAttribute('href')!=null || t.parentNode.getAttribute('href')!=null || t.parentNode.parentNode.getAttribute('href')!=null || t.parentNode.parentNode.parentNode.getAttribute('href')!=null){
					//alert("doing nothing\nt="+t+"\n"+"t.id="+t.id+"\n");
					doReturn = 1;
				}
				else{
					//alert("doing something");
				}			
			}
			catch(err){
				//alert("error: "+err);
			}
			finally{
				//alert(xx++);
				if(doReturn){
					//alert(xx++);
					return;
				}
				if(getWebNavigation().canGoBack && middleClickToGoBackObject.pref.getCharPref("extensions.mctgb.go-back")!="2"){
					//alert("goBack \n");
					mouseEvent.preventDefault();
					mouseEvent.stopPropagation();
					getWebNavigation().goBack();
				}
				else if(middleClickToGoBackObject.pref.getCharPref("extensions.mctgb.go-back")=="0"){
					//alert("finally removeCurrentTab \n");
					mouseEvent.preventDefault();
					mouseEvent.stopPropagation();
					gBrowser.removeCurrentTab();
				}
			}
		}
	}
	catch(errr){
		//alert("errror: "+errr);
	}	
}

//MiddleClickToGoBackClass.prototype.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);

MiddleClickToGoBackClass.prototype.pref = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);

//MiddleClickToGoBackClass.prototype.pref = Components.interfaces["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService).QueryInterface(Components.interfaces.nsIPrefBranch);

//catches the middle-click
//true: event propagates from document to link(useCapture), 
//false: event propagates from link to document(useBubbling)
document.addEventListener("click", middleClickToGoBackObject.middleClick, true);
So I suppose it may not be easily fixable like it has been in the past.

Any suggestions or help would be appreciated.

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: Middle Click to Go Back stopped working again

Unread post by vannilla » 2022-10-03, 21:54

See if the error console (the menu entry says "Error Console" and it's different from the web console) says something about the add-on.
If you are in doubt, restart the browser, open the console and paste all its contents here on the forum so that we can take a look.

User avatar
newbie123pm
Moongazer
Moongazer
Posts: 14
Joined: 2021-05-21, 00:02

Re: Middle Click to Go Back stopped working again

Unread post by newbie123pm » 2022-10-05, 19:40

Thanks. I had forgotten about that for some reason.
I was looking at some other console thing that had no messages in it.

This is the error:

No chrome package registered for chrome://middleclicktogoback/locale/middleclicktogoback.dtd

I don't know what that means.

There is no file by that name or a reference to "middleclicktogoback.dtd" or "dtd" in any of the files.

This is the contents of chrome.manifest:

Code: Select all

content middleclicktogoback chrome/content/
overlay chrome://browser/content/browser.xul chrome://middleclicktogoback/content/middleclicktogoback.xul
These are the files and directory structure from the .XPI:

Code: Select all

Middle Click To Go Back extension 2022 ["root"]

10/02/2022  04:31 PM    <DIR>          chrome
10/30/2007  02:16 AM               150 chrome.manifest
10/02/2022  04:31 PM    <DIR>          defaults
10/03/2022  01:17 PM               850 install.rdf
10/02/2022  04:31 PM    <DIR>          META-INF

Middle Click To Go Back extension 2022\chrome

10/02/2022  04:31 PM    <DIR>          content

Middle Click To Go Back extension 2022\chrome\content

10/03/2022  01:19 PM             4,270 middleclicktogoback.js
01/29/2011  02:44 PM               313 middleclicktogoback.xul
01/23/2014  08:12 AM             1,061 options.xul

Middle Click To Go Back extension 2022\defaults

10/02/2022  04:31 PM    <DIR>          preferences

Middle Click To Go Back extension 2022\defaults\preferences

04/27/2011  05:03 AM               210 middleclicktogoback.js

Middle Click To Go Back extension 2022\META-INF

03/21/2016  05:06 PM               883 manifest.mf
03/21/2016  05:06 PM             4,183 mozilla.rsa
03/21/2016  05:06 PM               121 mozilla.sf

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: Middle Click to Go Back stopped working again

Unread post by vannilla » 2022-10-05, 22:29

Can you post the contents of the XUL file?
The error is due exactly because the DTD is missing and the XUL file should hold some answers if not the solution.

User avatar
moonbat
Knows the dark side
Knows the dark side
Posts: 4942
Joined: 2015-12-09, 15:45
Contact:

Re: Middle Click to Go Back stopped working again

Unread post by moonbat » 2022-10-05, 22:34

Your XUL file should have a line like this near the top -

Code: Select all

<!DOCTYPE overlay SYSTEM "chrome://middleclicktogoback/locale/middleclicktogoback.dtd">
"One hosts to look them up, one DNS to find them and in the darkness BIND them."

Image
Linux Mint 21 Xfce x64 on HP i5-5200 laptop, 12 GB RAM.
AutoPageColor|PermissionsPlus|PMPlayer|Pure URL|RecordRewind|TextFX

Blacklab
Board Warrior
Board Warrior
Posts: 1080
Joined: 2012-06-08, 12:14

Re: Middle Click to Go Back stopped working again

Unread post by Blacklab » 2022-10-06, 15:15

newbie123pm wrote:Any suggestions or help would be appreciated
Have you thought of going about this another way? If you are on Windows you could install a small utility like X-Mouse or similar that will allow you to vary your mouse button functions for every application you have installed?

Bit of a sledgehammer to crack a nut perhaps... and X-Mouse's capabilities and setup instructions look intimidating at first glance... but you can very easily setup a 'Middle Click to go Back' override instruction that applies only to your Pale Moon installation. :)

X-Mouse Setup -  Middle Click set to 'Back in Pale Moon.jpg
X-Mouse Setup page - showing 'Middle Click' set to 'Back' in Pale Moon.

PC World article 'Do More With Your Middle Mouse Button': https://www.pcworld.com/article/465103/ ... utton.html
X-Mouse Button Control Home Page: https://www.highrez.co.uk/downloads/XMo ... ontrol.htm
X-Mouse FAQs: https://forums.highrez.co.uk/viewtopic.php?f=6&t=101
X-Mouse User Guide PDF(download link): https://vps2.highrez.co.uk/downloads/X- ... 0Guide.pdf

--------------------

Note 1: When installed the X-Mouse programme will appear in your 'All Programs' list under 'Highresolution Enterprises'... and also as a 'mouse' icon in your taskbar notification area if required.
Note 2: Overriding the normal middle click function in Pale Moon will mean that middle click to close a tab or open a new tab will not work. X-mouse does have more complex options that can restrict the override to a particular area of an application window.

Blacklab
Board Warrior
Board Warrior
Posts: 1080
Joined: 2012-06-08, 12:14

Re: Middle Click to Go Back stopped working again

Unread post by Blacklab » 2022-10-06, 22:14

newbie123pm wrote:I got this modified addon somewhere and have been using it for some time.
It just stopped working awhile ago. (again)
I changed the maxVersion in the install.rdf to 39.* in case that was the problem.
That didn't do anything. I don't know what to do.
@newbie123pm: You didn't say exactly which version of the 'Middle Click To Go Back (MCTGB)' Addon you had started from (your install.rdf above now says version 4.2022 ?)... or where you got it from... or how it had been modified previously? :silent: Just that it had stopped working... again. :thumbdown:

On the off-chance that you weren't using the latest 'pre-Web Extensions' version of 'MCTGB' I did some searching to see what was still available. Eventually, with a little luck, found a snapshot of MCTGB's old AMO page with live 'old versions' links in WayBackMachine (WBM). The last version that would have been compatible with Pale Moon was 'middle_click_to_go_back-4.2-fx-windows.xpi' released in March 2016.

MCTGB v4.2 can still be downloaded using WBM... and AFAICS it works correctly when tested on a clean Pale Moon profile? :thumbup: :)
The old style AMO 'About this extension' notes for MCTGB v4.2 are also available via WBM.
The install.rdf file for v4.2 attached below looks like this:

Code: Select all

<?xml version="1.0"?>

<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
     xmlns:em="http://www.mozilla.org/2004/em-rdf#">

<Description about="urn:mozilla:install-manifest">
	<em:id>MiddleClickToGoBack@lembas</em:id>
	<em:version>4.2</em:version>
    	<em:type>2</em:type>
    	<em:targetApplication>
      	<Description>
        	<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
        	<em:minVersion>4.0</em:minVersion>
        	<em:maxVersion>45.*</em:maxVersion>
      	</Description>
    	</em:targetApplication> 
	<em:name>Middle Click To Go Back</em:name>
	<em:description>Middle click on empty space to go back.</em:description>
	<em:creator>lembas</em:creator>
	<em:optionsURL>chrome://middleclicktogoback/content/options.xul</em:optionsURL>
</Description>
</RDF>
Attachments
middle_click_to_go_back-4.2-fx-windows.xpi
(8.62 KiB) Downloaded 11 times

User avatar
newbie123pm
Moongazer
Moongazer
Posts: 14
Joined: 2021-05-21, 00:02

Re: Middle Click to Go Back stopped working again

Unread post by newbie123pm » 2022-10-07, 07:29

I don't know why it would suddenly want a DTD file. Nothing has changed for years and
it worked up until a couple of months ago.

This is middleclicktogoback.xul :

Code: Select all

<?xml version="1.0"?>
<!DOCTYPE overlay SYSTEM "chrome://middleclicktogoback/locale/">
<overlay id="middleclicktogoback" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script type="application/x-javascript" src="chrome://middleclicktogoback/content/middleclicktogoback.js"/>
</overlay>
This is based on afaik the last 4.2 version, which I'm pretty sure was middle_click_to_go_back-4.2-fx-windows.xpi,
which stopped working in PaleMoon years ago, thereby the required changes.
The file had been renamed to 42b to show that it had been modified.
I renamed it to 2022 to show that it had been modified again with my changes.

I can try the original again and see if it now works for some reason.

Thanks for the help and info and suggestions.

Here is the current .XPI:
Attachments
Middle Click To Go Back extension 2022.xpi
(8.52 KiB) Downloaded 3 times

vannilla
Moon Magic practitioner
Moon Magic practitioner
Posts: 2183
Joined: 2018-05-05, 13:29

Re: Middle Click to Go Back stopped working again

Unread post by vannilla » 2022-10-07, 07:33

Try to remove the line that says

Code: Select all

<!DOCTYPE overlay SYSTEM "chrome://middleclicktogoback/locale/">

User avatar
newbie123pm
Moongazer
Moongazer
Posts: 14
Joined: 2021-05-21, 00:02

Re: Middle Click to Go Back stopped working again

Unread post by newbie123pm » 2022-10-07, 07:42

I removed the extension, restarted, then restarted again, and installed the
middle_click_to_go_back-4.2-fx-windows.xpi
then restarted again and it doesn't work and the Error Console is showing that same DTD error.

I do have the latest PM version 31.3.0.1 (32 bit), FTR.

Blacklab
Board Warrior
Board Warrior
Posts: 1080
Joined: 2012-06-08, 12:14

Re: Middle Click to Go Back stopped working again

Unread post by Blacklab » 2022-10-07, 10:07

newbie123pm wrote:I removed the extension, restarted, then restarted again, and installed the
middle_click_to_go_back-4.2-fx-windows.xpi
then restarted again and it doesn't work and the Error Console is showing that same DTD error.
Odd that the unaltered 'middle_click_to_go_back-4.2-fx-windows.xpi' posted above doesn't work for you? :problem:
Tested here using latest Pale Moon 31.3.0.1 (32-bit) on Windows 7 and Pale Moon 31.3.0.1 (64-bit) on Windows 10.
Test intalls on Win7 and Win10 tried on both my normal Pale Moon profile and on a completely clean Pale Moon profile.
All 4 tested instances of MCTGB v4.2 loaded and ran normally... no errors seen... and, AFAICS, all worked as expected. :thumbup:

Suspect you may have a conflict with another extension and/or possibly some corruption of your normal Pale Moon profile?
Try running the unaltered 'middle_click_to_go_back-4.2-fx-windows.xpi' on a clean Pale Moon profile. :)

PS. FWIW - Confirmed that your modified version of the Addon 'Middle Click To Go Back extension 2022.xpi' (posted above) does not work on Pale Moon 31.3.0.1. When tested Browser Console shows same error: 'No chrome package registered for chrome://middleclicktogoback/locale/middleclicktogoback.dtd'. Not tested on any older Pale Moon versions.

Locked