Opened 7 months ago

Closed 5 months ago

Last modified 5 months ago

#5817 closed defect (fixed)

[webextension] "block element" produces only an empty window

Reported by: mapx Assignee: kzar
Priority: P1 Milestone: Adblock-Plus-3.0.2-for-Firefox
Module: Platform Keywords: externaldependencies
Cc: sebastian, trev, mjethani, kzar, hfiguiere Blocked By:
Blocking: Platform: Firefox
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29602561/
https://codereview.adblockplus.org/29613777/

Description (last modified by trev)

Environment

Windows 10
FF 57.0b4 (64-bit)
ABP 2.99.0.1867beta
Easylist

How to reproduce

go to google page
click ABP icon, click "block element"
select whatever element on page

Observed behaviour

  • an empty window opens - no filters are proposed
  • I tried to close the window => I have to click twice to get it closed

Expected behaviour

..normal behaviour

Situation also reported by the users in forum.

It seems nobody tested a crucial feature.

Background

This is a timing issue, the initialization message is sent to the pop-up before it is ready.

Attachments (2)

webext.PNG (19.1 KB) - added by mapx 7 months ago.
webexterr.PNG (17.7 KB) - added by mapx 7 months ago.

Download all attachments as: .zip

Change History (39)

Changed 7 months ago by mapx

comment:1 Changed 7 months ago by sebastian

  • Cc mjethani added

Changed 7 months ago by mapx

comment:2 Changed 7 months ago by mapx

  • Description modified (diff)

comment:3 Changed 6 months ago by mapx

  • Description modified (diff)

comment:4 Changed 6 months ago by sebastian

  • Component changed from Adblock-Plus-for-Firefox to Platform

comment:5 Changed 6 months ago by mapx

  • Cc kzar hfiguiere added

comment:6 Changed 6 months ago by mapx

Trying to close (clicking "Cancel" ) the empty window, I get (in the console)

Scripts may not close windows that were not opened by script. composer.js:64:2

Clicking the window "x" I get in the console (but however the window is then closed clicking twice):

Error: port.onDisconnect.hasListeners is not a function  undefined
Error: Could not establish connection. Receiving end does not exist.  undefined



comment:7 Changed 6 months ago by trev

I can reproduce this issue in Nightly (58.0a1 2017-10-26 on Linux) but not on Firefox 56. It's not actually an empty window however, resizing it makes the content appear - seems to be a Firefox rendering bug. Also, clicking the Cancel button works correctly here.

comment:8 Changed 6 months ago by trev

There is a browser error being reported which is likely the cause:

TypeError: invalid 'in' operand browser tabbrowser.xml:2437:1

comment:9 Changed 6 months ago by mapx

as I said it happens in FF 57. No text in the window, "cancel" not working.

comment:10 Changed 5 months ago by trev

  • Description modified (diff)
  • Owner set to trev
  • Priority changed from Unknown to P1
  • Ready set

comment:11 Changed 5 months ago by trev

  • Review URL(s) modified (diff)
  • Status changed from new to reviewing

comment:13 Changed 5 months ago by trev

  • Milestone set to Adblock-Plus-for-Firefox-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:14 Changed 5 months ago by mapx

It was fixed for chrome but not for firefox (57 - on windows 10)

More: "Cancel" button does not work, I have to click "X" to close the window

comment:15 Changed 5 months ago by mapx

pressing "Cancel" I get in console:

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

opening the window =>

TypeError: invalid 'in' operand browser[Learn More]  tabbrowser.xml:2426:1
	_insertBrowser chrome://browser/content/tabbrowser.xml:2426:1
	getRelatedElement chrome://browser/content/tabbrowser.xml:7146:11
	set_selectedIndex chrome://global/content/bindings/tabbox.xml:406:31
	tabs_XBL_Constructor chrome://global/content/bindings/tabbox.xml:275:13
	<anonymous> chrome://browser/content/tabbrowser.xml:46:9
	_updateNewTabVisibility chrome://browser/content/tabbrowser.xml:5828:15
	tabbrowser_XBL_Constructor chrome://browser/content/tabbrowser.xml:5885:11
NS_ERROR_NOT_INITIALIZED: Component returned failure code: 0xc1f30001 (NS_ERROR_NOT_INITIALIZED) [nsIMessageSender.sendAsyncMessage]  ext-windows.js:19
Error: Could not establish connection. Receiving end does not exist.

comment:16 Changed 5 months ago by trev

Please create a new issue on the Cancel button not working. It isn't reproducible for me, I suspect another extension interfering here.

comment:17 Changed 5 months ago by mapx

it was reported here: https://issues.adblockplus.org/ticket/5979
by Ross

and the [Cancel] button does not do anything.

comment:18 Changed 5 months ago by mapx

probably the same issue here:
https://issues.adblockplus.org/ticket/5988

buttons doing ..nothing

comment:19 Changed 5 months ago by mapx

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:20 Changed 5 months ago by mapx

The issue still hitting Windows users for firefox 57 + ABP 3

comment:21 Changed 5 months ago by kzar

Yes, I've just tested and while Wladimir's fix works for me on Linux it doesn't seem to on Windows 10.

comment:22 Changed 5 months ago by kzar

I can also reproduce the problem with the buttons on Windows, I've opened #6053 for that. (No it's not a duplicate of #5988 unfortunately.)

comment:23 Changed 5 months ago by kzar

  • Summary changed from webextension: "block element" produces only an empty window to [webextension] "block element" produces only an empty window

comment:24 Changed 5 months ago by kzar

I've been looking into why this problem is still happening on Windows 10. I notice that there's a Error: Could not establish connection. Receiving end does not exist. message showing up in the console when the "composer.dialog.init" message is sent, and the message is never received by the popup. I've tried adding a 100ms delay before sending the message, no dice. I then tried adding a 1 second delay and it worked.

Wladimir's fix seems correct to me, I guess we can't trust the onUpdated "complete" event :/.

comment:25 Changed 5 months ago by kzar

  • Keywords externaldependencies added

I've opened a Firefox bug about that https://bugzilla.mozilla.org/show_bug.cgi?id=1418655

comment:26 Changed 5 months ago by kzar

  • Owner changed from trev to kzar

comment:27 Changed 5 months ago by kzar

Annoyingly the error is not a real exception so we can't catch it, looking into what else we can do to workaround the problem on Windows 10.

comment:28 Changed 5 months ago by mapx

The "1 second delay" does not work always ?

comment:29 Changed 5 months ago by kzar

  • Review URL(s) modified (diff)
  • Status changed from reopened to reviewing

Annoyingly the error is not a real exception so we can't catch it...

My mistake, the API was promisified I just had to call .catch()!

The "1 second delay" does not work always ?

Well it seems to work reliably for me, but who knows that it would work reliably on a different computer. Hard coding pauses like this is a nasty hack :/

comment:30 Changed 5 months ago by abpbot

comment:31 Changed 5 months ago by kzar

  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:32 Changed 5 months ago by kzar

  • Milestone changed from Adblock-Plus-for-Firefox-next to Adblock-Plus-3.0.2-for-Chrome-Opera-Firefox

comment:33 follow-ups: Changed 5 months ago by Ross

In Firefox 57 / Windows 7 on Google: The highlight never appears.
In Firefox 57 / Windows 7 on ArsTechnica: The highlight works and the dialog appears but it sits disabled displaying "Loading..." for ages.

In Chrome 62 / Windows 7 on Google: The highlight never appears.
In Chrome 62 / Windows 7 on ArsTechnica: The highlight works, dialog appears and filter suggested as expected.

ABP 3.0.1.1939

comment:34 Changed 5 months ago by mapx

chrome 63 / w 7 => on google selected element is highlighted on page(2 different languages)
firefox 58 / w 7 => on google selected element is highlighted on page

ABP 3.0.1.1939

Last edited 5 months ago by mapx (previous) (diff)

comment:35 in reply to: ↑ 33 Changed 5 months ago by kzar

Replying to Ross:

In Firefox 57 / Windows 7 on ArsTechnica: The highlight works and the dialog appears but it sits disabled displaying "Loading..." for ages.

In Chrome 62 / Windows 7 on ArsTechnica: The highlight works, dialog appears and filter suggested as expected.

This is the expected behaviour, we work around the Firefox bug on Windows by retrying once every second for three seconds. That's why I added the "Loading..." message to make it clear what was happening. Not ideal, but the best we can do until Mozilla fix the underlying problem.

In Firefox 57 / Windows 7 on Google: The highlight never appears.
In Chrome 62 / Windows 7 on Google: The highlight never appears.

Please could you file a separate issue for that?

comment:36 in reply to: ↑ 33 Changed 5 months ago by trev

Replying to Ross:

In Chrome 62 / Windows 7 on Google: The highlight never appears.
In Chrome 62 / Windows 7 on ArsTechnica: The highlight works, dialog appears and filter suggested as expected.

As Sebastian explained on IRC, this is also expected behavior. With Acceptable Ads enabled, hiding anything on this page isn't possible. You can only block things, which makes the logo the only selectable element on this page.

comment:37 Changed 5 months ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Fixed. Block element works as expected. There is an issue still with block element in older Firefox versions (#6113).

(Thank you for explanations).

ABP 3.0.1.1939
Firefox 52 / 57 / Windows 10
Chrome 52 / 62 / Windows 7
Opera 39 / 49 / Windows 7

Last edited 5 months ago by Ross (previous) (diff)
Note: See TracTickets for help on using tickets.