resourceloader: Remove checkCssHandles for modules without styles
authorTimo Tijhof <krinklemail@gmail.com>
Sun, 26 Aug 2018 03:44:10 +0000 (04:44 +0100)
committerTimo Tijhof <krinklemail@gmail.com>
Tue, 28 Aug 2018 04:40:55 +0000 (05:40 +0100)
commit71f186c3802f8fc861e2af2dcf0127e7697e7554
tree934b83c4ec36e35c3d062dab690e8cdf7035bd63
parent19f4db30385518772f00ddf14bd948f467624b24
resourceloader: Remove checkCssHandles for modules without styles

When execute() begins, we are in a stack that is suitable for
script execution. In the case of styles needing to be inserted,
we end that stack by scheduling the styles insertion via
requestAnimationFrame. When that styles insertion is completed,
we are currently continuing the script execution in that same
stack, which is bad for performance and also creates a confusing
call stack, given that none of that code is paint or animation
related.

Before we can address that, e.g. by unwinding the stack via
requestIdleCallback, we first need to clean up the code to not
needlessly involve checkCssHandles for modules without styles.

Most modules are small and have only scripts, no styles, so this
is important to keep in a single stack and rapidly executed in
one batch - without interuption.

This commit moves the logic that was previously inside checkCssHandles
to the bottom of execute(), which is where checkCssHandles used to
be called from.

Bug: T202703
Change-Id: I13a996e01b48bab477e68ce933a5e2ef05b361aa
resources/src/startup/mediawiki.js