Commit graph

5194 commits

Author SHA1 Message Date
addshore
82b19bd96a Create and use PrefixingStatsdDataFactoryProxy in PerDbNameStatsdDataFactory
MediaWiki::emitBufferedStatsdData() is never called for the PerDbName factory,
so stats were being dropped. Instead of having two factories, turn the
PerDbName one into a proxy/wrapper around the main factory that just adds a
prefix in front of all of the keys.

Bug: T202144
Change-Id: I31e376446abb58e41353b4ca3814120d2e914104
2018-08-19 00:19:57 -07:00
Kunal Mehta
3b1e8a5cef Move wfMakeStaticArrayFile() into a class
And include tests :)

This code is independent of MediaWiki, but not really large enough to be
worth librarizing right now.

Bug: T200626
Change-Id: I022c074e8a708fb5219bc4ff4b53e7e31f60dc4b
2018-08-17 22:48:19 -07:00
jenkins-bot
fd08137ebf Merge "Turn ApiPrefixUniquenessTest into a structure test" 2018-08-18 00:55:18 +00:00
Kunal Mehta
72b4099727 Turn ApiPrefixUniquenessTest into a structure test
This way it gets run during extension test runs as well.

Temporarily add a hack allowing 'wbeu' duplicates until T196962 is fixed.

Change-Id: Ic89a22a2ff4525585de9e290a1d47d22cfaaac5e
2018-08-17 14:19:41 -07:00
jenkins-bot
352854ee0f Merge "Mass conversion to SpecialPageFactory service" 2018-08-17 21:02:58 +00:00
jenkins-bot
26e8ff6352 Merge "JavaScriptMinifier: Fix bad state after ternary in object literal" 2018-08-17 19:10:10 +00:00
Aryeh Gregor
e68fdb4065 Mass conversion to SpecialPageFactory service
Change-Id: Ia6e1e819ec6cbe8bf75b820109f51d47863e31fc
2018-08-17 12:03:12 -07:00
jenkins-bot
532b15c800 Merge "Make SpecialPageFactory a service" 2018-08-17 18:53:27 +00:00
Aryeh Gregor
d4045035b0 Make SpecialPageFactory a service
Calling SpecialPageFactory methods statically is now soft-deprecated.

SpecialPageFactory::resetList() is a no-op, and I changed tests
in core to use overrideMwServices() instead.

Methods that fell back to $wgUser now require a User object being passed.

Depends-On: Ie1f80315871085b9fd4763a265b588849d94414d
Change-Id: Id8a92d57743f790b7d8c377c033cef38d1bb24de
2018-08-17 11:12:23 -07:00
jenkins-bot
38a0733fef Merge "Html: Add test coverage for inlineScript()" 2018-08-17 01:08:26 +00:00
Timo Tijhof
15110b1ca9 JavaScriptMinifier: Fix bad state after ternary in object literal
The following pattern of input (found in jquery.js) triggered
this bug:

    call( {
        key: 1 ? 0 : function () {
            return this;
        }
    } );

The open brace changes state to PROPERTY_ASSIGNMENT (for object literals).
The colon after 'key' sets state to PROPERTY_EXPRESSION.

Each individual parts of an expression (identifiers and literal values)
is recognised with state *_EXPRESSION_OP, such as PROPERTY_EXPRESSION_OP.

The '1' after 'key:' correctly sets the state to PROPERTY_EXPRESSION_OP.
Upto there it goes well, but after that it goes wrong.

The question mark (TYPE_HOOK) in this context was wrongly switching
back to PROPERTY_EXPRESSION. That is a problem because that does not
handle TYPE_COLON, which meant '0: function' was seen together as a
sequence of continuous PROPERTY_EXPRESSION_OP where TYPE_FUNC may
not be handled.

Fixed by changing handling of TYPE_HOOK in PROPERTY_EXPRESSION to
switch states to EXPRESSION_TERNARY, and also performing a push
so that ternary handling can pop back to the property expression.

This mirrors the handling that already exists for ternaries in
the regular handling of EXPRESSION/EXPRESSION_OP (as opposed to
the variant for object literal properties).

Bug: T201606
Change-Id: I6104c839cfc3416257543b54a91b74cb4aa4193b
2018-08-16 17:02:07 +00:00
Timo Tijhof
7f843b0c04 title: Disable the failing tests from TitlePermissionTest
Bug: T201776
Change-Id: I088bd797225e0c60c66de4d4d1aa12d0b5bf67d8
2018-08-16 13:05:09 +00:00
jenkins-bot
7da455154e Merge "rdbms: use Database::getDomainId for transaction logging calls" 2018-08-16 05:54:35 +00:00
petarpetkovic
b7a4e82545 Fix some of the common typos
* supress -> suppress (Except in backup_LogTest.php)
* recomend -> recommend
* becuase -> because
* accross -> across

Bug: T201491
Change-Id: I8faa4e6cc688b3ee204b3f79ab55eb7b65cc1fdd
2018-08-16 00:59:32 +02:00
Aaron Schulz
5358c41e86 rdbms: use Database::getDomainId for transaction logging calls
Change-Id: I360ca633b145dc8e510bb00b542ac44933283943
2018-08-15 01:29:39 -07:00
jenkins-bot
757e55265d Merge "MergeHistory: Fix flaky test due to relative timestamp" 2018-08-15 03:27:48 +00:00
jenkins-bot
329a72120e Merge "resourceloader: Remove $wgResourceLoaderLESSVars support" 2018-08-15 01:24:36 +00:00
Timo Tijhof
4c9fd03240 MergeHistory: Fix flaky test due to relative timestamp
In PHP, `strtotime('tomorrow')` evaluates to the first midnight
after the current time.

Which means on Aug 14 at 23:59:59, strtotime('tomorrow') refers
to a timestamp merely 1 second in the future (Aug 15 00:00:00).

This causes the test to fail because this timestamp is computed
in a data provider, before the test itself starts. In order to
pass, it needs to be far enough in the future that it will also
be after the point in time where the test creates the page and
revisions in question.

Fix this by:
* ... moving it into the test itself, where even plain time()
      should probably suffice, but that's for another time.

* ... using +24*3600 instead of strtotime().

Bug: T201976
Change-Id: Ice5d54af4fb7cffa8db9b657796ba6ebecdaffa0
2018-08-15 02:16:02 +01:00
jenkins-bot
c1d7412ce2 Merge "Parser: Call firstCallInit() in getTags/getFunctionHooks" 2018-08-15 00:49:40 +00:00
jenkins-bot
a0b490bbe7 Merge "password: Move commonpasswords.cdb to includes/password/" 2018-08-14 23:53:19 +00:00
Kunal Mehta
b7b8f214bb Parser: Call firstCallInit() in getTags/getFunctionHooks
So callers don't need to do this manually. Pointed out by Tim in T201799.

Depends-On: Ia6c36d5a650095e35093bf47e275e081e89b3daf
Change-Id: Ida62767f3ca53f99609cae01d3a20051bb92ccab
2018-08-14 14:16:42 -07:00
Timo Tijhof
ca510f742f resourceloader: Remove $wgResourceLoaderLESSVars support
The use of global variables was deprecated in favour of
ResourceLoaderModule::getLessVars() on a per-module basis.

Also moved testLessFileCompilation case to the appropiate file as it
covers ResourceLoaderFileModule.php, not ResourceLoader.php.

Bug: T140804
Depends-On: Ib1b2808df2384473bfac47f53a5d25d7c9bbca2b
Depends-On: I96047f69d01c4736306df2719267e6347daf556f
Change-Id: If708087c85c80355c7e78f1768529b5f2e16ed07
2018-08-14 18:57:45 +00:00
Fomafix
0a0d5cb7f7 Fix typos
Bug: T201491
Change-Id: I25a27d11faabe2f5fa02950c7a4fb58b13fb3662
2018-08-14 09:52:19 +00:00
jenkins-bot
dccec12761 Merge "Make MapCacheLRU throw errors for bad $field arguments" 2018-08-14 01:17:17 +00:00
Aaron Schulz
39a63a3c16 Make MapCacheLRU throw errors for bad $field arguments
Change-Id: Ibde33e0ff671d3428b73c66766478f58763726e1
2018-08-14 00:41:33 +00:00
Kunal Mehta
c001d65a3a Call overrideMwServices() in TitlePermissionTest
Bug: T201776
Change-Id: I59918311e3dd01d133d5acebf8d1907fe8aef818
2018-08-12 19:46:23 -07:00
jenkins-bot
8d91ac5f12 Merge "Add PHPUnit test to ApiQueryDisabled" 2018-08-12 22:50:15 +00:00
jenkins-bot
cd789d78b8 Merge "JavaScriptMinifier: Add test case for another line-break bug" 2018-08-12 17:51:55 +00:00
jenkins-bot
d2db6c2f12 Merge "JavaScriptMinifier: Move test case for 'x++' to provideLineBreaker()" 2018-08-12 09:45:57 +00:00
jenkins-bot
9bd9b2f02b Merge "SpecialMyLanguage: Get content language from service" 2018-08-12 06:50:07 +00:00
jenkins-bot
3e5be2f38a Merge "Give pages with ~~~~ a different cache TTL" 2018-08-12 06:43:52 +00:00
Aryeh Gregor
f2e3c4d09f Give pages with ~~~~ a different cache TTL
This was supposed to already be the case, but it wasn't. The flag that
was set got cleared and never did anything.

Change-Id: Ide960f8cb9228f9a9d68c540369f122ada0a2a6f
2018-08-12 06:19:51 +00:00
Aryeh Gregor
90d4f56fe4 Mass conversion of $wgContLang to service
Brought to you by vim macros.

Bug: T200246
Change-Id: I79e919f4553e3bd3eb714073fed7a43051b4fb2a
2018-08-11 22:44:29 -06:00
Timo Tijhof
92ce940ec3 JavaScriptMinifier: Add test case for another line-break bug
Discovered by adding a test case that uses file_get_contents()
to pass jquery.js, and then scan the PHPUnit output for an entry
containing `return` by itself on a line where the next line
is isn't `;` - then reducing it to a test case as small as possible.

This was reduced from the definition of jQuery.event.addProp.

Bug: T201606
Change-Id: I1f907436c32630102e60e3ded7092dbeb9669fe8
2018-08-12 00:24:56 +01:00
Timo Tijhof
da3aa28cea JavaScriptMinifier: Move test case for 'x++' to provideLineBreaker()
Easier to read.

Bug: T201606
Change-Id: Ie12910edf5ab6a9d7246000ca78a3c9208aeb152
2018-08-12 00:24:10 +01:00
jenkins-bot
0700becfa2 Merge "JavaScriptMinifier: Fix bad state after '{}' in property value" 2018-08-11 15:40:43 +00:00
jenkins-bot
dbe51d6546 Merge "JavaScriptMinifier: Add better line-breaker tests" 2018-08-11 15:40:35 +00:00
jenkins-bot
23d28c0115 Merge "Use ParserFactory in a bunch of places" 2018-08-11 07:52:16 +00:00
jenkins-bot
5e2d030675 Merge "Clean up AuthManagerTest a bit" 2018-08-11 07:41:20 +00:00
Aryeh Gregor
bca6085920 Use ParserFactory in a bunch of places
I wasn't sure how to convert the rest of the occurrences in core (there
are a significant number).

Bug: T200881
Change-Id: I114bba946cd3ea8a293121e275588c3c4d174f94
2018-08-11 00:16:17 -06:00
Aryeh Gregor
62515f7b15 Introduce ParserFactory service
Bug: T200881
Change-Id: I257e78200983cb10afb76de1f07dd1b9d531c52a
2018-08-11 00:15:52 -06:00
jenkins-bot
7025765f3f Merge "Improve MediaWikiVersionFetcherTest" 2018-08-11 01:01:15 +00:00
Timo Tijhof
1f5f6fc204 JavaScriptMinifier: Fix bad state after '{}' in property value
Previously, $push contained:

	self::PROPERTY_EXPRESSION_OP => [
		self::TYPE_PAREN_OPEN => self::PROPERTY_EXPRESSION_OP
	],

But $pop contained:

	self::PROPERTY_EXPRESSION_OP => [ self::TYPE_BRACE_CLOSE => true ]

This meant that when a closing brace was found inside a property
expression, it would wrongly pop the stack, eventhough we are still
inside the property expression.

The impact is that everything after this is one level higher in
the stack than it should be, causing various other types to be
misinterpreted. Including in the following contrived example:

	call( function () {
		try {
		} catch (e) {
			obj = {
				key: 1 ? 0 : {} // A
			}; // B
		} // C
		return name === 'input';
	} );

In the above, the closing brace at A would close the 'obj.key' assignment
(PROPERTY_EXPRESSION_OP), instead of waiting for the closing brace at B to
decide that.

Then the closing brace at B would wrongly close the 'catch' block (instead of
the 'obj' assignment). And lastly, the closing brace at C would close the
function body (STATEMENT).

This resulted in keyword 'return' being interpreted while in state
PAREN_EXPRESSION_OP instead of STATEMENT, where PAREN_EXPRESSION_OP is the
arguments list to `call()`. In an argument list, TYPE_RETURN is not valid,
which means we stay in that state, instead of progressing to EXPRESSION_NO_NL,
which then wrongly allows for a line break to be inserted.

Bug: T201606
Change-Id: I07b809a7ca56e282ecb48b5c89c217b4b8da6856
2018-08-11 00:16:47 +01:00
Timo Tijhof
8cfe4abf8d JavaScriptMinifier: Add better line-breaker tests
Set maxLineLength to '1' instead of messing with filler content.
This makes it easy to see all potential line-breaks, instead of only
at the 999th offset.

Bug: T201606
Change-Id: I220b145c5bc8e7d1a41efacd2a6cea738545f006
2018-08-10 23:22:49 +01:00
Derk-Jan Hartman
25c293cadc SVG: Allow , as separator in viewBox attribute value
The viewBox attribute of the <svg> element allows both whitespace and
commas to be used as field separators.
https://www.w3.org/TR/SVG/coords.html#ViewBoxAttribute

Bug: T194192
Change-Id: Iae9be3e4fad3a8ffa411d7a76eee2f20cc39b718
2018-08-11 00:16:43 +02:00
jenkins-bot
d2b0968551 Merge "JavaScriptMinifier: Add test case for T201606" 2018-08-10 20:58:16 +00:00
Timo Tijhof
53e05f7b9c JavaScriptMinifier: Add test case for T201606
Bug: T201606
Change-Id: I2058765c7f1cfb9e2d644f19e780926d01b9b68c
2018-08-10 21:04:58 +01:00
Aryeh Gregor
0278585c72 Improve MediaWikiVersionFetcherTest
Let's test that the value is actually correct, not just that it's a
string.

Change-Id: I4d76a48696a838ee6882ffce10d024f7518dcd4a
2018-08-10 11:26:57 +03:00
jenkins-bot
1a8838bb6a Merge "Don't require a list of services in tests" 2018-08-10 04:54:17 +00:00
jenkins-bot
01e9cb56e4 Merge "Alphabetize service lists" 2018-08-10 04:51:47 +00:00