uBlock icon indicating copy to clipboard operation
uBlock copied to clipboard

Middle clicking on a link triggers popup rule, but only since updating to webext-hybrid.

Open Okamoi opened this issue 9 years ago • 9 comments

Describe the issue

When middle clicking on a link that directs to a site blocked from opening pop ups by a filter, this link does not open. It is treated like a pop up instead of a new tab, and this only happens since 1.13.10.

One or more specific URLs where the issue occurs

anilinkz.to/anime-list

Steps for anyone to reproduce the issue

  1. Enable (FRA) Liste FR, or alternatively add custom filter ||anilinkz.$first-party,popup
  2. Open uBO's logs
  3. Go to anilinkz.to/anime-list
  4. Middle click on any anime on the list
  5. See how the tab is killed and logs report the filter described above as the culprit

Your settings

  • OS/version: Windows 7 64-bit
  • Browser/version: Firefox 55.0.2 32-bit
  • uBlock Origin version: 1.13.10

Okamoi avatar Aug 29 '17 14:08 Okamoi

It has been a long time I played with that code, but I believe uBO was disregarding that the link was clicked by the user because it was not possible on Chromium to detect whether a click was the result of the user clicking, or whether it was programmatically triggered by nasty javascript code.

Looking at current MDN documentation, it says that the isTrusted property is now supported by Chromium, since version 46. So I guess I can just go ahead and now take into account the isTrusted property.

gorhill avatar Aug 29 '17 15:08 gorhill

Sounds good! Do you have some automated test cases or something to help you test for feature parity between the legacy version of uBO and the WebExt ?

Since that one seems to be a port from the Chrome version, there could be several such tiny things, some of which unnoticeable by users. And manual testing sounds like a daunting task...

Okamoi avatar Aug 29 '17 17:08 Okamoi

The issue still occurs (on a fresh browser profile + uBO):

FF 55.0.3 32bit + uBO v1.14.9b0 FF 56.0b9 64bit + uBO v1.14.9b0 Opera 47.0.2631.71 (PGO) 64bit + uBO v1.14.9.0 Windows 7 SP1 U 64bit

gomoku avatar Sep 06 '17 15:09 gomoku

See https://forums.lanik.us/viewtopic.php?p=125336#p125336

If you middle click the first link the tab opens and then closes due to this filter: ||iqoption.com/land/$third-party,popup

As you arrive on that page through isTrusted action it shouldn't be considered as third-party object

mapx- avatar Oct 04 '17 17:10 mapx-

When I click the link, a new tab opens with Google Search page. Without an actual repro case, I can't investigate.

gorhill avatar Oct 04 '17 17:10 gorhill

When I middle click the link I see this in the logger: pop1

mapx- avatar Oct 04 '17 18:10 mapx-

What link exactly? I tried the one you posted above, "first link", and can't reproduce any closed popup:

a

But anyways, from your screenshot, the popup was properly closed, because the URL of the popup changed from the one clicked by the user, which is what the fix is here. The 3rd-partyness is properly evaluated in this case, the 1st party is still the URL of the tab from where the popup was opened.

gorhill avatar Oct 04 '17 18:10 gorhill

Weird ..: if I middle click https://affiliate.iqoption.com/redir/?aff=2354 it means I'm already on the iqoption domain, right ? Then the redirect seems to transform itself in https://iqoption.com/land/regulated/en/ triggering this filter: ||iqoption.com/land/$third-party,popup

How could be third-party if first landed on the same domain ? Probably I'm missing something ?!

mapx- avatar Oct 04 '17 18:10 mapx-

The party-ness is always opener tab vs opened tab, regardless of redirection (however this redirection happens). The opener tab in the current case is always github.com -- that is my understanding of popup filter option.

If I understand the case here, the reporter on EasyList forum argues that the redirection to same domain as the trusted URL's one should not trigger popup filter.

gorhill avatar Oct 04 '17 19:10 gorhill