Both the core-accretion and disk-instability models suggest that at the last stage of the formation of a gas-giant, the core of this object is surrounded by an extended gaseous envelope. At this stage, while the envelope is contracting, planetesimals from the protoplanetary disk may be scattered into the protoplanets atmosphere and deposit some or all of their materials as they interact with the gas. We have carried out extensive simulations of approximately 104 planetesimals interacting with a envelope of a Jupiter-mass protoplanet including effects of gas drag, heating, and the effect of the protoplanets extended mass distribution. Simulations have been carried out for different radii and compositions of planetesimals so that all three processes occur to different degrees. We present the results of our simulations and discuss their implications for the enrichment of ices in giant planets. We also present statistics for the probability of capture (i.e. total mass-deposition) of planetesimals as a function of their size, composition, and closest approach to the center of the protoplanetary body.