Thank you for the quick fix! Best, -- Sukyoung
On Jan 29, 2014, at 9:55 AM, Nathan wrote: > FYI in case you aren't subscribed to the list. > > ---------- Forwarded message ---------- > From: Yair Rand <[email protected]> > Date: Tue, Jan 28, 2014 at 7:25 PM > Subject: Re: [Wikitech-l] Bug in the Wikipedia main web page > To: Wikimedia developers <[email protected]> > > > Thank you for pointing out this bug. Your suggested change to > MediaWiki:Gadget-wm-portal.js has been implemented by Meta-Wiki > administrator User:PiRSquared17. > > > On Tue, Jan 28, 2014 at 6:50 PM, Sukyoung Ryu <[email protected]>wrote: > > > Dear all, > > > > We are researchers at KAIST in Korea working on finding JavaScript bugs in > > web pages. While analyzing top websites from Alexa.com, we found an issue, > > which seems to be a bug, on the Wikipedia main web page (wikipedia.org). > > We would be grateful if you can either confirm that it is a bug and even > > better fix it or let us know what we're missing. > > > > Here's the issue. When a user selects a language in which search results > > are displayed via the language selection button from the Wikipedia main web > > page, the following JavaScript function is executed: > > > > 1 function setLang(lang) { > > 2 var uiLang = navigator.language || navigator.userLanguage, date > > = new Date(); > > 3 > > 4 if (uiLang.match(/^\w+/) === lang) { > > 5 date.setTime(date.getTime() - 1); > > 6 } else { > > 7 date.setFullYear(date.getFullYear() + 1); > > 8 } > > 9 > > 10 document.cookie = "searchLang=" + lang + ";expires=" + > > date.toUTCString() + ";domain=" + location.host + ";"; > > 11 } > > > > Depending on the evaluation result of the conditional expression on line > > 4, "uiLang.match(/^\w+/) === lang", the function leaves or dose not leave > > the selected language information on the user's computer through a cookie. > > But we found that the expression, "uiLang.match(/^\w+/) === lang", always > > evaluates to false, which results in that the function always leaves > > cookies on users' computers. We think that changing the contidional > > expression, "uiLang.match(/^\w+/) === lang", to the expression, > > "uiLang.match(/^\w+/) == lang", will solve the problem. > > > > This problem may occur in the main web pages of all the Wikimedia sites. > > Could you kindly let us know what you think? Thank you in advance. > > > > Best, > > Changhee Park and Sukyoung Ryu > > > > > > _______________________________________________ > > Wikitech-l mailing list > > [email protected] > > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > _______________________________________________ > Wikitech-l mailing list > [email protected] > https://lists.wikimedia.org/mailman/listinfo/wikitech-l > _______________________________________________ Wikitech-l mailing list [email protected] https://lists.wikimedia.org/mailman/listinfo/wikitech-l
