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

Block Element doesn't appear in the context menu of a tab under specific circumstances #151

Closed
6 of 8 tasks
ghost opened this issue Jul 30, 2018 · 29 comments
Closed
6 of 8 tasks
Labels
bug Something isn't working fixed issue has been addressed

Comments

@ghost
Copy link

ghost commented Jul 30, 2018

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

Sometimes if you right click and accidently click open a new Window instead of a new tab for a link and if you happen to quickly close that new Window and thereafter right click to open the context menu on the already opened tab, Block Element will not appear, so this is more of a visual issue under the above mentioned circumstances.

A specific URL where the issue occurs

https://www.google.com/

Steps to Reproduce

  1. Close all opened tabs and windows and browse to google.com in a new tab.
  2. Right click on Gmail and select Open link in a new Window which will spawn a new Window, so quickly close it(as fast as you can) before it loads.
  3. Now back on the already opened tab of google.com, right click to open the context menu and notice Block Element is missing.

Expected behavior:

Block Element would appear when context menu of the tab is opened.

Actual behavior:

Block Element is missing from the context menu.

Supporting Evidence

Chrome 70

https://i.gyazo.com/27e5e60c750d0794ab1ff232ec94d57a.mp4

Firefox 63

https://i.gyazo.com/b3cc16d203426f59e2e718a8e0837b2b.mp4

Your environment

  • uBlock Origin version: 1.16.15b6
  • Browser Name and version: Chrome 70/Firefox 63
  • Operating System and version: Win 10 x64 1807 build

PS

It was difficult to reproduce on Firefox, so it may take you some tries. I have attached videos as supporting evidence so as to provide some visual aide in reproduction.

@uBlock-user uBlock-user added the bug Something isn't working label Jul 30, 2018
@uBlock-user
Copy link
Contributor

uBlock-user commented Aug 23, 2018

Also happens when you open a tab by middle click.

STR

  • Browse to google.com and middle click on Gmail, as soon a new tab opens, click it on the tab and close the tab quickly as you can.

  • Back on the google.com tab right click and find Block Element missing from the context menu.

gorhill added a commit to gorhill/uBlock that referenced this issue Jul 2, 2019
Related issue:
- uBlockOrigin/uBlock-issues#151

I have been unsuccessful fixing the above issue, but I will
keep the changes made in the process of trying to fix it.
@uBlock-user uBlock-user added the fixed issue has been addressed label Jul 26, 2019
@u-RraaLL
Copy link
Contributor

After opening a link in a new tab, be it via the context menu or via middle-clicking, uBO's context-menu item will never appear if the connection is interrupted. Even by uBO itself.

STR:

  1. Add ||reddit.com^|$document to "My filters".
  2. Open uBO's sub.
  3. Middle-Click the link to reddit's home.
  4. Right-click anywhere on the page.
  5. See no context menu item for uBO.
  6. Repeat 4-5 as long as you want.
  7. Switch the tab or refresh the page to bring back the context menu.
ubo-context-menu-bug-2022-07-17_13.45.47.mp4

This is a new browser profile with uBO just installed and updated.

The missing context menu also occurs on lagging websites. I'm guessing before the initial response from the website reaches the browser. So immediately after opening a new tab on any website - normally not an issue since that'll usually last only under/about 1s, but if a website/server is lagging, it can take up to a minute. Or more, if the connection fails.
One such website is https://rmz.cr, but the lagging occurs at random times so it's not that easy to reproduce.

But whether the connection is lagging or blocked by uBO, the issue is probably the same.

~~
Originally posted as a comment to my (related?) issue #2085, but this one seems like a better place. That issue is tagged as a FF only bug, but this is reproducible on both FF and Chrome.

The only difference between them I've noticed is that if I use picker via the popup and close it, the context menu item will come back on Chrome, while it won't on FF.

The main problem with the disappearing item when the connection in the new tab is interrupted remains in both.

@gwarser gwarser reopened this Jul 24, 2022
@Imna1975 Imna1975 mentioned this issue Sep 3, 2022
8 tasks
@gorhill gorhill removed the fixed issue has been addressed label Dec 19, 2022
@uBlock-user
Copy link
Contributor

@u-RraaLL cannot reproduce on Firefox 127, can you now ?

@u-RraaLL
Copy link
Contributor

Seems to be fixed now. On FF and Chrome both.

@u-RraaLL u-RraaLL added the fixed issue has been addressed label May 15, 2024
@uBlock-user
Copy link
Contributor

Context menu entry do not appear when iframe src = about:blank

STR --

  • Become advanced user and add the following rules in my rules -

* * 3p block, * * 3p-frame block, * * 3p-script block and animehub.ac static.anmedm.com * noop

  • Browse to https://animehub.ac/animehub.to

  • Right click on the top right rectangular box and see that context menu entry doesn't appear and the iframe src is about:blank

Sometimes contextmenu entry may appear if an empty iframe has not loaded...

@uBlock-user uBlock-user reopened this Sep 1, 2024
@uBlock-user uBlock-user removed the fixed issue has been addressed label Sep 1, 2024
@garry-ut99
Copy link

Context menu entry do not appear when iframe src = about:blank

That's already another separate issue, a duplicate of:

@gorhill
Copy link
Member

gorhill commented Sep 1, 2024

top right rectangular box

I don't see such thing.

@uBlock-user
Copy link
Contributor

I don't see such thing.

Capture

@gorhill
Copy link
Member

gorhill commented Sep 1, 2024

image

@uBlock-user
Copy link
Contributor

uBlock-user commented Sep 1, 2024

Does disabling cosmetic filtering make it appear ?

My bad. Hide placeholders of blocked elements setting was disabled on my end.

@uBlock-user uBlock-user added the fixed issue has been addressed label Sep 1, 2024
@gorhill
Copy link
Member

gorhill commented Sep 1, 2024

Hide placeholders of blocked elements setting was disabled

Still works fine in Chromium, but not in Firefox. I stepped through the code and uBO does tell Firefox to add a "Block element..." item to the menu, but the browser is not doing it, so this appears to be a Firefox-specific quirk.

@uBlock-user
Copy link
Contributor

but not in Firefox.

Yes, that is true, do you intend to address that with a fix ?

@gorhill
Copy link
Member

gorhill commented Sep 1, 2024

Not really, it's Firefox not enforcing uBO's context menu entries, I currently don't have the time to track down the issue in Firefox's code base for such a small issue.

@garry-ut99
Copy link

Are you sure that it's Firefox specifc, because the issue can be reproduced on Chromium too: in browser inspector pane, by changing manually the iframe's src attribute to: src="about:blank" (or to src=""), then uBO menu doesn't appear anymore in that frame.

@gorhill
Copy link
Member

gorhill commented Sep 2, 2024

The src was not about:blank in the reported case:

image

For the about:blank case, using '<all_urls>' instead at this line seems to work. This still doesn't solve the reported case above for Firefox, which is expected since the src is not about:blank.

@uBlock-user
Copy link
Contributor

The src was not about:blank in the reported case:

src becomes about:blank if you follow the STR + disable Hide placeholders of blocked elements setting which is the situation I reported in #151 (comment)

@gorhill
Copy link
Member

gorhill commented Sep 2, 2024

The screenshot I posted is the result of following your steps, using Firefox 129.0. I don't see about:blank, I see https://discordapp.com/widget?id=556038524151791616&theme=dark

@uBlock-user
Copy link
Contributor

The screenshot I posted

That is correct, inspector does show the original iframe src, but if you right click on the white box and click on This Frame > followed by View Frame Info, you will see this --

Capture

Instead of View Frame Info, you can also click on View Frame Source and verify the same.

@gorhill
Copy link
Member

gorhill commented Sep 2, 2024

you will see this

Very well. The proposed change to '<all_urls>' still doesn't make a difference in Firefox, so there is something specific to Firefox which prevents the context menu entry from appearing no matter what.

@garry-ut99
Copy link

garry-ut99 commented Sep 3, 2024

Context menu appears in uBO 1.46.1b18 (and earlier), but not in uBO uBO 1.46.1rc0 (and later)
Caused by this commit in (uBO 1.46.1rc0): gorhill/uBlock@8f2e7ae: [Prevent context menu entries on non-HTTP documents]


Besides some things I noticed in uBO 1.46.0:

A) Even despite a double context menu appears after click inside the iframe
(because content inside/below ##iframe is targeted), clicking either:
[1] uBlock Origin ==> Block Element or
[2] uBlock Origin ==> Block Element in iFrame
results in nothing: Element Picker doesn't appear

B) After clicking in iframe's border/corner, where only a single context menu appear
(because ##iframe itself is targeted):
Block Element and then after clicking it, then it works: Element Picker appears

C) Now, what is also interesting:
[1] is that after doing B), suddenly A)[1] is fixed (but not [2]) and works fine: Element Picker appears, until the page is reloaded.
[2] also intertesting is that setting manually the iframe's src to about:blank in browser inspector pane also fixes A)[1] the same way like above

VIDEO - the sequence of actions in video is the following:

  • A[2]
  • A[1] (Element Picker doesn't appear)
  • B (it has fixed A[1]]
  • A[1] (Element Picker does appear)

D) Now:
[1] Element Picker appears when invoked from both A[1] & A[2] in case of a normal iframe,
[2] but I don't know whether a lack of appearance of Element Picker in A[1] & A[2] in case of an empty about:blank iframe is expected or not,
[3] and why B or C[1] fixes A[1]
[4] but since it does, it suggets that at least A[1] should work even in an empty about:blank iframe
[5] of course it might be that both of A should work (or none)
[6] unless that is just some random conicidence that B or C[1] fixes A[1]

@uBlock-user
Copy link
Contributor

uBlock-user commented Sep 5, 2024

@gorhill https://fc-lc.xyz/ltio is a case where I don't have to disable Hide placeholders of blocked elements and do any special repro requirements and yet context menu won't appear in the embedded iframe(right click in the centre above the blue button) whose source is about:blank

Capture

@garry-ut99
Copy link

Moreover, unlike in the previous case from my last comment, this time, on https://fc-lc.xyz/ltio , on uBO 1.46.0:

  • (A[1]) uBlock Origin ==> Block Element : works since the beginning (Element Picker appears)
  • (A[2]) uBlock Origin ==> Block Element in iFrame : Element Picker still doesn't appear

@gorhill
Copy link
Member

gorhill commented Sep 5, 2024

Please provide browser name for when you state it works/doesn't works.

@garry-ut99
Copy link

(As for me) The same result for both Firefox/Chromium. (that's why I didn't mention browser name, but I understand you just want to make sure).

@gorhill
Copy link
Member

gorhill commented Sep 5, 2024

a case where I don't have to disable Hide placeholders of blocked elements

When I change this line to:

documentUrlPatterns: [ '<all_urls>' ],

It solves the issue in Chromium. It does not solve the issue in Firefox. To solve the issue in Firefox, I need to completely remove the line, but then this brings back this issue -- which I argue is a Firefox issue, but nevertheless I do not want to bring it back.

The workaround is trivial : use the Enter element picker mode from the popup panel or use assigned keyboard shortcut if any to enter element picker mode.

Since I can't fix the issue in Firefox, I consider it's not worth to make any change and advise to use the workaround.

@uBlock-user
Copy link
Contributor

Will using *://*/* make any difference in Firefox ?

@gorhill
Copy link
Member

gorhill commented Sep 5, 2024

*://*/* does not match about:blank.

@uBlock-user
Copy link
Contributor

I don't suppose about://*/* is considered valid, is it ?

@garry-ut99
Copy link

garry-ut99 commented Sep 5, 2024

Doesn't work either. Besides, AdGuard's and AdBlocker Ultimate's context menus work on about:blank, but suffer #1093 as a side-effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed issue has been addressed
Projects
None yet
Development

No branches or pull requests

5 participants