Opened 6 years ago

Closed 5 years ago

Last modified 5 years ago

#5 closed defect (fixed)

Fix Element Hiding Helper integration with the Inspector tool

Reported by: trev Assignee: saroyanm
Priority: P1 Milestone: Element-Hiding-Helper-1.3
Module: Extensions-for-Adblock-Plus Keywords:
Cc: smultron45@… Blocked By: #316, #317
Blocking: Platform:
Ready: no Confidential: no
Tester: Verified working: no
Review URL(s):

http://codereview.adblockplus.org/4780225334345728/

Description

Environment

Element Hiding Helper 1.2.3 in Firefox 27.

How to reproduce

  1. Right-click an element on some webpage and choose "Inspect Element" from the menu

Observed behaviour

No "Hide with ABP" button in the Inspector tool.

Expected behaviour

Element Hiding Helper was originally adding a "Hide with ABP" button but the Web Tools API changed in recent Firefox versions (a while ago actually). We should restore this functionality with the new API, backwards compatibility is not required. The new UI no longer has action buttons but we should be able to add an item to the element's menu.

Attachments (1)

scratchpad.js (974 bytes) - added by saroyanm 5 years ago.
Observer registration for inspector-opened topic

Download all attachments as: .zip

Change History (14)

comment:1 Changed 5 years ago by mapx

  • Cc smultron45@… added
  • in_progress set to 0
  • Ready unset

comment:2 Changed 5 years ago by saroyanm

  • Owner set to saroyanm
  • Status changed from new to assigned

Changed 5 years ago by saroyanm

Observer registration for inspector-opened topic

comment:3 Changed 5 years ago by saroyanm

I've implemented a scratchpad script that register Observer as described in current link:
https://developer.mozilla.org/en-US/docs/XPCOM_Interface_Reference/nsIObserver#Example.

The observe method is not being called when the inspector is being opened (see attachment),

I'm not sure whether it's a bug, actually there is a list of topics for Developer Tools, but no one is being called in observer:
https://developer.mozilla.org/en/docs/Observer_Notifications#Developer_tools

Also tried to use "*" as a topic parameter in addObserver method and open inspector, as result no event were being fired related to Developer Tools.

@Wladimir What you think could this be a bug ?

comment:4 Changed 5 years ago by trev

The example code you are using doesn't implement the QueryInterface method. You better use the existing code in lib/inspectorObserver.js as an example.

However, I'm not sure whether listening to these notifications is even the right approach any more. See https://developer.mozilla.org/en-US/docs/Tools/DevToolsAPI for more information.

comment:5 Changed 5 years ago by saroyanm

Also tried the existing code, with no success observer is not being called.

Okey, then will go with the DevToolsAPI, also thought we are not using the API because of the warning:
Warning: The DevTools API is not available yet. The DevTools API is still WIP. If you notice any inconsistency, please let The Firefox Developer Tools Team know.

But anyway will go with that approach and update the ticket.
Thanks.

comment:6 Changed 5 years ago by trev

I checked http://mxr.mozilla.org/mozilla-central/search?string=inspector-opened - the MDN page on observer notifications for the Developer Tools is clearly outdated, these notifications are no longer being used. Also, from the source code it seems that the best way to access gDevTools would be by importing the corresponding module:

let {gDevTools} = Cu.import("resource:///modules/devtools/gDevTools.jsm", null);
Last edited 5 years ago by trev (previous) (diff)

comment:7 Changed 5 years ago by saroyanm

Thanks for comments Wladimir, They was really helpful.
I was able to make inspector tool ABP button work,
Will clean the code, test correctly and upload the patch.

comment:8 Changed 5 years ago by saroyanm

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

comment:9 Changed 5 years ago by saroyanm

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

comment:10 Changed 5 years ago by trev

  • Blocked By 316 added

comment:11 Changed 5 years ago by trev

  • Blocked By 317 added

comment:12 Changed 5 years ago by trev

  • Milestone set to Element-Hiding-Helper-next

comment:13 Changed 5 years ago by ileonelperea

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