Philip added and documented a memory leak in rP5154 (Update: fake news, there is no leak).
At least with SM38, the JS value representing the GUI object is persistently rooted, and PersistentRooting means it's registered with the ScriptRuntime rather than the JSContext.
But GUI Pages don't have a custom ScriptRuntime, only a JSContext, so these JSObjects will remain allocated forever (Update: wrong, automatic unrooting upon destruction, i.e. on close page).
Other than that, JS::Heap also seems better practice than PersistentRooting (Update: only when initialization / rooting and unrooting is considered).
The patch uses a JS::Value instead of a JSObject to distinguish initialized from uninitialized cache.