resourceloader: Remove module stringification from execute path
authorTimo Tijhof <krinklemail@gmail.com>
Fri, 31 Aug 2018 03:02:18 +0000 (04:02 +0100)
committerKrinkle <krinklemail@gmail.com>
Tue, 4 Sep 2018 17:55:25 +0000 (17:55 +0000)
After execute() is finished and markModuleReady() is called,
the execute path reaches handlePending() which calls
mw.loader.store.set(). This prepares the contents of the module
we just finished executing, for localStorage.

While the writing to localStorage was already debounced via #update,
the stringification of all functions and stylesheets was still
happening within the execute path, and other checks as well.

This commit replaces the mw.loader.store.set() call with a new
method mw.loader.store.add(). The serialisation is now performed
as part of flushWrites(), which is the debounced update that
happens in an idle callback.

While mw.loader.store is itself private within mw.loader, this
commit also marks the set() and update() methods as @private
within mw.loader.store as they are not (and should not) called
from outside this class.

Bug: T202703
Bug: T127328
Change-Id: I23ef28e096acf3bab57b88922ba21366fed06155


No differences found