Skip navigation.

exploreopera

| Help

Sign up | Help

spot my browser.js bug

, ,

Usually I use this blog for opining on the quality of other people's and systems' code. Well, that's a bit one-way and biased, isn't it? Since I just found a bug in browser.js, written and maintained by yours truly, I'll sweep the street in front of my own door (as a Norwegian saying goes).

So, can you spot the broken logic in this browser.js excerpt?

if( hostname.indexOf('walla.co.il') ==hostname.length-11 ){
// Walla.co.il odd CSS styling causes display problems
// Bugs 184398, 184399
opera.addEventListener('BeforeEvent.load',
function(){ if(document.documentElement){(document.documentElement.appendChild(document.createElement('style'))).appendChild(document.createTextNode(' .btn-t,.btn{display:inline !important;} .wp-0-b{width:auto !important}'));
opera.removeEventListener('BeforeEvent.load', arguments.callee, false); 
opera.postError('Opera has modified the JavaScript on '+hostname+'. See browser.js for details');}}
,false);
}

Live.com works with Opera 9IE's scrollHeight logic

Comments

avatar
Seems it would trigger on any hostname 10 characters long (because .indexOf returns -1 if it doesn't match...)

By Jere, # 5. January 2006, 15:22:11

avatar
Ah, now I know why browser.js was firing on my 10-character-long test server yesterday!

Interestingly enough, I do use a class called "btn" on some pages, but the elements I apply it to were already inline, so the extra rule didn't change anything. Otherwise I probably would have noticed something was going on a lot sooner!

By Kelson, # 6. January 2006, 01:58:27

avatar
Jere is right. The walla.co.il fix has actually been applied on any server with a 10 character long name, including www.w3.org which was where I noticed something was odd.

Wonder how many sites in the world use a 10 character host name and ".btn{display:block}" in their CSS? :-o I hope the bug has not broken anything, and it is fixed now in any case.

By hallvors, # 6. January 2006, 03:29:52

avatar
whatwg.org as well.
Does the fix also give more detail on which fix was applied, so we can track it down more easily in the future?

By jimjjewett, # 6. January 2006, 20:44:23

avatar
Yes, now each fix will say which one was applied. (I hope to avoid such silly bugs in the future though! :-) )

By hallvors, # 7. January 2006, 03:54:51

avatar
Hum, now that I'm looking at my browser.js...
// several sites in the Netherlands (mainly newspapers) use the same sniffer script to block Opera.
//Bug: 182328
if( hostname.lastIndexOf('.nl')+3==hostname.length ){
I wonder what happens on a LAN where some http server has a 2 letter name ?? A check for hostname.length>2 would fix this :smile:

By xErath, # 10. January 2006, 11:17:14

avatar
well spotted :-)

By hallvors, # 11. January 2006, 04:26:43

Write a comment

You must be logged in to write a comment. if you're not a registered member, please sign up.