Not sure why you're blaming Firefox for a Java vulnerability...
Drive-by malware installations often occur because of malicious code in banner ads on otherwise reputable sites. Not much you can do to combat this, unfortunately, besides keep a well patched and well protected system. The net is a dangerous place, and if you venture out at all, you have to expect this.