mediawiki.Uri: Optional url use default location.
authorMark Holmquist <mtraceur@member.fsf.org>
Thu, 19 Jul 2012 20:55:21 +0000 (13:55 -0700)
committerTimo Tijhof <ttijhof@wikimedia.org>
Thu, 26 Jul 2012 09:17:56 +0000 (02:17 -0700)
commitfb8101f1482838143b347fe9280dbf4929f5c476
tree7f9410faa55bbeca3beda15b5047ba550faec393
parent4130c7814d4da60c1537423994bec6e1e0aca2ae
mediawiki.Uri: Optional url use default location.

This patch does three things:

1. If mw.Uri doesn't get any arguments, it will return the default
   URI. This is a good default, because it's something that will be
   used often, and the URI object that refers to the default location
   already exists locally, we're just using it to return a clone of
   that.

2. Fixes a strange logic error that prevents #1 from taking effect
   properly. The last clause in the 'if' statement on line 120
   meant that if uri is undefined, the if block would execute. I
   doubt that was intended, but it happened, and now it's fixed.
   There may be some error handling in mw.Uri.parse that could be
   removed since the URI passed in will almost never be undefined.

3. Adds tests for the new constructor values.

Change-Id: I9254b89bba41572c6dce72d2100d7085c37fb2c3
resources/mediawiki/mediawiki.Uri.js
tests/qunit/suites/resources/mediawiki/mediawiki.Uri.test.js