Opened 2 years ago

Closed 2 years ago

Last modified 2 years ago

#5386 closed defect (fixed)

Errors when using ABP WebExt build and devtools panel

Reported by: Ross Assignee: mjethani
Priority: P2 Milestone: Adblock-Plus-1.13.4-for-Chrome-Opera
Module: Platform Keywords:
Cc: trev, jsonesen, mjethani, sebastian, greiner, Ross Blocked By: #5590
Blocking: Platform: Firefox
Ready: yes Confidential: no
Tester: Ross Verified working: yes
Review URL(s):

https://codereview.adblockplus.org/29482663/
https://codereview.adblockplus.org/29494581/

Description

Environment

ABP 1.13.2.1785
Firefox 55 (Developer).

How to reproduce

  1. Install the WebExt build of ABP.
  2. Select [ABP] > [Options]. Add a custom filter.
  3. Visit https://csp.kzar.co.uk
  4. Inspect the page, open the ABP DevTools panel.
  5. Refresh the page.
  6. Select [ABP] > [Options]. Try to add a custom filter.

Observed behaviour

After installing ABP, the following error is in the console:

ReferenceError: ext is not defined include.postload.js:609:3

After opening the DevTools panle there are various errors and exceptions such as:

response is undefined include.preload.js:473

Opening the ABP Options page after opening the DevTools panel then shows a options page with no subscriptions or filters, and does not let the user add subscriptions or filters.

Expected behaviour

Errors not to occur. Opening DevTools panel not to cause errors and break using the ABP Options page.

Attachments (1)

example.zip (2.7 KB) - added by mjethani 2 years ago.
Example extension

Download all attachments as: .zip

Change History (23)

comment:1 Changed 2 years ago by sebastian

  • Cc trev jsonesen mjethani sebastian added
  • Component changed from Unknown to Platform

comment:2 Changed 2 years ago by mjethani

I'm able to reproduce this.

After you open the DevTools panel and reload the page, the response to get-selectors will be undefined. I'm trying to dig deeper to find out why this is. It seems like some kind of bug in Firefox given the value passed to sendResponse is in fact not undefined.

comment:3 Changed 2 years ago by mjethani

  • Owner set to mjethani

comment:4 Changed 2 years ago by sebastian

  • Priority changed from Unknown to P2
  • Ready set

comment:5 Changed 2 years ago by mjethani

  • Review URL(s) modified (diff)

comment:6 Changed 2 years ago by mjethani

  • Status changed from new to reviewing

comment:7 Changed 2 years ago by mjethani

I have been unable to reproduce this behavior in Firefox with a simple barebones extension (see example.zip attached). Either the way things are set up in ABP is very peculiar and Firefox is unable to deal with it correctly, or we have a bug in our code (more likely) and somehow it only manifests in Firefox.

Investigating further.

Changed 2 years ago by mjethani

Example extension

comment:8 follow-up: Changed 2 years ago by mjethani

Alright, I had missed out the important part in my test. I've uploaded a new example.zip where you can see the problem. This looks like a bug in Firefox, I'll report it there.

If we follow the Chrome API, content scripts aren't supposed to communicate with devtools panels directly:

Messaging between the DevTools page and content scripts is indirect, by way of the background page.

But the real question is why the devtools panel is listening for messages like that in the first place. A content script can't send messages to a devtools panel anyway, and the only way for the background page to send a message is using a long-lived connection.

I believe ext/content.js has been included in devtools-panel.html by error.

comment:9 Changed 2 years ago by mjethani

  • Review URL(s) modified (diff)

comment:10 Changed 2 years ago by mjethani

Filed a bug in Firefox: #1383310.

comment:11 in reply to: ↑ 8 Changed 2 years ago by mjethani

Replying to mjethani:

I believe ext/content.js has been included in devtools-panel.html by error.

It's not an error after all.

I'm going back to the original fix.

comment:12 Changed 2 years ago by greiner

  • Cc greiner added

comment:13 Changed 2 years ago by abpbot

comment:14 Changed 2 years ago by mjethani

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

comment:15 Changed 2 years ago by trev

  • Blocked By 5590 added

comment:16 Changed 2 years ago by sebastian

  • Milestone set to Adblock-Plus-for-Chrome-Opera-next

comment:17 Changed 2 years ago by Ross

Fixed.

ABP 1.13.13.1838
Chrome 49 / 60 / Windows 7
Opera 36 / 46 / Windows 7

ABP 2.99.0.1838beta
Firefox 55 / Windows 7

comment:18 Changed 2 years ago by Ross

  • Tester changed from Unknown to Ross
  • Verified working set

comment:19 Changed 2 years ago by Ross

  • Summary changed from Errorswhen using ABP WebExt build and devtools panel to Errors when using ABP WebExt build and devtools panel

comment:20 Changed 2 years ago by sebastian

  • Cc Ross added

Note that the earliest supported version is Firefox 50, however, the first version supporting the devtools API is Firefox 54. So you might also want to make sure that the "Adblock Plus" developer tools panel works on Firefox 54, and while it is not available in earlier versions of Firefox, you might still want to make sure that these changes at least don't break anything on Firefox 50.

comment:21 Changed 2 years ago by Ross

The DevTools panel appears to work correctly in Firefox 54. The only issue I noticed is the icon colour (#5659). Doesn't appear to break things on Firefox 50.

comment:22 Changed 2 years ago by mjethani

The incorrect icon color when the focus is away from the ABP devtools panel appears to be a bug in Firefox 54.

Note: See TracTickets for help on using tickets.