It only applies to weapon attacks ("successful weapon attack"), so it would not apply to physical or melee attacks.
It does apply to all damage the attack would do, regardless of how the attack came to that damage (damage value, rear, overheat, etc). You determine how much damage the attack would do, then before applying that damage, roll for each point of damage.