Commit graph

8 commits

Author SHA1 Message Date
Sam Smith
0bb3d2a499 Make ResourceLoaderFileModule#getAllStyleFiles include all skin styles
* Add the ResourceLoaderFileModule#getAllSkinStyleFiles method,
  which returns all of the skinStyles files for a given module
* The LessFileCompilationTest and checkLess.php script, which use
  the #getAllStyleFile method, now validate all LESS style files

Bug: 63343
Change-Id: Ib2eb5761919c648aea4ae58f8d0531799fe7982b
2014-06-17 19:38:58 +00:00
Timo Tijhof
75c08916b0 resourceloader: Implement "skip function" feature
A module can be registered with a skip function. Such function,
if provided, will be invoked by the client when a module is
queued for loading. If the function returns true, the client will
bypass any further loading action and mark the module as 'ready'.

This can be used to implement a feature test for a module
providing a shim or polyfill.

* Change visibility of method ResourceLoader::filter to public.

So that it can be invoked by ResourceLoaderStartupModule.

* Add option to suppress the cache key report in ResourceLoader::filter.

We usually only call the minifier once on an entire request
reponse (because it's all concatenated javascript or embedded
javascript in various different closures, still valid as one
large script) and only add a little bottom line for the cache
key. When embedding the skip function we have to run the minifier
on them separately as they're output as strings (not actual
functions). These strings are typically quite small and blowing
up the response with loads of cache keys is not desirable in
production.

* Add method to clear the static cache of ResourceLoader::inDebugMode.

Global static state is evil but, as long as we have it, we at
least need to clear it after switching contexts in the test suite.

Also:
* Remove obsolete setting of 'debug=true' in the FauxRequest in
  ResourceLoaderTestCase. It already sets global wgResourceLoaderDebug
  in the setUp() method.

Bug: 66390
Change-Id: I87a0ea888d791ad39f114380c42e2daeca470961
2014-06-12 03:48:26 +02:00
jenkins-bot
280cb03b4d Merge "resourceloader: Optimize module registry sent in the startup module" 2014-04-27 15:45:10 +00:00
Marius Hoch
df8176e8a5 resourceloader: Optimize module registry sent in the startup module
The optimization basically works like this:

* Given module A with the dependencies B and C and module B with the
  dependency C.
* Don't tell the client that A depends on C, as that's already included
  in module B.

This way we can reduce the amount of data for module registration sent
to the client.

The code here isn't polished yet, but it works and should be good enough
to demonstrate my idea and implementation.

Change-Id: I7732a3b1d879c5eef059e136a5241d6d48046872
2014-04-25 19:32:19 +02:00
Siebrand Mazeland
69ec133bc5 Pass phpcs-strict on some test files (10/11)
Change-Id: I5624292143fcabe890779f5095eae735d7afb176
2014-04-24 13:50:56 -07:00
Erik Bernhardson
efabc31da2 Resolve complex arguments to LESS helper functions
The icons in Flow and the Compact Personal Bar beta feature are missing,
their generated background-image 7 is empty.

The lessphp implementation passes full data frames into the helper
functions.  Utilize the now-public compileValue method of less
to evaluate the data frame into a string.

Additionally adds a small abstraction to run pairs of less/css files
as unit tests by executing the less file and comparing it to the
equivalent css file.

Change-Id: I1704f84638d86a0e6e6b9c190972ab19180bd484
2014-04-23 18:50:02 +00:00
Timo Tijhof
1a67f2dd5f tests: Add unit tests for ResourceLoaderStartupModule
Change-Id: I7671813e1d7b4ea75265608c22d8efe8805560e4
2014-03-07 20:15:35 +01:00
Timo Tijhof
9976cef4ed tests: Add ResourceLoaderTestCase and abstract context creation
Change-Id: Ib4b265256e60a2f2109da73dc7edba6a75587ce2
2014-03-07 20:09:59 +01:00