2014-03-07 18:29:23 +00:00
|
|
|
<?php
|
|
|
|
|
|
2015-01-08 08:56:10 +00:00
|
|
|
class ResourceLoaderStartUpModuleTest extends ResourceLoaderTestCase {
|
2014-03-07 18:29:23 +00:00
|
|
|
|
|
|
|
|
public static function provideGetModuleRegistrations() {
|
|
|
|
|
return array(
|
|
|
|
|
array( array(
|
|
|
|
|
'msg' => 'Empty registry',
|
|
|
|
|
'modules' => array(),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [] );'
|
2014-03-07 18:29:23 +00:00
|
|
|
) ),
|
|
|
|
|
array( array(
|
|
|
|
|
'msg' => 'Basic registry',
|
|
|
|
|
'modules' => array(
|
|
|
|
|
'test.blank' => new ResourceLoaderTestModule(),
|
|
|
|
|
),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
|
|
|
|
"test.blank",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-03-07 18:29:23 +00:00
|
|
|
]
|
|
|
|
|
] );',
|
|
|
|
|
) ),
|
|
|
|
|
array( array(
|
|
|
|
|
'msg' => 'Group signature',
|
|
|
|
|
'modules' => array(
|
|
|
|
|
'test.blank' => new ResourceLoaderTestModule(),
|
|
|
|
|
'test.group.foo' => new ResourceLoaderTestModule( array( 'group' => 'x-foo' ) ),
|
|
|
|
|
'test.group.bar' => new ResourceLoaderTestModule( array( 'group' => 'x-bar' ) ),
|
|
|
|
|
),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
|
|
|
|
"test.blank",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-03-07 18:29:23 +00:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.group.foo",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
"x-foo"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.group.bar",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
"x-bar"
|
|
|
|
|
]
|
|
|
|
|
] );'
|
|
|
|
|
) ),
|
|
|
|
|
array( array(
|
|
|
|
|
'msg' => 'Different target (non-test should not be registered)',
|
|
|
|
|
'modules' => array(
|
|
|
|
|
'test.blank' => new ResourceLoaderTestModule(),
|
|
|
|
|
'test.target.foo' => new ResourceLoaderTestModule( array( 'targets' => array( 'x-foo' ) ) ),
|
|
|
|
|
),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
|
|
|
|
"test.blank",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-03-07 18:29:23 +00:00
|
|
|
]
|
|
|
|
|
] );'
|
|
|
|
|
) ),
|
|
|
|
|
array( array(
|
|
|
|
|
'msg' => 'Foreign source',
|
|
|
|
|
'sources' => array(
|
|
|
|
|
'example' => array(
|
|
|
|
|
'loadScript' => 'http://example.org/w/load.php',
|
|
|
|
|
'apiScript' => 'http://example.org/w/api.php',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'modules' => array(
|
|
|
|
|
'test.blank' => new ResourceLoaderTestModule( array( 'source' => 'example' ) ),
|
|
|
|
|
),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php",
|
|
|
|
|
"example": "http://example.org/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
|
|
|
|
"test.blank",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
null,
|
|
|
|
|
"example"
|
|
|
|
|
]
|
|
|
|
|
] );'
|
2014-04-30 21:06:51 +00:00
|
|
|
) ),
|
|
|
|
|
array( array(
|
|
|
|
|
'msg' => 'Conditional dependency function',
|
|
|
|
|
'modules' => array(
|
|
|
|
|
'test.x.core' => new ResourceLoaderTestModule(),
|
|
|
|
|
'test.x.polyfill' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'skipFunction' => 'return true;'
|
|
|
|
|
) ),
|
|
|
|
|
'test.y.polyfill' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'skipFunction' =>
|
|
|
|
|
'return !!(' .
|
|
|
|
|
' window.JSON &&' .
|
|
|
|
|
' JSON.parse &&' .
|
|
|
|
|
' JSON.stringify' .
|
|
|
|
|
');'
|
|
|
|
|
) ),
|
|
|
|
|
'test.z.foo' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'test.x.core',
|
2014-10-25 00:18:24 +00:00
|
|
|
'test.x.polyfill',
|
|
|
|
|
'test.y.polyfill',
|
2014-04-30 21:06:51 +00:00
|
|
|
),
|
|
|
|
|
) ),
|
|
|
|
|
),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-04-30 21:06:51 +00:00
|
|
|
[
|
|
|
|
|
"test.x.core",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-04-30 21:06:51 +00:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.x.polyfill",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-04-30 21:06:51 +00:00
|
|
|
[],
|
|
|
|
|
null,
|
2014-12-09 00:29:19 +00:00
|
|
|
null,
|
2014-04-30 21:06:51 +00:00
|
|
|
"return true;"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.y.polyfill",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-04-30 21:06:51 +00:00
|
|
|
[],
|
|
|
|
|
null,
|
2014-12-09 00:29:19 +00:00
|
|
|
null,
|
2014-04-30 21:06:51 +00:00
|
|
|
"return !!( window.JSON \u0026\u0026 JSON.parse \u0026\u0026 JSON.stringify);"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.z.foo",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-04-30 21:06:51 +00:00
|
|
|
[
|
2014-10-25 00:18:24 +00:00
|
|
|
0,
|
|
|
|
|
1,
|
|
|
|
|
2
|
2014-04-30 21:06:51 +00:00
|
|
|
]
|
|
|
|
|
]
|
|
|
|
|
] );',
|
2014-03-07 18:29:23 +00:00
|
|
|
) ),
|
|
|
|
|
array( array(
|
|
|
|
|
// This may seem like an edge case, but a plain MediaWiki core install
|
|
|
|
|
// with a few extensions installed is likely far more complex than this
|
|
|
|
|
// even, not to mention an install like Wikipedia.
|
|
|
|
|
// TODO: Make this even more realistic.
|
|
|
|
|
'msg' => 'Advanced (everything combined)',
|
|
|
|
|
'sources' => array(
|
|
|
|
|
'example' => array(
|
|
|
|
|
'loadScript' => 'http://example.org/w/load.php',
|
|
|
|
|
'apiScript' => 'http://example.org/w/api.php',
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
'modules' => array(
|
|
|
|
|
'test.blank' => new ResourceLoaderTestModule(),
|
|
|
|
|
'test.x.core' => new ResourceLoaderTestModule(),
|
|
|
|
|
'test.x.util' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'test.x.core',
|
|
|
|
|
),
|
|
|
|
|
) ),
|
|
|
|
|
'test.x.foo' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'test.x.core',
|
|
|
|
|
),
|
|
|
|
|
) ),
|
|
|
|
|
'test.x.bar' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'test.x.core',
|
|
|
|
|
'test.x.util',
|
|
|
|
|
),
|
|
|
|
|
) ),
|
|
|
|
|
'test.x.quux' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'test.x.foo',
|
|
|
|
|
'test.x.bar',
|
|
|
|
|
'test.x.util',
|
2013-07-07 22:51:15 +00:00
|
|
|
'test.x.unknown',
|
2014-03-07 18:29:23 +00:00
|
|
|
),
|
|
|
|
|
) ),
|
|
|
|
|
'test.group.foo.1' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'group' => 'x-foo',
|
|
|
|
|
) ),
|
|
|
|
|
'test.group.foo.2' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'group' => 'x-foo',
|
|
|
|
|
) ),
|
|
|
|
|
'test.group.bar.1' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'group' => 'x-bar',
|
|
|
|
|
) ),
|
|
|
|
|
'test.group.bar.2' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'group' => 'x-bar',
|
|
|
|
|
'source' => 'example',
|
|
|
|
|
) ),
|
|
|
|
|
'test.target.foo' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'targets' => array( 'x-foo' ),
|
|
|
|
|
) ),
|
|
|
|
|
'test.target.bar' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'source' => 'example',
|
|
|
|
|
'targets' => array( 'x-foo' ),
|
|
|
|
|
) ),
|
|
|
|
|
),
|
|
|
|
|
'out' => '
|
|
|
|
|
mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php",
|
|
|
|
|
"example": "http://example.org/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
|
|
|
|
"test.blank",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-03-07 18:29:23 +00:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.x.core",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-03-07 18:29:23 +00:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.x.util",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
2014-10-25 00:18:24 +00:00
|
|
|
1
|
2014-03-07 18:29:23 +00:00
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.x.foo",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
2014-10-25 00:18:24 +00:00
|
|
|
1
|
2014-03-07 18:29:23 +00:00
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.x.bar",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
2014-10-25 00:18:24 +00:00
|
|
|
2
|
2014-03-07 18:29:23 +00:00
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.x.quux",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[
|
2014-10-25 00:18:24 +00:00
|
|
|
3,
|
|
|
|
|
4,
|
2013-07-07 22:51:15 +00:00
|
|
|
"test.x.unknown"
|
2014-03-07 18:29:23 +00:00
|
|
|
]
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.group.foo.1",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
"x-foo"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.group.foo.2",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
"x-foo"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.group.bar.1",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
"x-bar"
|
|
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.group.bar.2",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-03-07 18:29:23 +00:00
|
|
|
[],
|
|
|
|
|
"x-bar",
|
|
|
|
|
"example"
|
|
|
|
|
]
|
|
|
|
|
] );'
|
|
|
|
|
) ),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideGetModuleRegistrations
|
2015-01-08 08:56:10 +00:00
|
|
|
* @covers ResourceLoaderStartUpModule::compileUnresolvedDependencies
|
2014-03-07 18:29:23 +00:00
|
|
|
* @covers ResourceLoaderStartUpModule::getModuleRegistrations
|
2013-07-07 22:51:15 +00:00
|
|
|
* @covers ResourceLoader::makeLoaderSourcesScript
|
|
|
|
|
* @covers ResourceLoader::makeLoaderRegisterScript
|
2014-03-07 18:29:23 +00:00
|
|
|
*/
|
|
|
|
|
public function testGetModuleRegistrations( $case ) {
|
|
|
|
|
if ( isset( $case['sources'] ) ) {
|
|
|
|
|
$this->setMwGlobals( 'wgResourceLoaderSources', $case['sources'] );
|
|
|
|
|
}
|
|
|
|
|
|
2014-12-19 00:52:28 +00:00
|
|
|
$context = $this->getResourceLoaderContext();
|
2014-03-07 18:29:23 +00:00
|
|
|
$rl = $context->getResourceLoader();
|
|
|
|
|
|
|
|
|
|
$rl->register( $case['modules'] );
|
|
|
|
|
|
2014-08-07 10:25:56 +00:00
|
|
|
$module = new ResourceLoaderStartUpModule();
|
2014-03-07 18:29:23 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
ltrim( $case['out'], "\n" ),
|
2014-08-07 10:25:56 +00:00
|
|
|
$module->getModuleRegistrations( $context ),
|
2014-03-07 18:29:23 +00:00
|
|
|
$case['msg']
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2014-04-30 21:06:51 +00:00
|
|
|
public static function provideRegistrations() {
|
|
|
|
|
return array(
|
|
|
|
|
array( array(
|
|
|
|
|
'test.blank' => new ResourceLoaderTestModule(),
|
|
|
|
|
'test.min' => new ResourceLoaderTestModule( array(
|
|
|
|
|
'skipFunction' =>
|
|
|
|
|
'return !!(' .
|
|
|
|
|
' window.JSON &&' .
|
|
|
|
|
' JSON.parse &&' .
|
|
|
|
|
' JSON.stringify' .
|
|
|
|
|
');',
|
|
|
|
|
'dependencies' => array(
|
|
|
|
|
'test.blank',
|
|
|
|
|
),
|
|
|
|
|
) ),
|
|
|
|
|
) )
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideRegistrations
|
|
|
|
|
*/
|
|
|
|
|
public function testRegistrationsMinified( $modules ) {
|
|
|
|
|
$this->setMwGlobals( 'wgResourceLoaderDebug', false );
|
|
|
|
|
|
2014-12-19 00:52:28 +00:00
|
|
|
$context = $this->getResourceLoaderContext();
|
2014-04-30 21:06:51 +00:00
|
|
|
$rl = $context->getResourceLoader();
|
|
|
|
|
$rl->register( $modules );
|
2014-08-07 10:25:56 +00:00
|
|
|
$module = new ResourceLoaderStartUpModule();
|
2014-04-30 21:06:51 +00:00
|
|
|
$this->assertEquals(
|
2015-07-27 22:47:05 +00:00
|
|
|
'mw.loader.addSource({"local":"/w/load.php"});' . "\n"
|
2014-04-30 21:06:51 +00:00
|
|
|
. 'mw.loader.register(['
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
. '["test.blank","wvTifjse"],'
|
|
|
|
|
. '["test.min","wvTifjse",[0],null,null,'
|
2014-04-30 21:06:51 +00:00
|
|
|
. '"return!!(window.JSON\u0026\u0026JSON.parse\u0026\u0026JSON.stringify);"'
|
|
|
|
|
. ']]);',
|
2014-08-07 10:25:56 +00:00
|
|
|
$module->getModuleRegistrations( $context ),
|
2014-04-30 21:06:51 +00:00
|
|
|
'Minified output'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @dataProvider provideRegistrations
|
|
|
|
|
*/
|
|
|
|
|
public function testRegistrationsUnminified( $modules ) {
|
2014-12-19 00:52:28 +00:00
|
|
|
$context = $this->getResourceLoaderContext();
|
2014-04-30 21:06:51 +00:00
|
|
|
$rl = $context->getResourceLoader();
|
|
|
|
|
$rl->register( $modules );
|
2014-08-07 10:25:56 +00:00
|
|
|
$module = new ResourceLoaderStartUpModule();
|
2014-04-30 21:06:51 +00:00
|
|
|
$this->assertEquals(
|
|
|
|
|
'mw.loader.addSource( {
|
2014-08-25 08:02:48 +00:00
|
|
|
"local": "/w/load.php"
|
2015-07-27 22:47:05 +00:00
|
|
|
} );
|
|
|
|
|
mw.loader.register( [
|
2014-04-30 21:06:51 +00:00
|
|
|
[
|
|
|
|
|
"test.blank",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse"
|
2014-04-30 21:06:51 +00:00
|
|
|
],
|
|
|
|
|
[
|
|
|
|
|
"test.min",
|
resourceloader: Enable module content version for data modules
This greatly simplifies logic required to compute module versions.
It also makes it significantly less error-prone.
Since f37cee996e, we support hashes as versions (instead of timestamps).
This means we can build a hash of the content directly, instead of compiling a
large array with all values that may influence the module content somehow.
Benefits:
* Remove all methods and logic related to querying database and disk for
timestamps, revision numbers, definition summaries, cache epochs, and more.
* No longer needlessly invalidate cache as a result of no-op changes to
implementation datails. Due to inclusion of absolute file paths in the
definition summary, cache was always invalidated when moving wikis to newer
MediaWiki branches; even if the module observed no actual changes.
* When changes are reverted within a certain period of time, old caches can now
be re-used. The module would produce the same version hash as before.
Previously when a change was deployed and then reverted, all web clients (even
those that never saw the bad version) would have re-fetch modules because the
version increased.
Updated unit tests to account for the change in version. New default version of
empty test modules is: "mvgTPvXh". For the record, this comes from the base64
encoding of the SHA1 digest of the JSON serialised form of the module content:
> $str = '{"scripts":"","styles":{"css":[]},"messagesBlob":"{}"}';
> echo base64_encode(sha1($str, true));
> FEb3+VuiUm/fOMfod1bjw/te+AQ=
Enabled content versioning for the data modules in MediaWiki core:
* EditToolbarModule
* JqueryMsgModule
* LanguageDataModule
* LanguageNamesModule
* SpecialCharacterDataModule
* UserCSSPrefsModule
* UserDefaultsModule
* UserOptionsModule
The FileModule and base class explicitly disable it for now and keep their
current behaviour of using the definition summary. We may remove it later, but
that requires more performance testing first.
Explicitly disable it in the WikiModule class to avoid breakage when the
default changes.
Ref T98087.
Change-Id: I782df43c50dfcfb7d7592f744e13a3a0430b0dc6
2015-06-02 17:27:23 +00:00
|
|
|
"wvTifjse",
|
2014-04-30 21:06:51 +00:00
|
|
|
[
|
2014-10-25 00:18:24 +00:00
|
|
|
0
|
2014-04-30 21:06:51 +00:00
|
|
|
],
|
|
|
|
|
null,
|
2014-12-09 00:29:19 +00:00
|
|
|
null,
|
2014-04-30 21:06:51 +00:00
|
|
|
"return !!( window.JSON \u0026\u0026 JSON.parse \u0026\u0026 JSON.stringify);"
|
|
|
|
|
]
|
|
|
|
|
] );',
|
2014-08-07 10:25:56 +00:00
|
|
|
$module->getModuleRegistrations( $context ),
|
2014-04-30 21:06:51 +00:00
|
|
|
'Unminified output'
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-07 18:29:23 +00:00
|
|
|
}
|