execution while using chunked transfer coding. Assumes that JS_DestroyIdArray(session->js_cx, heads); actually removes everything from the array.