Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

m.acestream.net popup #10323

Closed
8 tasks done
fakelok76 opened this issue Oct 26, 2021 · 68 comments
Closed
8 tasks done

m.acestream.net popup #10323

fakelok76 opened this issue Oct 26, 2021 · 68 comments
Labels

Comments

@fakelok76
Copy link

fakelok76 commented Oct 26, 2021

Prerequisites

I tried to reproduce the issue when...

  • uBO is the only extension
  • uBO with default lists/settings
  • using a new, unmodified browser profile

Description

Please add a scriptlet to close already open windows. Ace Stream opens a browser tab with ads. Add the ability to close already open windows. I beg your pardon for poor English.

A specific URL where the issue occurs

https://m.acestream.net/plan/select?popup=noads

Steps to Reproduce

Launch the ACE Stream program, which allows you to watch p2p broadcasts.

Expected behavior

// ==UserScript==
// @name Acestream close
// @Version 1
// @include https://m.acestream.net/plan/select?popup=noads
// @grant window.close
// ==/UserScript==
window.close();

Actual behavior

ACE Stream program, which allows you to watch p2p broadcasts, but before showing, automatically opens a tab in the browser with ads

uBlock Origin version

uBlock Origin 1.38.6

Browser name and version

Google Chrome 95.0.4638.54 x64

Operating System and version

Windows 10 x64

@gwarser gwarser transferred this issue from uBlockOrigin/uBlock-issues Oct 26, 2021
@gwarser gwarser changed the title add a scriptlet to close already open windows m.acestream.net popup Oct 26, 2021
@uBlock-user
Copy link
Contributor

acestream.net##.popup2

@ryanbr

@mapx-
Copy link
Contributor

mapx- commented Oct 26, 2021

OP's popup is created by acestream app, only another app (AG for windows in this case) can block (kill) it

@uBlock-user
Copy link
Contributor

uBlock-user commented Oct 26, 2021

automatically opens a tab in the browser with ads

OP could try acestream.net##+js(nowoif) and report back.

window.close(); is used for closing popups, but we have nowoif so not needed.

@mapx-
Copy link
Contributor

mapx- commented Oct 26, 2021

You cannot stop it, it's launched by acestream player.

read here too:
AdguardTeam/AdguardFilters#10631

image

@fakelok76
Copy link
Author

The script code works fine when using Violentmonkey, therefore there is no reason to refuse the scriptlet in uBlock Origin either.

@uBlock-user
Copy link
Contributor

@fakelok76 Add acestream.net##+js(nowoif) to my filters, we defuse popups with that scriptlet.

ryanbr added a commit to easylist/easylist that referenced this issue Oct 26, 2021
@fakelok76
Copy link
Author

fakelok76 commented Oct 27, 2021

@fakelok76 Add acestream.net##+js(nowoif) to my filters, we defuse popups with that scriptlet.

Great, but it doesn't work, because it doesn't close the window, even if it's not opened by a program, but simply by clicking on a link.

@uBlock-user
Copy link
Contributor

Launch the ACE Stream program

How do you launch ACE Stream program ? List all the steps involved.

@fakelok76
Copy link
Author

fakelok76 commented Oct 27, 2021

  1. http://download.acestream.media/products/acestream-full/win/latest
  2. https://acestreamsearch.net/en/?q=%D0%9C%D0%B0%D1%82%D1%87%21+

@ghost
Copy link

ghost commented Oct 27, 2021

You don't need an account. Install the program and select any broadcast.

Video
a1846qX.mp4

@uBlock-user
Copy link
Contributor

||acestream.net^$popup works ?

@ghost
Copy link

ghost commented Oct 27, 2021

||acestream.net^$popup works ?

No.

Screen

2021-10-27_094709

@dimisa-RUAdList
Copy link

In my opinion, everything is very simple. Now there is no way to close open windows. A new scriptlet is required.

@uBlock-user
Copy link
Contributor

$popup closes the window via window.close() instead of defusing like ##+js(nowoif), so it should work.

@uBlock-user
Copy link
Contributor

@P0Rtvine is the popup coming from silvercube12.xyz ?

@uBlock-user uBlock-user reopened this Oct 27, 2021
@dimisa-RUAdList
Copy link

@uBlock-user

  1. Open https://m.acestream.net/plan/select?popup=noads
  2. Add ||acestream.net^$popup
  3. Refresh the page

@ghost
Copy link

ghost commented Oct 27, 2021

silvercube12.xyz = initiator, in the log no popup.
||silvercube12.xyz^$popup doesn't work.

@uBlock-user
Copy link
Contributor

@dimisa-RUAdList No popups whatsoever, also that page is the signup page for people who're not logged in.

@uBlock-user
Copy link
Contributor

@gorhill can you reproduce ?

@dimisa-RUAdList
Copy link

@uBlock-user
This isn't about pop-ups. Aim to close the window https://m.acestream.net/plan/select?popup=noads

@uBlock-user
Copy link
Contributor

@dimisa-RUAdList You mean the tab itself ?

@dimisa-RUAdList
Copy link

@uBlock-user
Oh sure.

@uBlock-user
Copy link
Contributor

Tab closes fine.

@fakelok76
Copy link
Author

fakelok76 commented Oct 27, 2021

@ mapx
There is no need to wait, you need to change the broadcast. The window drops out at the beginning of each new broadcast, you just need to select other links from the list.

@dimisa-RUAdList
Copy link

@gorhill
To solve this problem, AdGuard has created a special "window-close" scriptlet:
AdguardTeam/Scriptlets#158
AdguardTeam/Scriptlets@8f600c7

You can add its analog for uBlock Origin?

@gorhill
Copy link
Member

gorhill commented Dec 13, 2021

You can add its analog for uBlock Origin?

Yes, will do.

gorhill added a commit to gorhill/uBlock that referenced this issue Dec 13, 2021
@dimisa-RUAdList
Copy link

dimisa-RUAdList commented Dec 13, 2021

@gorhill
What should be the syntax for the patch in the case of https://m.acestream.net/plan/select?popup=noads?

Rule m.acestream.net##+js(window-close-if, /plan/select?popup=noads) - does not work.

Rule m.acestream.net##+js(window-close-if) - works, but it is redundant.

@gorhill
Copy link
Member

gorhill commented Dec 13, 2021

What do I need to do to trigger the filter?

@dimisa-RUAdList
Copy link

Open https://m.acestream.net/plan/select?popup=noads in a new window.

@gorhill
Copy link
Member

gorhill commented Dec 13, 2021

Ugh, typo in scriptlet, will fix asap

@dimisa-RUAdList
Copy link

In version uBlock Origin development build 1.39.3b11, the rule works great!

@gwarser gwarser removed the wontfix label Dec 13, 2021
@gwarser
Copy link
Contributor

gwarser commented Dec 13, 2021

@gorhill

Does not work? Tried:

m.acestream.net##+js(window-close-if, /plan/select?popup=noads)

Scripts may not close windows that were not opened by script.

https://developer.mozilla.org/en-US/docs/Web/API/Window/close

This method can only be called on windows that were opened by a script using the Window.open() method. If the window was not opened by a script, an error similar to this one appears in the console: Scripts may not close windows that were not opened by script.


This trick: https://github.com/gorhill/uBlock/blob/18ae79cdf25be59831c295ea7c90afbcd5a70ce8/platform/common/vapi-common.js#L140 ?

@dimisa-RUAdList
Copy link

Really. When using the AceStreamMedia program at the address: https://acestreamsearch.net/?q=Match+TV - rule m.acestream.net##+js(window-close-if, /plan/select?popup=noads) - does not work due to restriction "Scripts may close only the windows that were opened by them".

At the same time, the script:

// ==UserScript==
// @name Acestream close
// @Version 1
// @include https://m.acestream.net/plan/select?popup=noads
// @grant window.close
// ==/UserScript==
window.close();

uploaded to Tampermonkey or Violentmonkey, works as intended. Probably, these extensions have more rights than uBlock Origin.

However, the added scriptlet is not useless at all. It allows you to force the window to close using this rule: easylist/ruadlist@d8d3d65

@gwarser
Copy link
Contributor

gwarser commented Dec 14, 2021

OK, it seems to work in Firefox when launched from command line or even when opening from bookmarks as new tab.

I cannot fool it like this in Chrome. 🤦 not updated yet. And I cannot load custom build for some reason...

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

https://acestreamsearch.net/?q=Match+TV

What is supposed to happen when I navigate there? Nothing happens on my side in neither Chromium nor Firefox.

@dimisa-RUAdList
Copy link

dimisa-RUAdList commented Dec 14, 2021

First you need to install: http://download.acestream.media/products/acestream-full/win/latest
Further: https://imgur.com/a/bwcsOM6

AdguardTeam/Scriptlets#170

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

Ok I won't be able to reproduce this case. I see the popup navigates to https://m.acestream.net/plan/select?popup=noads from some silvercube12.xyz -- I would expect a plain popup filter would work.

Maybe window-close-if could be a special scriptlet for which the closing of the window is handled through extensions API, browser.tabs.remove().

@dimisa-RUAdList
Copy link

Currently, the only scriptlet that can solve this problem is window-close-if. But it blocks the initiator silvercube12.xyz, it cannot close the landing page https://m.acestream.net/plan/select?popup=noads. This means that as soon as the initiator address changes, the problem will reappear. And if the initiator's address becomes random, then it will become impossible to solve the problem at all. To achieve a stable solution to the problem, the scriptlet needs to be able to close the final landing page https://m.acestream.net/plan/select?popup=noads.

This is exactly what is described here: AdguardTeam/Scriptlets#170

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

With Chromium, with your filter m.acestream.net##+js(window-close-if, /plan/select?popup=noads), when select and right-click on https://m.acestream.net/plan/select?popup=noads and select "Go to https://m.acestream.net/plan/select?popup=noads", the new tab being opened is properly closed by the scriptlet. So if I understand correctly, this does not work when the tab is opened by the application?

@dimisa-RUAdList
Copy link

Yes that's right. When using an application, this rule does not work.

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

I feel like the fact that the new window is not detected as a popup candidate is what should be investigated.

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

Ok, though I can't reproduce using the Windows application, I can reproduce similar scenario using the command line:

chromium --new-window https://silvercube12.xyz/dispatch

Which allows me to put breakpoints in uBO's code.

So it turns out uBO has code to detect popups opened in a separate window, which was added because of uBlockOrigin/uBlock-issues#1659 (comment). In the current case though, I see the added code bails out at https://github.com/gorhill/uBlock/blob/1.39.2/platform/chromium/vapi-background-ext.js#L70, because the transitionType property is not client_redirect, but rather start_page. So maybe it's a matter of fine-tuning that one condition.

@uBlock-user
Copy link
Contributor

So maybe it's a matter of fine-tuning that one condition.

Will that make $popup work for this case?

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

Yes, when I add ||m.acestream.net/plan/select?popup=noads$popup and change the code to bail out on transitionType !== 'start_page', the new window is properly closed by uBO.

@uBlock-user
Copy link
Contributor

So we don't need window-close-if scriptlet then ?

@gorhill
Copy link
Member

gorhill commented Dec 14, 2021

Not if the change I can make has no bad side effect. I just tested what would happen if the browser is launch with that command line -- i.e. there are no existing instance, and the browser window in such case is not closed, which is a good thing, it would be bad if a false positive prevented the browser from launching at all.

gorhill added a commit to gorhill/uBlock that referenced this issue Dec 14, 2021
Related discussion:
- uBlockOrigin/uAssets#10323 (comment)

Synthesize a onCreatedNavigationTarget event for new browser windows
created as a result of an external application triggering a navigation
event.
@dimisa-RUAdList
Copy link

When using uBlock Origin development build 1.39.3b12, the following rules work and close the new window:

||silvercube12.xyz/dispatch?$popup
||m.acestream.net/plan/select?popup=noads$popup
silvercube12.xyz##+js(window-close-if, /dispatch)

@gwarser
Copy link
Contributor

gwarser commented Dec 15, 2021

So window.close() can be tested by calling from dev tools console. Pages are closed when launched directly in tabs - opened directly from command line but also from bookmark by middle click. Does not work when opened (navigated) from address bar, by launched from bookmark in current tab.


Session restored tabs are closed in Firefox. So, if you have for example two example.com tabs open -> list updates in the background (add example.com##+js(window-close-if) and close Dashboard) -> close Firefox -> browser cannot be opened now because all tabs and browser closes immediately. Edit: on first restart both tabs will be closed, on second restart only one tab will be restored, but again browser will be closed.


Firefox has option browser.tabs.closeWindowWithLastTab which is true by default, but remembers the tab you closed last, which caused browser to be closed, so it is always restored. It seems this was fixed 👀 Fx 92 O.O Edit: hmmm, so above bug should not happen... Still not fixed for window.close() case?

Chrome seems to remember how tab was opened. After restore, calling windows.close() on tab opened after navigation does not close it (error in console) but calling it on tab opened directly (in previous session) closes it.


OK, so I was wrong again 🙄

Chrome seems to remember how tab was opened. After restore, calling windows.close() on tab opened after navigation does not close it (error in console) but calling it on tab opened directly (in previous session) closes it.

This is also true in Firefox, so bug from second paragraph can only happen on pages opened directly in tabs - does not affect pages opened from navigation.

@gwarser
Copy link
Contributor

gwarser commented Dec 23, 2021

Session restored tabs are closed in Firefox. So, if you have for example two example.com tabs open -> list updates in the background (add example.com##+js(window-close-if) and close Dashboard) -> close Firefox -> browser cannot be opened now because all tabs and browser closes immediately. Edit: on first restart both tabs will be closed, on second restart only one tab will be restored, but again browser will be closed.

No bug in Chrome - on next browser start "New tab" is opened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

8 participants
@gorhill @gwarser @Alex-302 @mapx- @dimisa-RUAdList @uBlock-user @fakelok76 and others