resourceloader: Fix mw.loader to compute combined version in packed order
authorTimo Tijhof <krinklemail@gmail.com>
Wed, 7 Mar 2018 00:23:06 +0000 (16:23 -0800)
committerKrinkle <krinklemail@gmail.com>
Thu, 8 Mar 2018 03:24:34 +0000 (03:24 +0000)
commitfb234d9a5afdbdfa9497bccfc337d850d2448498
tree205f3e55aebd3cb4bb3db836321fd09dd6c6434f
parent949c6017cf18264c188b94b6232f8240f006a0ce
resourceloader: Fix mw.loader to compute combined version in packed order

The 'version' param was being computed based on the order of the modules list
before we perform string compression. And this compression can change the order
for its optimisation purposes.

Specifically, when requesting modules like 'a', 'b.1', 'b.2' and 'c'. The
version was computed based on a + b.1 + b.2 + c (standard sort order),
whereas the optimised list is 'a,c|b.1,2', which expands to a + c + b.1 + b.2,
which makes hash validation fail.

Bug: T188076
Change-Id: I00d6985c054fecd88acf73041aa02878e83d62bc
resources/src/mediawiki/mediawiki.js
tests/qunit/data/load.mock.php
tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js