When using new mw.Uri() with an empty first argument, the overrideKeys option is ignored.
For example on the page https://en.wikipedia.org/w/index.php?title=Main_Page&action=foobar&action=history :
// incorrect, getting an array (new mw.Uri(null, {overrideKeys: true})).query; Object { title: "Main_Page", action: Array[2] } // correct (new mw.Uri(location.href, {overrideKeys: true})).query; Object { title: "Main_Page", action: "history" }
This is because when the first argument is empty, the constructor just returns a clone of the cached "defaultUri" instance, ignoring the options.
Code: mediawiki.Uri.js