[PATCH v6 10/11] jscript: Move filling the PROTREF into a helper.