Replace XHR events for generic ones in ScriptTask

fixup! Replace XHR events for generic ones in ScriptTask

fixup! Replace XHR events for generic ones in ScriptTask
auto merge of #4474 : thiagopnts/servo/generic-msgs, r=jdm

This refs #3735. As discussed in the issue, I did it cloning when I couldn't dereference an attribute. The trait method should be on `&self` for object-safety reasons.