resourceloader: CSSMin::getLocalFileReferences now strips anchors
authorAntoine Musso <hashar@free.fr>
Tue, 17 Jul 2018 15:59:17 +0000 (17:59 +0200)
committerKrinkle <krinklemail@gmail.com>
Fri, 20 Jul 2018 04:40:44 +0000 (04:40 +0000)
commit4030b2cb2b077fc32d79d9bae703be6c9d0be729
treed00a1f73a92645a97e7d2c8908866a771f0ea2ec
parenta1edf3cf93ad15e9f89abee018c95bb0242d892a
resourceloader: CSSMin::getLocalFileReferences now strips anchors

When processing:

  url( 'foo.svg#anchors' )

getLocalFileReferences() would yield a file 'foo.svg#anchors'. It might
occur with upstream libraries, such as WikiFonts used by the Refreshed
skin.

When a path is found, strip the anchor entirely. Skip the case if that
results in an empty file.

remap() would properly skip the behavior "#default#', also skip url that
are solely an anchor such as '#other'.

Add a few test cases to cover CSSMin::getLocalFileReferences and cover
anchors usage in CSSMin::remap.

Bug: T115436
Change-Id: I1749ddc2b89021807f42d64131931ad7a99a7b43
includes/libs/CSSMin.php
tests/phpunit/includes/libs/CSSMinTest.php