JS backend: Cherry-pick 8b8ebe0