resourceloader: Use mw.log instead of 'throw' for scripts with syntax errors
authorTimo Tijhof <krinklemail@gmail.com>
Mon, 1 Jun 2015 23:06:46 +0000 (00:06 +0100)
committerOri.livneh <ori@wikimedia.org>
Tue, 2 Jun 2015 22:43:46 +0000 (22:43 +0000)
commitcd0dff5c0056a06c7c02a1975554a827db754301
tree76d27bd25bafd6aa136e46cc01ffc07ac590e4d5
parente3e20c5bf7501b340e3ae002b3a23e4ecda861ed
resourceloader: Use mw.log instead of 'throw' for scripts with syntax errors

For scripts loaded from load.php using mw.loader.implement(), an
exception is handled fine and results in the module state progressing
from 'loading' to 'errror'.

However, for wikis modules loaded with only=scripts from the HTML directly,
there is no wrapper. As such, the state() call appended to the script is
never reached and the module indefinitely stays "loading".

VisualEditor (and others) already explicitly ignore the error state
of the wiki modules (with inline mw.loader.using and casting the Promise to resolved).
However in this case the Promise never completed to neither success nor failure.

As such, this was causing users with syntax errors in their user script to
encounter a stuck VisualEditor loading bar that never goes beyond 70%.

Change-Id: I091a020bdd3392b965e0e25d03b216037fadc48f
includes/resourceloader/ResourceLoaderModule.php