Opened on 10/26/2017 at 11:08:23 AM

Closed on 12/14/2018 at 10:22:02 AM

Last modified on 02/18/2019 at 11:47:11 AM

#5938 closed defect (fixed)

[webextension] "Block element" does not appear in menu for some websites

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

https://codereview.adblockplus.org/29589668/
https://gitlab.com/eyeo/adblockplus/adblockpluschrome/merge_requests/22

Description (last modified by kzar)

Environment

Firefox 57
ABP 2.99.0.1896
easylist / easyprivacy

ALSO

Firefox 60.0.1 / 64.0
Adblock Plus devenv built from 96eda29ae585.
Default filter lists

How to reproduce

1.) Browse to https://www.bestbuy.com/?intl=nosplash OR https://facebook.com OR https://tweakers.net/ OR https://www.dpreview.com/ OR https://vk.com/
2.) Click the ABP icon

Observed behaviour

"Block element" button is missing.

Expected behaviour

"Block element" button is shown and functions correctly.

Notes

  • An error shows up in the background console when the popup is opened, but only when the problem is happening:
Unchecked lastError value: Error: ext is not defined  ExtensionCommon.jsm:304
	withLastError resource://gre/modules/ExtensionCommon.jsm:304:9
	wrapPromise/< resource://gre/modules/ExtensionCommon.jsm:357:11
  • This does not seem to be a recent regression, I tested quite far back and could consistently reproduce the problem.
  • I can still reproduce the problem with EasyList disabled.
  • This seems to be a symptom of Mozilla bug #1408996.
  • See this workaround in uBlock: var vAPI = window.vAPI;.

Hints for testers

  • Check that the "Block element" tool works for these troublesome pages on Firefox now.
  • Check that subscription links still work on Firefox.
  • Check that the "Block element" tool works as before on Chrome.

Attachments (1)

time.mk-2018-02-07-05-51.zip (45.1 KB) - added by Janevski on 02/07/2018 at 04:52:44 AM.

Download all attachments as: .zip

Change History (45)

comment:1 Changed on 10/26/2017 at 11:09:14 AM by mapx

  • Component changed from Unknown to Platform

comment:2 Changed on 10/26/2017 at 12:06:16 PM by mapx

  • Description modified (diff)

comment:3 Changed on 10/26/2017 at 01:17:03 PM by kzar

  • Cc hfiguiere Ross added
  • Platform changed from Unknown / Cross platform to Firefox

comment:4 Changed on 10/26/2017 at 03:30:17 PM by kzar

  • Priority changed from Unknown to P2
  • Ready set

I can reproduce this as described, investigating.

comment:5 Changed on 10/26/2017 at 04:00:43 PM by kzar

  • Description modified (diff)

comment:6 follow-up: Changed on 10/26/2017 at 04:05:44 PM by mapx

Could be related to this ticket ?
https://issues.adblockplus.org/ticket/5817

Does FB use some restrictive CSP directives ?

comment:7 Changed on 10/26/2017 at 04:07:59 PM by kzar

  • Description modified (diff)

comment:8 in reply to: ↑ 6 Changed on 10/26/2017 at 04:13:42 PM by kzar

Replying to mapx:

Could be related to this ticket ?
https://issues.adblockplus.org/ticket/5817

Does FB use some restrictive CSP directives ?

Well since the error is showing up in the background page I figure it's not likely to be the problem, but for reference the CSP I'm seeing is default-src * data: blob:;script-src *.facebook.com *.fbcdn.net *.facebook.net *.google-analytics.com *.virtualearth.net *.google.com 127.0.0.1:* *.spotilocal.com:* 'unsafe-inline' 'unsafe-eval' fbstatic-a.akamaihd.net fbcdn-static-b-a.akamaihd.net *.atlassolutions.com blob: data: 'self';style-src data: blob: 'unsafe-inline' *;connect-src *.facebook.com *.fbcdn.net *.facebook.net *.spotilocal.com:* *.akamaihd.net wss://*.facebook.com:* https://fb.scanandcleanlocal.com:* *.atlassolutions.com attachment.fbsbx.com ws://localhost:* blob: *.cdninstagram.com 'self';

comment:9 Changed on 10/26/2017 at 04:42:58 PM by kzar

I'm not sure what's going on here, popup.js is sending "composer.content.getState" but getting undefined as the response. I've ran out of time for today.

comment:10 Changed on 10/26/2017 at 08:23:18 PM by mjethani

Well, I've narrowed it down. The problem here is that ext in ext/content.js is undefined. But that's only the symptom of the real problem, which is a bug in Firefox.

You can try out the simple extension below.

Here's the manifest.json:

{
  "applications": {
    "gecko": {
      "id": "example-extension@example.com",
      "strict_min_version": "50.0"
    }
  },
  "content_scripts": [
    {
      "js": ["content.js"],
      "matches": [ "http://*/*", "https://*/*" ],
      "run_at": "document_start"
    }
  ],
  "description": "An example extension",
  "manifest_version": 2,
  "name": "Example",
  "short_name": "Example",
  "version": "0.1.0"
}

And here's the content.js:

{
  const instanceId = Math.floor(Math.random() * 10000);

  console.log("Initializing content.js");
    
  let printFoo = () => console.log(`[${instanceId}] window.foo:`, window.foo);
      
  window.foo = {};
  printFoo();
  
  setInterval(printFoo, 1000);
      
  console.log("Finished initializing content.js");
}

Now when you load https://www.facebook.com/thebestposts you'll see that even though window.foo is assigned and prints the correct value immediately, on the first tick (after a second) it prints undefined and keeps printing undefined forever. It's like the window object is getting replaced at some point.

Interestingly this does not happen on https://manishjethani.com/

I'll investigate further tomorrow but this looks like a bug.

Last edited on 10/26/2017 at 08:23:50 PM by mjethani

comment:11 Changed on 10/26/2017 at 08:48:38 PM by mjethani

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

comment:12 Changed on 10/26/2017 at 08:48:50 PM by mjethani

  • Owner set to mjethani

comment:13 Changed on 10/26/2017 at 09:16:40 PM by mjethani

I have reported the bug to Mozilla: #1412115.

comment:14 Changed on 10/27/2017 at 11:41:50 AM by kzar

  • Keywords externaldependencies added
  • Status changed from reviewing to reopened

comment:15 Changed on 11/16/2017 at 01:39:07 PM by mapx

comment:16 Changed on 11/24/2017 at 01:46:54 PM by kzar

  • Summary changed from webextension: "block element" does not appear in menu for FB to [webextension] "block element" does not appear in menu for FB

comment:17 Changed on 11/24/2017 at 06:23:00 PM by trev

  • Description modified (diff)
  • Summary changed from [webextension] "block element" does not appear in menu for FB to [webextension] "block element" does not appear in menu on some websites

comment:18 Changed on 12/21/2017 at 11:30:13 AM by fhd

  • Cc trev removed

Changed on 02/07/2018 at 04:52:44 AM by Janevski

comment:19 Changed on 02/07/2018 at 04:53:43 AM by Janevski

Scenario:
This happens on Chromium too.
Just by visiting some websites the right click block element option doesn't appear to exist at all.

Example, but not limited to:
Visit http://time.mk
I've put an attachment of index.html.

Info:
Chromium Version 63.0.3239.84 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit)
Adblock Plus 1.13.5

Last edited on 02/07/2018 at 04:54:26 AM by Janevski

comment:20 Changed on 02/13/2018 at 05:16:21 PM by kzar

Janevski that is a different issue, see #6048.

Edit: In fact that issue isn't quite the same either, I've opened #6387 for it. To set expectations however fixing this might well not be possible with the APIs that the browsers provide.

Last edited on 02/13/2018 at 05:25:03 PM by kzar

comment:21 Changed on 05/17/2018 at 12:06:48 PM by mapx

  • Cc cjsmall added

comment:22 Changed on 05/17/2018 at 12:06:58 PM by mapx

comment:23 Changed on 05/17/2018 at 12:08:28 PM by mapx

  • Cc greiner added

comment:24 Changed on 05/17/2018 at 05:47:17 PM by greiner

In case it helps: We've been experiencing the same issue in the Flattr extension on Firefox Mobile where the browser "forgets" the extension's listener which it sets on flattr.com for the purpose of authenticating the user. Unlike here, however, we didn't encounter the problem on Firefox Desktop or on Chrome.

Unfortunately, all I found about it at that time was bug 1408996 which has already been mentioned in a previous comment.

comment:25 Changed on 05/28/2018 at 08:08:21 PM by mapx

another example

https://tweakers.net/

comment:26 follow-up: Changed on 05/28/2018 at 08:09:53 PM by mapx

No such issue in uBo, it works on every site

comment:27 Changed on 06/11/2018 at 12:08:38 PM by mjethani

  • Owner mjethani deleted

comment:28 Changed on 12/11/2018 at 09:57:46 PM by mapx

comment:29 Changed on 12/12/2018 at 10:48:04 AM by kzar

  • Description modified (diff)

comment:30 Changed on 12/12/2018 at 10:58:42 AM by kzar

  • Description modified (diff)
  • Summary changed from [webextension] "block element" does not appear in menu on some websites to [webextension] "Block element" does not appear in menu for some websites

comment:31 Changed on 12/12/2018 at 11:10:11 AM by kzar

  • Description modified (diff)

comment:32 Changed on 12/12/2018 at 11:13:31 AM by kzar

  • Description modified (diff)

comment:33 Changed on 12/12/2018 at 11:26:12 AM by kzar

  • Description modified (diff)

comment:34 Changed on 12/12/2018 at 11:26:27 AM by kzar

  • Description modified (diff)

comment:35 Changed on 12/12/2018 at 11:28:56 AM by kzar

  • Description modified (diff)

comment:36 in reply to: ↑ 26 Changed on 12/12/2018 at 11:30:15 AM by kzar

Replying to mapx:

No such issue in uBo, it works on every site

Seems you're right, which led me to this workaround in his code.

comment:37 Changed on 12/12/2018 at 11:31:40 AM by greiner

See also #7159

comment:38 Changed on 12/12/2018 at 05:03:41 PM by kzar

  • Owner set to kzar
  • Review URL(s) modified (diff)

comment:39 Changed on 12/12/2018 at 05:03:52 PM by kzar

  • Status changed from reopened to reviewing

comment:40 Changed on 12/13/2018 at 07:55:45 AM by mapx

comment:41 Changed on 12/13/2018 at 09:41:50 AM by kzar

  • Description modified (diff)

comment:42 Changed on 12/14/2018 at 10:19:47 AM by abpbot

A commit referencing this issue has landed:
Issue 5938 - Work around Firefox content script bug

comment:43 Changed on 12/14/2018 at 10:22:02 AM by kzar

  • Description modified (diff)
  • Milestone set to Adblock-Plus-for-Chrome-Opera-Firefox-next
  • Resolution set to fixed
  • Status changed from reviewing to closed

comment:44 Changed on 02/18/2019 at 11:47:11 AM by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

Fixed. Block element now works as expected on the sites listed. There is still some odd behaviour on the Bestbuy website which I opened as #7298.

ABP 3.4.3.2253
Firefox 65.0.1 / 51 / Windows 10
Firefox Mobile 65.0.1 / Android 7.1.1
Chrome 72.0.3626.109 / 49.0.2623.75 / Windows 10
Opera 58.0.3135.65 / 36.0.2130.80 / Windows 10
Edge 44.17763.1.0 / Windows 10

Add Comment

Modify Ticket

Change Properties
Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from kzar.
 
Note: See TracTickets for help on using tickets.