De-duplicate process spawning code in Process JS extension.

Change-Id: Iaf6322dca94a60178734c0edd720eb409e48d50a
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>