Not clearing firefinder-match class when filtering.

122 views
Skip to first unread message

cyberdude

unread,
Nov 11, 2012, 7:14:20 PM11/11/12
to firef...@googlegroups.com
Firefox 16.0.2
Firebug 1.10.6
Firefinder 1.2.5

Does not clear firefinder-match class from elements when pressing filter.
I am not aware when this bug has been introduce but currently witnessing the issue that elements will keep the firefinder-match class. Pressing filter simultaneous will keep appending the class to the elements.
Elements will keep the red box.
Seems like the clear function is either not being called or is acting up.

Have had a look through the code, but haven't written/edited a firefox add-on before, neither have I debugged one before.
The issue is very clear.
It essentially means that for anytime I want to change the filter, I have to refresh the page in order to see the proper result.
This makes Firefinder tedious to use, and ruins the experience.
Otherwise if this works, Firefinder is an essential part of my Firebug usage.

If you have any pointers in what way I can be any help, e.g. by debugging, I'll be glad to help. How do I debug the add-on?
How can I setup the add-on so I can edit the js files directly, without having to reinstall/repackage the xpi constantly?

Samuel Caillerie

unread,
Nov 12, 2012, 5:13:05 AM11/12/12
to firef...@googlegroups.com
Hello,

I have the same configuration but with only the version 1.2.2 of firebug under Windows and I don't have the same issue...

In order to debug, I am not an expert but if you don't want to un-package / package it continually, you can use a proxy file : https://developer.mozilla.org/en-US/docs/Setting_up_extension_development_environment#Firefox_extension_proxy_file .

Good luck!

Samuel

Robert Nyman

unread,
Nov 12, 2012, 6:25:08 AM11/12/12
to firef...@googlegroups.com
Hi,

Unfortunately I don't have the availability to go through the code at this time. but my simple guesses would be to reinstall Firebug and Firefinder, and see if the problem persists (given that it did at least work for Samuel).

If you want to dig into Firefox extension development, the code for Firefinder is available at https://github.com/robnyman/firefinder

When it comes to how to develop a Firefox extension, I hope this will prove a good start:

http://robertnyman.com/2009/01/24/how-to-develop-a-firefox-extension/

Thanks, and good luck!



Best regards,
Robert




--
You received this message because you are subscribed to the Google Groups "Firefinder" group.
To view this discussion on the web visit https://groups.google.com/d/msg/firefinder/-/olILV2h8VWwJ.

To post to this group, send email to firef...@googlegroups.com.
To unsubscribe from this group, send email to firefinder+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/firefinder?hl=en.

cyberdude

unread,
Nov 12, 2012, 6:46:23 AM11/12/12
to firef...@googlegroups.com
Samuel's post contains the gotcha.
V. 1.2.2 works fine,
V. 1.2.5 does not.

Funny thing is v. 1.2.2 is the one on the firefox add-ons page.
I don't know why I had 1.2.5. Is it possible 1.2.5 was released at some point, but later retracted?
When I go to "older versions" it says 1.2.5 is there.

Robert Nyman

unread,
Nov 12, 2012, 7:01:39 AM11/12/12
to firef...@googlegroups.com
I don't really know.
I've tried to get a newer version up there (which basically just adapts to new APIs in Firefox) but it has been held due to code that has been in there for years…


Best regards,
Robert


--
You received this message because you are subscribed to the Google Groups "Firefinder" group.
To view this discussion on the web visit https://groups.google.com/d/msg/firefinder/-/qNo6BjT_ZTYJ.

Samuel Caillerie

unread,
Nov 13, 2012, 4:04:51 AM11/13/12
to firef...@googlegroups.com
I have had a look to this version 1.2.5 on github, and I see that the last version embedded a patch that I suggested in order to correctly reinitialize the Firefinder state (see previous thread in this group - Firefinder 1.2.2 + Firebug 1.10.3 on Windows sometimes stops working).

But as discussed with Robert Nyman off the list, this correction introduced a regression which is the problem that you have got
here.

I have thus proposed another correction but which uses a try catch which should generally be avoided in javascript but is the only correction that I have find... (you can check it: it is in the file chrome/content/firebug.js, function getFirefinderState on l.63).

If you want to try this new version, I have repackaged it from the version 1.2.5.

Best regards,

Samuel
firefinder@robertnyman.com.xpi

Robert Nyman

unread,
Nov 13, 2012, 4:11:03 AM11/13/12
to firef...@googlegroups.com
Thanks Samuel!
Best solution, if it works, is to isssue a pull request so I can take the working solution into the GitHub repo.

Thanks!


Best regards,
Robert


--
You received this message because you are subscribed to the Google Groups "Firefinder" group.
To view this discussion on the web visit https://groups.google.com/d/msg/firefinder/-/oNGV5MiQfUUJ.

cyberdude

unread,
Nov 13, 2012, 6:18:27 AM11/13/12
to firef...@googlegroups.com
I can confirm that this patch from the looks of it fixes the issue I was having.
Now running 1.2.5 working.

As I agree with you that try catch shouldn't be used if it can fixed another way.
I've not tested this, but my guess would be that state.macthingElements can be null/undefined, right?

This of course means that matchingElementsExists = state.matchingElements.length + ""; would fail.

would it be better to do something akin to:

matchingElementsExists = (state.matchingElements != undefined ? state.matchingElements.length : false);

or some similar inline if, or maybe even just an if statement, since matchingElementsExists is already initialized with false.

if(state.matchingElements != undefined) matchingElementsExists = state.matchingElements.length;

Or am I missing something?

Or does the problem lies in that state can be undefined?

matchingElementsExists = (state != undefined ? (state.matchingElements != undefined ? state.matchingElements.length : false), false);

OR

if(state != undefined) if(state.matchingElements != undefined) matchingElementsExists = state.matchingElements.length;

This might also be possible to do in 1 IF with OR statement, but I'm not really sure how Javascript evaluates OR's... If it does left to right, or if it evaluates all.

Samuel Caillerie

unread,
Nov 13, 2012, 9:20:53 AM11/13/12
to firef...@googlegroups.com
In fact, for the previous thread, I have made a lot of tests, and I discovered that Firefox (or Firebug or Firefinder, I don't know exactly) has a strange behaviour with this object state.

In order to debug, I only put Firebug.Console.log messages in the code (I have not succeeded in order to make chromebug works with FF16). I have then just added the following loop :
Firebug.Console.log("getFirefinderState");
for (var prop in state) {
    Firebug.Console.log("property: " + prop);
    Firebug.Console.log("state: " + state[prop]);
};


I then have the following test scenario :
  1. I look for some class in my test document in Firefinder
  2. I look again for the same or another class in the same page
  3. I refresh the page and I look for some element in this same page

I then obtain the following output :

1st step : 
"getFirefinderState"

2nd step :
"getFirefinderState"
"property: matchingElements"
"state: [object NodeList]"

3rd step :
"getFirefinderState"
"property: matchingElements"

The problem is in the 3rd step : state contains the property matchingElements but testing or using it makes the browser exiting from the program (here Firefinder)!
Thus, any test like state.matchingElements !== undefined or anything else does not work...

Very strange, isn't it?

That's why I have used a try catch, but if you find any other solution it would be better!!

Best regards,

Samuel

Robert Nyman

unread,
Nov 13, 2012, 2:43:20 PM11/13/12
to firef...@googlegroups.com
Strange indeed!

--
You received this message because you are subscribed to the Google Groups "Firefinder" group.
To view this discussion on the web visit https://groups.google.com/d/msg/firefinder/-/nfSYubXPnw8J.
Reply all
Reply to author
Forward
0 new messages