getParamValue defaults to current page only if url undefined
authorOri Livneh <ori@wikimedia.org>
Fri, 19 Oct 2012 19:02:11 +0000 (12:02 -0700)
committerOri Livneh <ori@wikimedia.org>
Sat, 20 Oct 2012 00:10:48 +0000 (17:10 -0700)
commitbb89db820ef4013e9590b4c6461a1edf66c8a160
treea624b3ba584fbd65dad4c95432dc1753aed74ab5
parent6bbe4076e1fcc3b638c2fa727ef2486596455514
getParamValue defaults to current page only if url undefined

The danger of using || here is apparent if you consider the
following case:

  mw.util.getParamValue( 'action', document.referrer );

If document.referrer is the empty string (as it often is),
getParamValue will look up the 'action' parameter in the
current URL, which is surely unintended. The solution is to
use the default value if and only if the url parameter is
undefined.

Change-Id: Ifd949f890d2f974dacc40e549c820c434ce57f53
resources/mediawiki/mediawiki.util.js