Index: trunk/phase3/tests/jasmine/spec/mediawiki.Uri.spec.js |
— | — | @@ -1,5 +1,10 @@ |
2 | 2 | ( function() { |
3 | 3 | |
| 4 | + // ensure we have a generic URI parser if not running in a browser |
| 5 | + if ( !mw.Uri ) { |
| 6 | + mw.Uri = mw.UriRelative( 'http://sample.com/' ); |
| 7 | + } |
| 8 | + |
4 | 9 | describe( "mw.Uri", function() { |
5 | 10 | |
6 | 11 | describe( "should work well in loose and strict mode", function() { |
Index: trunk/phase3/resources/mediawiki/mediawiki.Uri.js |
— | — | @@ -275,9 +275,9 @@ |
276 | 276 | return Uri; |
277 | 277 | }; |
278 | 278 | |
279 | | - // inject the current document location, for relative URLs |
280 | | - mw.Uri = mw.UriRelative( document.location.href ); |
| 279 | + // if we are running in a browser, inject the current document location, for relative URLs |
| 280 | + if ( document && document.location && document.location.href ) { |
| 281 | + mw.Uri = mw.UriRelative( document.location.href ); |
| 282 | + } |
281 | 283 | |
282 | | - |
283 | | - |
284 | 284 | } )( jQuery, mediaWiki ); |