No Script conflicting with "S3.Google Translate" addon

Ask for help about NoScript, no registration needed to post
SergeGardien
Posts: 18
Joined: Fri Jan 02, 2015 12:10 am

No Script conflicting with "S3.Google Translate" addon

Post by SergeGardien »

I've just installed the S3.Google Translate addon (https://addons.mozilla.org/en-US/firefo ... ranslator/) to enable websites auto-translation under Firefox in a similar fashion to what happens in Google Chrome (for a better explanation of what I'm trying to achieve read the post at http://forums.mozillazine.org/viewtopic ... &t=3031479).

I was having some issues with the auto-translation feature of S3.Google Translate hence I disabled No Script. I was guessing that No Script "anti-XSS" (cross-site scripting) could interfere with that plugin even without any warning.

In effect, now that I disabled No Script, S3.Google Translate activates the auto-translation much more often.
I've also posted an help request on S3.Google Translate thread on forum.mozillazine.org (http://forums.mozillazine.org/viewtopic ... #p14754784)

Can you please help me sorting out what's the specific conflict here?
S3.Google Translate uses the Google API to ask and provide a translation for the website hence I guess that No Script blocks such requests.
How can I disable such block for this specific addon?
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:54.0) Gecko/20100101 Firefox/54.0
barbaz
Senior Member
Posts: 10841
Joined: Sat Aug 03, 2013 5:45 pm

Re: No Script conflicting with "S3.Google Translate" addon

Post by barbaz »

That dev has a history of writing addons that mess with NoScript internals. So I did some digging and found this code -

Code: Select all

s3gt.utils.check_noscript = function(win, domain, is_confirm) {
	var is_change_rule = false;
	//-----------------------------------------------------------------------------------
	// check NoScript (Giorgio Maone <g.maone@informaction.com>)
	// https://addons.mozilla.org/ru/firefox/addon/noscript/?src=ss
	//-----------------------------------------------------------------------------------
	try {
		if ("noscriptOverlay" in window) {
			var confirm_res = true;
			//----------------------------------------------------------------------
			// it's enabled, which happens also if just domain is whitelisted
			//----------------------------------------------------------------------
			if (noscriptOverlay.ns.isJSEnabled(domain)) {
				// good!
			}
			else {
				if (is_confirm) {
					var confirm_txt = s3gt.utils.get_string('s3gt.confirm.translate.full.page.noscript');
					confirm_txt = confirm_txt.replace("DOMAIN", '"' + domain + '"');
					confirm_res = confirm(confirm_txt);
				}
				if (confirm_res) {
					//----------------------------------------------------------
					// temporarily added site in NoScript-White-List
					//----------------------------------------------------------
					noscriptOverlay.ns.setTemp(domain, true);
					noscriptOverlay.ns.setJSEnabled(domain, true);
					is_change_rule = true;
				}
			}
			//----------------------------------------------------------------------
			//-- temporarily added: translate.googleapis.com, translate.google.com, translate.google.cn
			//----------------------------------------------------------------------
			if (confirm_res) {
				var domain_list = ['translate.googleapis.com', 'translate.google.com', 'translate.google.cn'];
				for (var d=0; d<domain_list.length; d++) {
					if (! noscriptOverlay.ns.isJSEnabled(domain_list[d])) {
						noscriptOverlay.ns.setTemp(domain_list[d], true);
						noscriptOverlay.ns.setJSEnabled(domain_list[d], true);
						is_change_rule = true;
					}
				}
			}
			if (is_change_rule) {
				noscriptOverlay.ns.quickReload(win);
			}
		}
	} catch(e) {
	}

	return is_change_rule;
}
At least this one prompts explicitly before touching the NoScript permissions. Image

Looks like you need to Temp-Allow the top-level site as well as Allow some google translate domains.
*Always* check the changelogs BEFORE updating that important software!
-
SergeGardien
Posts: 18
Joined: Fri Jan 02, 2015 12:10 am

Re: No Script conflicting with "S3.Google Translate" addon

Post by SergeGardien »

barbaz wrote:Looks like you need to Temp-Allow the top-level site as well as Allow some google translate domains.
Many thanks for the reply barbaz.
I've whitelisted translate.google.cn in No Script (translate.googleapis.com and translate.google.com where already there).
Regarding the top-level sites I had them already enabled (not all the javascripts in the website tho) but I still have some issues. I will try to check and sort on a case-by-case basis.

I will let you know in case of updates.

All the best,
SergeGardien
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:54.0) Gecko/20100101 Firefox/54.0
Post Reply