[RESOLVED] Some javascript not blocked?

Bug reports and enhancement requests
Post Reply
Peuc
Posts: 2
Joined: Fri Apr 25, 2014 6:37 pm

[RESOLVED] Some javascript not blocked?

Post by Peuc »

Hi,

I just noticed a behaviour of NoScript I cannot explain, so I report it there to get your though on this.
It seems some Google javascripts are still working no matter NoScript says it's blocked or not.

Steps to reproduce :
- Deactivate javascript globally, flush your white list, and so on...
- Go google.com and search anything
- On the result page, you'll notice the first time you pass you mouse cursor on a result title, the link brings to a Google redirection page.
- Move your cursor out
- When entering the title link again, the link is now direct to the website
Even if you don't move the cursor out, the link is rewritten when clicking.

Google is known to rewrite URLs when user clicks, but this is not supposed to work if NoScript blocks all javascript, so I suspect some kind of bug in NS.
Moreover this doesn't appear with javascript disabled in about:config.

I'm currently using NoScript version 2.6.8.20.

Any clue?
Last edited by Peuc on Fri Apr 25, 2014 7:26 pm, edited 1 time in total.
Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
barbaz
Senior Member
Posts: 11109
Joined: Sat Aug 03, 2013 5:45 pm

Re: Some javascript not blocked?

Post by barbaz »

not a "google" script
the cause is this default builtin surrogate script for google search pages

about:config -> noscript.surrogate.glinks.replacement

Code: Select all

for each(let et in ['focus','mouseover','mousedown','click'])addEventListener(et,function(e){var a=e.target,href=a.href&&a.getAttribute&&a.getAttribute('href');if(href&&/^(?:http|\/url)/.test(href)&&!a._href){a._href=a.href=a.href.replace(/.*\/url.*[?&](?:url|q)=(http[^&]+).*/,function(a,b)decodeURIComponent(b));do{if(/\brwt\(/.test(a.getAttribute('onmousedown')))a.removeAttribute('onmousedown')}while((a=a.parentElement))}},true)
.sources

Code: Select all

!@^https?://[^/]+google\..*/search
*Always* check the changelogs BEFORE updating that important software!
Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20100101 Firefox/17.0
Peuc
Posts: 2
Joined: Fri Apr 25, 2014 6:37 pm

Re: Some javascript not blocked?

Post by Peuc »

Nice, I wasn't aware of this rewriting feature.

Thank you for the explanation!
Mozilla/5.0 (X11; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
User avatar
Thrawn
Master Bug Buster
Posts: 3106
Joined: Mon Jan 16, 2012 3:46 am
Location: Australia
Contact:

Re: [RESOLVED] Some javascript not blocked?

Post by Thrawn »

If you know JavaScript, you can define your own surrogates, too. It's similar to Greasemonkey.
======
Thrawn
------------
Religion is not the opium of the masses. Daily life is the opium of the masses.

True religion, which dares to acknowledge death and challenge the way we live, is an attempt to wake up.
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0
Post Reply