The Adblock Project Forum Index The Adblock Project
Pull up a seat ...stay a while.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

JavaScript errors with version0.5d1

 
Post new topic   Reply to topic    The Adblock Project Forum Index -> Main
View previous topic :: View next topic  
Author Message
wgianopoulos
Guest





PostPosted: Sat Oct 25, 2003    Post subject: JavaScript errors with version0.5d1 Reply with quote

With adblock version 0.5d1 and Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031024 Firebird/0.7+, when I open a new window (CTRL-N or File -> New Window) the following JavaScript error is encountered multiple times:

Error: Object is not defined

Source File: chrome://adblock/content/adblock.js Line: 134
Back to top
wgianopoulos



Joined: 25 Oct 2003
Posts: 5

PostPosted: Sat Oct 25, 2003    Post subject: Re: JavaScript errors with version0.5d1 Reply with quote

wgianopoulos wrote:
With adblock version 0.5d1 and Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6a) Gecko/20031024 Firebird/0.7+, when I open a new window (CTRL-N or File -> New Window) the following JavaScript error is encountered multiple times:

Error: Object is not defined

Source File: chrome://adblock/content/adblock.js Line: 134


Did not realize I was not logged in. Posting this so I will receive notification of responses.
Back to top
View user's profile Send private message
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Sat Oct 25, 2003    Post subject: Reply with quote

Interesting...I got the same error (posted on the old forums - comment #257), except it only occurred in Mozilla, and only when I blocked something. Sometimes I got the error once, and sometimes I got it many times Confused

It never appeared in a new profile, though...So if you can create a new profile* and the problem goes away, we'll know where the problem is at Wink

(* - To do this in Firebird, click on Start, then Run..., and type in the following:

"C:\Program Files\mozilla.org\MozillaFirebird\MozillaFirebird.exe" -ProfileManager

You can use -P instead of -ProfileManager - Both will do the same thing. Also, be sure to change the above path so it leads to where you installed Mozilla Firebird, and press "OK". Profile Manager will now be opened. For the moment, make sure the "Don't Ask on Startup" box is unchecked as well.

Create a new profile, select it, and press "Start Mozilla Firebird". Now, install AdBlock 0.5 to that profile, and see if the problem disappears. If so, I think we've spotted the problem Smile

Close Firebird, and select the profile you were using before, to return to normal use. This will most likely be called "Default User" if you never went into Profile Manager before. Also, you might want to check the "Don't Ask on Startup" box if you want to keep Profile Manager from popping up again when you close and reopen Firebird. You can still override that setting if you need to, though, with the Start -> Run... method shown above.)

As I was told in another topic, it's most likely something in your current profile that was carried over from an older version of AdBlock. It's fixed in 0.5, though Smile

See this post by rue for details on how to fix the problem (and I suggest that you do this before installing the current dev. build of AdBlock 0.5). You'll have to remove a few files, as well as reinstall some of your extensions (due to their menu entries being removed - They're still installed, though) and themes (which are still in your list of Themes, and just need reapplied)...But it's easy to take care of, and should keep the problem from ever occurring again Smile
Back to top
View user's profile Send private message Visit poster's website
wgianopoulos



Joined: 25 Oct 2003
Posts: 5

PostPosted: Sun Oct 26, 2003    Post subject: Reply with quote

Wolfey wrote:
It never appeared in a new profile, though...So if you can create a new profile* and the problem goes away, we'll know where the problem is at Wink


The only reason this error does not appear in a new profile is that the option to display chrome JavaScript warnings and errors is set to false in a new profile.

Yes I made a completely new profile, re-installed firebird with no themes, no extensions and then installed addblock (version 0.5d2 this time) blocked some ads on a page and opened a new window and the javascript error did not apprear. Then making no other changes except setting javascript.options.showInConsole to true so that chrome javascript errors and warnings would be displayed in the console window, the error started showing up again. So the new profile does not make the error not occur, it merely makes the javaconsole not display the error when it does occur.
Back to top
View user's profile Send private message
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Sun Oct 26, 2003    Post subject: Reply with quote

I just reread your old post...And noticed something new: After de/reinstalling AdBlock and changing the configuration to show JavaScript errors in the console, I can see the error generated by opening a new window now (same line, too - #134). But, like you said, it doesn't seem to happen until after something has been blocked with AdBlock when Firebird (or Mozilla) was running...

And here's something interesting: Open a few new windows and close all but the original out. Clear out the JavaScript Console. Now, open a new window. Do you notice multiple entries for the same error in it? Again, open a few more windows, close out all but the original, clear out the JavaScript Console, and open a new window. Now more of the same error shows up in it Shock

(Regarding what I typed above: You only have to open/close one extra window to generate the error, BTW...But why do it with one, when you can do it with many? The effect is much more noticeable this way Razz)

The above was seen in Mozilla...And the effects are similar in Firebird, but only appear after blocking something - But it was the same exact error, and the number of times it showed up was related to how many new windows were opened/closed prior to blocking something (also generating an error immediately after something was blocked). Interesting... Think
Back to top
View user's profile Send private message Visit poster's website
rue
Developer


Joined: 22 Oct 2003
Posts: 752

PostPosted: Sun Oct 26, 2003    Post subject: test-case.i Reply with quote

If you wouldn't mind trying some test-cases, maybe we can fix this.
Copy this jar into app:chrome or profile::chrome (depending on how you installed), replacing the original:

Adblock 0.5 d1.4 test.1 - Jar
Back to top
View user's profile Send private message
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Sun Oct 26, 2003    Post subject: Reply with quote

It's replaced (in both Mozilla and Firebird). The bug is still there for both of them, except as line 126 instead Sad
(The message and code it refers to are exactly the same as they were from the previous adblock.jar file - Just a line number difference, that's all)

Just opening new windows has no effect, nor does just closing them...But if you open a new window, close it, and then open another one, it will generate the error - Also, blocking ads won't generate an error (same one, BTW) until this has been done.

The error can show up multiple times, but the number of times it shows up depends on how many windows have been opened and closed.
Back to top
View user's profile Send private message Visit poster's website
rue
Developer


Joined: 22 Oct 2003
Posts: 752

PostPosted: Sun Oct 26, 2003    Post subject: test-case.ii Reply with quote

Your last entry shed some insight:

The object we register with the pref-observer service is held with a strong reference -- even if the window is removed. The only way to break free is to call "removeObserver" for each window-close. I tried, but couldn't get this working, forward-compatibly. So, here's test-case2, with a weak-referenced pref-observer obj:

Adblock 0.5 d1.4 test.2 - Jar
Back to top
View user's profile Send private message
wgianopoulos



Joined: 25 Oct 2003
Posts: 5

PostPosted: Sun Oct 26, 2003    Post subject: Reply with quote

Well, so far I have not been able to duplicate the problem uisng the test2 .jar file. I'll run it a while and post another message later on, but it sure looks promissing so far.

I'd also like to point out that other than the error mesage there were never any apparent ill effects of the original code. I never would have noticed this if I were not trying to debug another JavaScript issue with bookmarks.
Back to top
View user's profile Send private message
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Mon Oct 27, 2003    Post subject: Reply with quote

I tried this one as well..And unfortunately, that bug is still there (Line 136, this time) Sad

Here's what I found. Let me note that, before performing these tests, I created a new profile, set it so that JavaScript errors in the console would be shown, installed AdBlock, and then replaced the Jar file:

In Mozilla
  • Current Window (no previous closings)
    • Adblock (Right-click)
      • On Startup Page: Does not work as expected (it fails to add or block the selected item), and generates an error -> Error: uncaught exception: [Exception... "Component returned failure code: 0x8000ffff (NS_ERROR_UNEXPECTED) [nsIPrefBranch.getCharPref]" nsresult: "0x8000ffff (NS_ERROR_UNEXPECTED)" location: "JS frame :: chrome://adblock/content/addfilterdialog.js :: addFilter :: line 29" data: no]
      • On Refresh/Different Page: Works as expected, no errors
    • Adblock (Preferences): Works as expected, no errors

  • New Window (no previous closings)
    • Adblock (Right-click): Works as expected, no errors
    • Adblock (Preferences): Works as expected, no errors

  • Current Window (closed new window)
    • Adblock (Right-click): Works as expected, no errors
    • Adblock (Preferences): Works as expected, no errors

  • New/Current Window (at least one previous window closed and opened)
    • On Load: Generates an error -> Error: Object is not defined, Source File: chrome://adblock/content/adblock.js, Line: 136
    • Adblock (Right-click): Works as expected, no errors
    • Adblock (Preferences): Works as expected, no errors

In Firebird

Same exact results, except that, under the current window, with no previous closings, and on the startup page, it acts as if it successfully blocked the selected item (and adds it to the list), but that item is still there...And no error is generated Question

This is a strange problem...Fortunately, though, as wgianopoulos mentioned, it doesn't seem to affect the usage of Mozilla/Firebird/Adblock at all (except when it won't properly block things on the startup page).
Back to top
View user's profile Send private message Visit poster's website
rue
Developer


Joined: 22 Oct 2003
Posts: 752

PostPosted: Mon Oct 27, 2003    Post subject: test-case.iii Reply with quote

Alright, here's the third test.

I'm working double-blind here -- first, because I don't actually have the error (although I understand what's happening and where); second, because the scope the object is acting in, when the error occurs, is unanchored to any meaningful window-context.

My workaround was to define a strong-reference to the pref-observer-service in adblock's observer-object, and call the removal-method / delete the object if the observer is tripped but can't find window.document. Oh, and yea- the filter-dialog is fixed.

Adblock 0.5 d1.4 test.3 - Jar
Back to top
View user's profile Send private message
wgianopoulos



Joined: 25 Oct 2003
Posts: 5

PostPosted: Mon Oct 27, 2003    Post subject: Reply with quote

There is something strange going on here and I think it is not all with adblock. I had absoulutley no problems with the test2 .jar file with the 10/21 nightly. I updated to the 10/26 Firebird nightly and I am now too seeing the error at line 136. Confused
Back to top
View user's profile Send private message
wgianopoulos



Joined: 25 Oct 2003
Posts: 5

PostPosted: Mon Oct 27, 2003    Post subject: Reply with quote

Hmm I now did the exact same thing on a second PC. I had firebird 1021 running getting errors. installed the test2 adblock.jar file the errors went away. Upgraded to Firebird 10/26 and am still getting no javascript errors.
Back to top
View user's profile Send private message
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Tue Oct 28, 2003    Post subject: Reply with quote

rue, all I can say is...You did it! Dancing

I upgraded the adblock.jar file in the profiles I made for the previous Adblock test-case (Checking about:config again in both browsers beforehand to make sure the value for showing errors in the Console was set to "true"), and for Mozilla and Firebird, not one error was generated in the tests I performed! Cool

As for the startup page glitches, I think that could be traced to the startup page I was using:

First, I set up Mozilla to load the initial window with the default startup page ( http://mozilla.org/ ). When using the right-click method to block, no error was generated, and the item to be blocked was still there (although it was added to the list), but it was properly blocked once I refreshed the page.

I then did the same exact thing mentioned above, but with a different startup page ( http://texturizer.net/firebird/ ). Blocking worked as expected, but, when using the "Adblock-able Items" method, at times the red border that appears around the selected items didn't blink or go away (everything I chose to block did get blocked immediately without refreshing, though).

I'm not sure as to why the things I mentioned here had happened, but whatever they may be, are probably flukes of some sort. They don't generate any JavaScript errors, they happen at random, and whatever they do differs depending on the startup page used.

Still, it's great to see that Adblock is no longer generating errors in the JavaScript Console! Very Happy


(EDIT: I spoke too soon - The Adblock error generated when opening and closing windows is still affecting both of them Crying or Very sad

It's really strange, though - For either program, if you open a new window from the current window, close that new window, and open a new one from the original window, it generates an error - Line 99, but once again, the same [but now modified] piece of coding...

But if you open a new window from the current window, open another new window from the first new window, close both new windows, and open a new window from the original...It doesn't happen...Unless you open another new window from the original, close it, and open another one from the original.

Sorry for that run-on sentence of an explanation, but it's the only way I can think of to explain it. I do it once - No error. I do it a second time - There's an error. I do it a third time - No error. It's like it alternates between generating an error and not generating an error...And it seems to always generate that error in sets of two now Confused)

(EDIT #2: Since this bug is, for the most part, fixed in the third test-case...How long will it be before its coding is implemented into the development builds? Just curious, that's all.)
Back to top
View user's profile Send private message Visit poster's website
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Wed Oct 29, 2003    Post subject: Reply with quote

My previous message said the problem was fixed...But I later had to edit it when I found the problem was still there, albeit much more difficult to reproduce now. I also edited it a second time to ask a question regarding when the dev. builds will get the modified coding from the test-case build that (mostly) fixes this problem.

I'm not sure if both edits were seen, as it doesn't note that I edited the post at all, so I'm bumping this topic to make sure what I mentioned above was noticed. Thanks for taking the time to read this Wink
Back to top
View user's profile Send private message Visit poster's website
rue
Developer


Joined: 22 Oct 2003
Posts: 752

PostPosted: Wed Oct 29, 2003    Post subject: Reply with quote

I'm glad you bumped this -- I'd considered the issue resolved. For this fourth test, I spent some time optomizing and altering the observer code. Fundamentally, the fix is the same as test3, just improved:
.
Adblock 0.5 d1.6 test.4 - Jar
.
Lastly, for every alteration that gets favourable feedback or simply works, I land it silently to the dev-builds page. D2 will roll official when whitelists have landed.
Back to top
View user's profile Send private message
Aaron Spuler
QA Testing


Joined: 23 Oct 2003
Posts: 19

PostPosted: Wed Oct 29, 2003    Post subject: Reply with quote

rue, i tested it out and as far as i can tell there are no errors in javascript console Smile looking forward to case-insensitivity Smile
Back to top
View user's profile Send private message Visit poster's website
Wolfey



Joined: 23 Oct 2003
Posts: 45
Location: Kittanning, PA

PostPosted: Thu Oct 30, 2003    Post subject: Reply with quote

I just installed test-case #4 in both Mozilla and Firebird...Now, no matter what combination I use for opening/closing windows (including those mentioned in previous posts), nothing generates an error Very Happy
Back to top
View user's profile Send private message Visit poster's website
rue
Developer


Joined: 22 Oct 2003
Posts: 752

PostPosted: Thu Oct 30, 2003    Post subject: Reply with quote

Double-confirmed + landed.
.
And thank you, all three, for testing.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The Adblock Project Forum Index -> Main All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group