From 570cff11684fdd7a6002cba653d7cfeba9db9571 Mon Sep 17 00:00:00 2001 From: Timo Tijhof Date: Wed, 2 Mar 2016 23:55:28 +0000 Subject: [PATCH] resourceloader: Don't cache CSSMin::remap() calls The output of this function is not deterministic. This function is what tranforms urls to include content hashes and also embeds content as data URI. The calls to this function are expected to be up to date and matching the version hash as constructed by the current web request. Previously, the content hash as constructed based on the collective file hash of all references images was accurate but the generated css associated with it could be stale. Unless we abuse MemoizedCallable to take a separate cache buster (with $localFileRefs?), it's best to remove this as it isn't a deterministic function and shouldn't be memoized. Bug: T128668 Change-Id: Icb87ddc585d7320ac48619446bb8b9cbe5f4780e --- includes/resourceloader/ResourceLoaderFileModule.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/includes/resourceloader/ResourceLoaderFileModule.php b/includes/resourceloader/ResourceLoaderFileModule.php index 6924d31dae..3d26009cfd 100644 --- a/includes/resourceloader/ResourceLoaderFileModule.php +++ b/includes/resourceloader/ResourceLoaderFileModule.php @@ -899,8 +899,9 @@ class ResourceLoaderFileModule extends ResourceLoaderModule { $this->missingLocalFileRefs[] = $file; } } - return MemoizedCallable::call( 'CSSMin::remap', - [ $style, $localDir, $remoteDir, true ] ); + // Don't cache this call. remap() ensures data URIs embeds are up to date, + // and urls contain correct content hashes in their query string. (T128668) + return CSSMin::remap( $style, $localDir, $remoteDir, true ); } /** -- 2.20.1