No Script conflicting with "S3.Google Translate" addon

Ask for help about NoScript, no registration needed to post

No Script conflicting with "S3.Google Translate" addon

Postby SergeGardien » Tue Jul 04, 2017 8:33 pm

I've just installed the S3.Google Translate addon (https://addons.mozilla.org/en-US/firefox/addon/s3google-translator/) 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.php?f=8&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.php?f=48&t=2829503&p=14754784&hilit=+no+script+#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
SergeGardien
 
Posts: 18
Joined: Fri Jan 02, 2015 12:10 am

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

Postby barbaz » Tue Jul 04, 2017 10:01 pm

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!
Board search is currently partially broken: https://forums.informaction.com/viewtopic.php?f=14&t=21752
Workaround: use your favorite search engine, add site:forums.informaction.com to your query
-
barbaz
Senior Member
 
Posts: 7102
Joined: Sat Aug 03, 2013 5:45 pm

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

Postby SergeGardien » Wed Jul 05, 2017 1:01 pm

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
SergeGardien
 
Posts: 18
Joined: Fri Jan 02, 2015 12:10 am


Return to NoScript Support

Who is online

Users browsing this forum: yes_noscript and 6 guests