Opened on 03/08/2014 at 08:32:23 AM

Closed on 04/12/2014 at 09:28:26 PM

Last modified on 04/23/2014 at 06:50:46 PM

#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@gmail.com 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 on 04/07/2014 at 10:33:32 AM.
Observer registration for inspector-opened topic

Download all attachments as: .zip

Change History (14)

comment:1 Changed on 04/02/2014 at 08:25:01 AM by mapx

  • Cc smultron45@gmail.com added
  • in_progress set to 0
  • Ready unset

comment:2 Changed on 04/06/2014 at 09:17:50 PM by saroyanm

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

Changed on 04/07/2014 at 10:33:32 AM by saroyanm

Observer registration for inspector-opened topic

comment:3 Changed on 04/07/2014 at 10:48:12 AM 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 on 04/07/2014 at 11:30:25 AM 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 on 04/07/2014 at 11:33:53 AM 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 on 04/07/2014 at 11:34:04 AM 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 on 04/07/2014 at 11:34:17 AM by trev

comment:7 Changed on 04/08/2014 at 02:06:03 PM 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 on 04/08/2014 at 05:31:19 PM by saroyanm

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

comment:9 Changed on 04/12/2014 at 09:28:26 PM by saroyanm

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

comment:10 Changed on 04/13/2014 at 07:04:57 AM by trev

  • Blocked By 316 added

comment:11 Changed on 04/13/2014 at 07:10:41 AM by trev

  • Blocked By 317 added

comment:12 Changed on 04/13/2014 at 06:21:12 PM by trev

  • Milestone set to Element-Hiding-Helper-next

comment:13 Changed on 04/23/2014 at 06:49:54 PM by ileonelperea

Last edited on 04/23/2014 at 06:50:46 PM by ileonelperea

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 saroyanm.
 
Note: See TracTickets for help on using tickets.