jpillora / xdomain

A pure JavaScript CORS alternative
https://jpillora.com/xdomain/
3.12k stars 270 forks source link

Fix postMessage on the host #223

Open majkelcc opened 2 years ago

majkelcc commented 2 years ago

Currently xdomain modifies the original data array in the postMessage handler, which breaks other scripts on the host that send arrays using postMessage.

majkelcc commented 2 years ago

After discovering that attempting to clone FormData object can result in error in some cases, I changed the fix so that it doesn't use new methods and only allows xdomain to modify the data after checking that the message originated from the library.