Merge "Update jQuery from v1.11.1 to v1.11.2"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Sat, 20 Dec 2014 00:26:36 +0000 (00:26 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Sat, 20 Dec 2014 00:26:36 +0000 (00:26 +0000)
includes/EditPage.php
includes/MWTimestamp.php
includes/libs/MultiHttpClient.php
includes/libs/virtualrest/VirtualRESTServiceClient.php
resources/Resources.php
resources/src/mediawiki.action/mediawiki.action.edit.js
tests/phpunit/includes/MWTimestampTest.php

index c737920..7f5a9c0 100644 (file)
@@ -2118,11 +2118,19 @@ class EditPage {
                $wgOut->addModules( 'mediawiki.action.edit' );
                $wgOut->addModuleStyles( 'mediawiki.action.edit.styles' );
 
-               if ( $wgUser->getOption( 'uselivepreview', false ) ) {
+               if ( $wgUser->getOption( 'showtoolbar' ) ) {
+                       // The addition of default buttons is handled by getEditToolbar() which
+                       // has its own dependency on this module. The call here ensures the module
+                       // is loaded in time (it has position "top") for other modules to register
+                       // buttons (e.g. extensions, gadgets, user scripts).
+                       $wgOut->addModules( 'mediawiki.toolbar' );
+               }
+
+               if ( $wgUser->getOption( 'uselivepreview' ) ) {
                        $wgOut->addModules( 'mediawiki.action.edit.preview' );
                }
 
-               if ( $wgUser->getOption( 'useeditwarning', false ) ) {
+               if ( $wgUser->getOption( 'useeditwarning' ) ) {
                        $wgOut->addModules( 'mediawiki.action.edit.editWarning' );
                }
 
index 4b3d36a..ea91470 100644 (file)
@@ -182,6 +182,11 @@ class MWTimestamp {
                        $output .= ' GMT';
                }
 
+               if ( $style == TS_MW && strlen( $output ) !== 14 ) {
+                       throw new TimestampException( __METHOD__ . ': The timestamp cannot be represented in ' .
+                               'the specified format' );
+               }
+
                return $output;
        }
 
index 8c982c4..8ed9ee4 100644 (file)
@@ -83,7 +83,7 @@ class MultiHttpClient {
         *   - reason  : HTTP response reason (empty if there was a serious cURL error)
         *   - headers : <header name/value associative array>
         *   - body    : HTTP response body or resource (if "stream" was set)
-        *   - err     : Any cURL error string
+        *   - error     : Any cURL error string
         * The map also stores integer-indexed copies of these values. This lets callers do:
         *      <code>
         *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $http->run( $req );
@@ -107,7 +107,7 @@ class MultiHttpClient {
         *   - reason  : HTTP response reason (empty if there was a serious cURL error)
         *   - headers : <header name/value associative array>
         *   - body    : HTTP response body or resource (if "stream" was set)
-        *   - err     : Any cURL error string
+        *   - error   : Any cURL error string
         * The map also stores integer-indexed copies of these values. This lets callers do:
         *      <code>
         *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $req['response'];
index 2275831..6f416f1 100644 (file)
@@ -125,7 +125,7 @@ class VirtualRESTServiceClient {
         *   - reason  : HTTP response reason (empty if there was a serious cURL error)
         *   - headers : <header name/value associative array>
         *   - body    : HTTP response body or resource (if "stream" was set)
-        *   - err     : Any cURL error string
+        *   - error   : Any cURL error string
         * The map also stores integer-indexed copies of these values. This lets callers do:
         *      <code>
         *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $client->run( $req );
@@ -146,7 +146,7 @@ class VirtualRESTServiceClient {
         *   - reason  : HTTP response reason (empty if there was a serious cURL error)
         *   - headers : <header name/value associative array>
         *   - body    : HTTP response body or resource (if "stream" was set)
-        *   - err     : Any cURL error string
+        *   - error   : Any cURL error string
         * The map also stores integer-indexed copies of these values. This lets callers do:
         *      <code>
         *              list( $rcode, $rdesc, $rhdrs, $rbody, $rerr ) = $responses[0];
index e5332df..ccb842d 100644 (file)
@@ -1011,6 +1011,7 @@ return array(
                'class' => 'ResourceLoaderEditToolbarModule',
                'scripts' => 'resources/src/mediawiki.toolbar/toolbar.js',
                'styles' => 'resources/src/mediawiki.toolbar/toolbar.less',
+               'position' => 'top',
        ),
 
        /* MediaWiki Action */
@@ -1020,7 +1021,6 @@ return array(
                'styles' => 'resources/src/mediawiki.action/mediawiki.action.edit.css',
                'dependencies' => array(
                        'mediawiki.action.edit.styles',
-                       'mediawiki.toolbar',
                        'jquery.textSelection',
                        'jquery.byteLimit',
                ),
index f88b836..01a25f3 100644 (file)
@@ -1,27 +1,23 @@
 /*!
- * Scripts for action=edit
+ * Scripts for action=edit at domready
  */
-( function ( mw, $ ) {
+jQuery( function ( $ ) {
+       var editBox, scrollTop, $editForm;
 
-       $( function () {
-               var editBox, scrollTop, $editForm;
+       // Make sure edit summary does not exceed byte limit
+       $( '#wpSummary' ).byteLimit( 255 );
 
-               // Make sure edit summary does not exceed byte limit
-               $( '#wpSummary' ).byteLimit( 255 );
-
-               // Restore the edit box scroll state following a preview operation,
-               // and set up a form submission handler to remember this state.
-               editBox = document.getElementById( 'wpTextbox1' );
-               scrollTop = document.getElementById( 'wpScrolltop' );
-               $editForm = $( '#editform' );
-               if ( $editForm.length && editBox && scrollTop ) {
-                       if ( scrollTop.value ) {
-                               editBox.scrollTop = scrollTop.value;
-                       }
-                       $editForm.submit( function () {
-                               scrollTop.value = editBox.scrollTop;
-                       } );
+       // Restore the edit box scroll state following a preview operation,
+       // and set up a form submission handler to remember this state.
+       editBox = document.getElementById( 'wpTextbox1' );
+       scrollTop = document.getElementById( 'wpScrolltop' );
+       $editForm = $( '#editform' );
+       if ( $editForm.length && editBox && scrollTop ) {
+               if ( scrollTop.value ) {
+                       editBox.scrollTop = scrollTop.value;
                }
-       } );
-
-}( mediaWiki, jQuery ) );
+               $editForm.submit( function () {
+                       scrollTop.value = editBox.scrollTop;
+               } );
+       }
+} );
index 05c1a66..3656254 100644 (file)
@@ -81,6 +81,17 @@ class MWTimestampTest extends MediaWikiLangTestCase {
                new MWTimestamp( "This is not a timestamp." );
        }
 
+       /**
+        * Test an out of range timestamp
+        * @dataProvider provideOutOfRangeTimestamps
+        * @expectedException TimestampException
+        * @covers MWTimestamp
+        */
+       public function testOutOfRangeTimestamps( $format, $input ) {
+               $timestamp = new MWTimestamp( $input );
+               $timestamp->getTimestamp( $format );
+       }
+
        /**
         * Test requesting an invalid output format.
         * @expectedException TimestampException
@@ -113,6 +124,18 @@ class MWTimestampTest extends MediaWikiLangTestCase {
                );
        }
 
+       /**
+        * Returns a list of out of range timestamps in the format:
+        * array( type, timestamp_of_type )
+        */
+       public static function provideOutOfRangeTimestamps() {
+               return array(
+                       // Various formats
+                       array( TS_MW, '-62167219201' ), // -0001-12-31T23:59:59Z
+                       array( TS_MW, '253402300800' ), // 10000-01-01T00:00:00Z
+               );
+       }
+
        /**
         * @dataProvider provideHumanTimestampTests
         * @covers MWTimestamp::getHumanTimestamp