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