Opened 10 months ago

Last modified 2 months ago

#5938 reopened defect

[webextension] "block element" does not appear in menu on some websites

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

https://codereview.adblockplus.org/29589668/

Description (last modified by trev)

Environment

FF 57
ABP 2.99.0.1896
easylist / easyprivacy

How to reproduce

go to facebook
click ABP icon

Observed behaviour

"block element" entry missing

Expected behaviour

"block element" entry available

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, which I found surprising.
  • Some other websites are also affected, such as https://www.dpreview.com/ (see #6092).

Attachments (1)

time.mk-2018-02-07-05-51.zip (45.1 KB) - added by Janevski 6 months ago.

Download all attachments as: .zip

Change History (28)

comment:1 Changed 10 months ago by mapx

  • Component changed from Unknown to Platform

comment:2 Changed 10 months ago by mapx

  • Description modified (diff)

comment:3 Changed 10 months ago by kzar

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

comment:4 Changed 10 months ago by kzar

  • Priority changed from Unknown to P2
  • Ready set

I can reproduce this as described, investigating.

comment:5 Changed 10 months ago by kzar

  • Description modified (diff)

comment:6 follow-up: Changed 10 months ago by mapx

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

Does FB use some restrictive CSP directives ?

comment:7 Changed 10 months ago by kzar

  • Description modified (diff)

comment:8 in reply to: ↑ 6 Changed 10 months ago 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 10 months ago 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 10 months ago 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 10 months ago by mjethani (previous) (diff)

comment:11 Changed 10 months ago by mjethani

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

comment:12 Changed 10 months ago by mjethani

  • Owner set to mjethani

comment:13 Changed 10 months ago by mjethani

I have reported the bug to Mozilla: #1412115.

comment:14 Changed 10 months ago by kzar

  • Keywords externaldependencies added
  • Status changed from reviewing to reopened

comment:16 Changed 9 months ago 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 9 months ago 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 8 months ago by fhd

  • Cc trev removed

Changed 6 months ago by Janevski

comment:19 Changed 6 months ago 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 6 months ago by Janevski (previous) (diff)

comment:20 Changed 6 months ago 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 6 months ago by kzar (previous) (diff)

comment:21 Changed 3 months ago by mapx

  • Cc cjsmall added

comment:23 Changed 3 months ago by mapx

  • Cc greiner added

comment:24 Changed 3 months ago 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 3 months ago by mapx

another example

https://tweakers.net/

comment:26 Changed 3 months ago by mapx

No such issue in uBo, it works on every site

comment:27 Changed 2 months ago by mjethani

  • Owner mjethani deleted
Note: See TracTickets for help on using tickets.