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