Fix Leaflet problem with resource loader

This is a partial re-submit of https://gerrit.wikimedia.org/r/#/c/49202/

Change by Pastakhov

Change-Id: I08c3ddad4ca65faad9d610fcf75d38f15a511fb3
Merge "Fix Leaflet problem with resource loader"