Home of the wacky and crazy projects
Firefox Addon: Html Validator
Note: This tutorial is based on Html Validator version 0.8.5.2. The details outlined below may not work in future versions.
When I make web sites, I use quite a few different Firefox extensions.
One of the extensions that I use is called Html Validator https://addons.mozilla.org/en-US/firefox/addon/249
This extension is great.
It main use is to validator the html code when you "view source" in Firefox.
It also has secondary benefit is syntax highlighting.

The Problem
However there is one problem that makes my job harder.
Error: oTidyBrowser is not defined
Source File: chrome://tidy/content/tidyBrowser.js
Line: 220
This shows up countless times in Firefox’s error console, making the job of finding other errors really hard.
I am going to show you how to stop this error.
(If this bug isn’t fix in the latest release, then you have to reapply this patch)
Solution to "oTidyBrowser is not defined"
The first step is locating the above file.
I can’t give you direct link to it, because of Firefox stores it in profile folder.
The Firefox profile folder, which will have a different name.
My Html Validator location is:
C:\Users\Dan\AppData\Roaming\Mozilla\Firefox\Profiles\vqy7rs08.default\extensions\{3b56bcc7-54e5-44a2-9b44-66c3ef58c13e}\chrome
Clicking on the file, "chrome://tidy/content/tidyBrowser.js," in the error console, will bring up the source code for this file.
The title of the window will be actual file path to the file in question.
When you get to the chrome folder you will be looking for a file called "tidy.jar"
The file "tidy.jar" is really a zip file.
Now duplicate this file and call it "tidy.zip".
Open "tidy.zip" in your
favourite file compression utility (Try Winzip or Winrar, if you don’t have one).
You now need to edit the file "content/tidyBrowser.js".
The section of code you are looking for is:
- if( oTidyBrowser.bTopLoadBusy==false )
- {
- oTidyUtil.tidy.log( ‘<javascript>tidyEndDocumentLoadObserver’ );
- oTidyBrowser.bTopLoadBusy = true;
- try
- {
- // Validate the 1rst request
- oTidyBrowser.bIgnorePageShow = true;
- oTidyBrowser.validateFrame( window.content );
- // oTidyBrowser.validateCache( subject.document, true );
- // Process the events that fired during the 1rst one
- // ex: page with frames.
- var doc = oTidyBrowser.oEventQueue.pop();
- while( doc )
- {
- oTidyBrowser.validateCache( doc, true );
- doc = oTidyBrowser.oEventQueue.pop();
- }
- }
- catch(ex)
- {
- tidyShowExceptionInConsole( ex );
- }
- oTidyBrowser.bTopLoadBusy = false;
- }
- else
- {
- // Parallel events are placed in a event queue.
- oTidyBrowser.oEventQueue.push( event.originalTarget );
- }
What you need to do is add an if statement to check if "oTidyBrowser" is not defined.
This will have the effect of stopping the error from appearing in the error console.
- if( !window.oTidyBrowser )
- {
- // Do nothing
- }
- else if( oTidyBrowser.bTopLoadBusy==false )
- {
- oTidyUtil.tidy.log( ‘<javascript>tidyEndDocumentLoadObserver’ );
- oTidyBrowser.bTopLoadBusy = true;
- try
- {
- // Validate the 1rst request
- oTidyBrowser.bIgnorePageShow = true;
- oTidyBrowser.validateFrame( window.content );
- // oTidyBrowser.validateCache( subject.document, true );
- // Process the events that fired during the 1rst one
- // ex: page with frames.
- var doc = oTidyBrowser.oEventQueue.pop();
- while( doc )
- {
- oTidyBrowser.validateCache( doc, true );
- doc = oTidyBrowser.oEventQueue.pop();
- }
- }
- catch(ex)
- {
- tidyShowExceptionInConsole( ex );
- }
- oTidyBrowser.bTopLoadBusy = false;
- }
- else
- {
- // Parallel events are placed in a event queue.
- oTidyBrowser.oEventQueue.push( event.originalTarget );
- }
Now save tidyBrowser.js back to "tidy.zip".
At this point you will need to close Firefox, as it will currently have locked the original file.
You can now either delete "tidy.jar" or rename it.
Renaming the file is good idea, as you you can easily revert back if you encounter problems.
Rename "tidy.zip" to "tidy.jar".
Now you can restart Firefox.
You will now no longer suffer the error message, "oTidyBrowser is not defined".
Cheat
If you want to save time, you can download "tidy.jar", to replace your own copy.
I can’t make any warrenties to the file’s safety. If there is any doubt use my instructions.
Use this file at your own risk.
| Print article | This entry was posted by Dan on November 22, 2008 at 11:53 pm, and is filed under Hacking, Software. Follow any responses to this post through RSS 2.0. You can leave a response or trackback from your own site. |
about 1 year ago
Awesome, thank you so much!!
about 1 year ago
You shouldn’t need to do the if/else statement.
The code could start like this:
if( window.oTidyBrowser )
if( oTidyBrowser.bTopLoadBusy==false )
and so on…
The first if statement checks for window.oTidyBrowser to be true, if it is then it carries on to the next if statement. If it is not true then it just skips it.
This is a common way to test for an element to make sure it exists in the DOM before attempting to run code on it.
I haven’t actually tried this but I see no reason it wouldn’t work. Your method is sound as well, it’s just a preference kind of thing. I’ve just never liked to have an empty if statement to only use the following else block.
about 1 year ago
Awesome! Way to make it happen.
about 1 year ago
@Travis: I tend to not like empty if’s as well.
I was considering writing it differently, but decided to keep it simple.
However your method is the simplest yet.
Hopefully the author will fix this problem.
about 1 year ago
Hi,
Man thank you is not enough, that error was killing me. Thanks a lot
Regards
Nawaf
about 1 year ago
Man, this is some hack.
You just made my day.
Thnx
about 1 year ago
.. I prefer this form …
if(!window.oTidyBrowser) return;
No need to worry about what the rest of the code does, no chance to break nested ifs later.
Embrace return anywhere, continue and break – they are your friends!
about 1 year ago
Thank you!!
about 1 year ago
works great. many thanks
about 1 year ago
The bug is still there in the version 0.8.5.3 of Tidy.
How to easily find tidy.jar:
Just search for it in the ‘Users’ (Vista) or ‘Documents and Settings’ (XP) folder.
You may also do:
1. cd %appdata%\Mozilla\Firefox\Profiles
2. cd
3. cd extensions
4. search here
about 1 year ago
Oh, man, you save the hundreds of our wasted hours! Fame on you!
about 1 year ago
aaa
about 1 year ago
Ran across this a little late, but for those that don’t like the empty if/else statement:
if (oTidyBrowser && oTidyBrowser.bTopLoadBusy==false)
seems to work fine.
Thanks for posting the fix to this, it was driving me mad.
about 1 year ago
Sorry, that should be:
if (window.oTidyBrowser && oTidyBrowser.bTopLoadBusy==false)
Thanks again.
about 1 year ago
thanks!!!!!!
about 1 year ago
worked on os x.
i spent 8 hours rewriting our javascript compression library (symfony plugin coming soon?) to troubleshoot this. wish i had googled “oTidyBrowser is not defined” sooner.
cd /Users//Library/Application Support/Firefox/Profiles/owhmypsz.default/extensions/{3b56bcc7-54e5-44a2-9b44-66c3ef58c13e}/chrome
cp tidy.jar tidy.bak.jar
mkdir tmp
cd tmp
unzip ../tidy.jar
(edit the offending file in your favorite editor)
cd ..
zip -r tidy.jar tmp
(restart firefox)
about 1 year ago
ok , just to make this more complicated, i actually needed to make the zipped folder (tidy.jar) from within the tmp folder.
cd tmp
zip -r ../tidy.jar .
about 1 year ago
Thanks a million – this kind of stuff is fantastically useful
about 7 months ago
good article!
about 3 months ago
Nice information, I really appreciate the way you presented.Thanks for sharing..