resourceloader: Throw exception when config serialization fails
authorRoan Kattouw <roan.kattouw@gmail.com>
Tue, 9 Oct 2018 20:43:56 +0000 (13:43 -0700)
committerKrinkle <krinklemail@gmail.com>
Thu, 11 Oct 2018 21:08:28 +0000 (21:08 +0000)
commitabd3c02d08113027214fca69b8b776d2b2cd81ec
treebe79c572d62e9aad96929ffdb1f97c97b7796d95
parent329f0cfb6c243b366973f8e7360aac18ef924e69
resourceloader: Throw exception when config serialization fails

If something puts a string that's invalid UTF-8 in a JS config variable,
JSON serialization will fail on the entire config blob. Currently, this
causes the entire config blob to be silently dropped, which breaks all
JavaScript because elementary variables like wgPageName are missing.

This change makes this scenario fail loudly rather than quietly, by
throwing an exception. This also makes bugs like these easier to track
down.

Bug: T206475
Change-Id: Ief2ae00228389a23627d440dc1cd9a54cf2b6926
includes/resourceloader/ResourceLoader.php