Opened 7 weeks ago

Closed 10 minutes ago

#5817 closed defect (fixed)

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

Reported by: mapx Assignee: kzar
Priority: P1 Milestone: Adblock-Plus-for-Firefox-next
Module: Platform Keywords: externaldependencies
Cc: sebastian, trev, mjethani, kzar, hfiguiere Blocked By:
Blocking: Platform: Firefox
Ready: yes Confidential: no
Tester: Unknown Verified working: no
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 weeks ago.
webexterr.PNG (17.7 KB) - added by mapx 7 weeks ago.

Download all attachments as: .zip

Change History (33)

Changed 7 weeks ago by mapx

comment:1 Changed 7 weeks ago by sebastian

  • Cc mjethani added

Changed 7 weeks ago by mapx

comment:2 Changed 7 weeks ago by mapx

  • Description modified (diff)

comment:3 Changed 6 weeks ago by mapx

  • Description modified (diff)

comment:4 Changed 5 weeks ago by sebastian

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

comment:5 Changed 4 weeks ago by mapx

  • Cc kzar hfiguiere added

comment:6 Changed 4 weeks 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 4 weeks 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 4 weeks 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 4 weeks ago by mapx

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

comment:10 Changed 2 weeks ago by trev

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

comment:11 Changed 2 weeks ago by trev

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

comment:13 Changed 13 days ago by trev

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

comment:14 Changed 13 days 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 13 days 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 13 days 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 13 days 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 13 days ago by mapx

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

buttons doing ..nothing

comment:19 Changed 7 days ago by mapx

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:20 Changed 7 days ago by mapx

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

comment:21 Changed 6 days 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 6 days 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 6 days 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 days 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 days 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 2 days ago by kzar

  • Owner changed from trev to kzar

comment:27 Changed 2 days 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 2 days ago by mapx

The "1 second delay" does not work always ?

comment:29 Changed 2 days 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 11 minutes ago by abpbot

comment:31 Changed 10 minutes ago by kzar

  • Resolution set to fixed
  • Status changed from reviewing to closed
Note: See TracTickets for help on using tickets.