Krinkle has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/317742

Change subject: mw.loader: Fix off-by-one error in splitModuleKey()
......................................................................

mw.loader: Fix off-by-one error in splitModuleKey()

Follows-up 45bec76. This caused most localStorage cache entries from
mw.loader.store to be ignored because it'd store tje source code with
a version string that wrongly started with an "@".

As such, on the next page view, when comparing against the version
string from the startup manifest, it would mismatch and eventually
be pruned by mw.loader.store.

Change-Id: If14c80989c0bb28b7b209abe89f83d585c563987
---
M resources/src/mediawiki/mediawiki.js
M tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
2 files changed, 3 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core 
refs/changes/42/317742/1

diff --git a/resources/src/mediawiki/mediawiki.js 
b/resources/src/mediawiki/mediawiki.js
index 6b23439..484930a 100644
--- a/resources/src/mediawiki/mediawiki.js
+++ b/resources/src/mediawiki/mediawiki.js
@@ -1725,7 +1725,7 @@
                                }
                                return {
                                        name: key.slice( 0, index ),
-                                       version: key.slice( index )
+                                       version: key.slice( index + 1 )
                                };
                        }
 
diff --git a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js 
b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
index bfac513..7233a2e 100644
--- a/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
+++ b/tests/qunit/suites/resources/mediawiki/mediawiki.loader.test.js
@@ -639,6 +639,8 @@
                return mw.loader.using( 'test.stale' )
                        .then( function () {
                                assert.strictEqual( count, 1 );
+                               // After implementing, registry contains 
version as implemented by the response.
+                               assert.strictEqual( mw.loader.getVersion( 
'test.stale' ), 'v1', 'Override version' );
                                assert.strictEqual( mw.loader.getState( 
'test.stale' ), 'ready' );
                                assert.ok( mw.loader.store.get( 'test.stale' ), 
'In store' );
                        } )

-- 
To view, visit https://gerrit.wikimedia.org/r/317742
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If14c80989c0bb28b7b209abe89f83d585c563987
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Krinkle <krinklem...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to