I'm running a site that uses SharedArrayBuffer (ffmpeg wasm) which strictly requires CORS (and/or site isolation), AND a Discord oauth2 workflow. After not looking at the site since earlier this year, I found out that it no longer works on the latest version of Chrome. Eventually I figured out that the problem with the Discord oauth flow was related to CORS.
When using window.open(), (same-origin) CORS will prevent your site from interacting with said new window if it's on another domain (if I understand it right). Checking the window promise returns that the window has closed (window.closed == true), even thought it hasn't.
I signed up for Origin Trials (hoping that same-origin-allow-popups actually works soon). That did fix the Discord part of the flow. Checking the window promise returns normal. BUT, once I get redirected back to my own site, it once again claims the window is closed (before I can get the oauth code).
Why would CORS prevent me from reading my own site? Is it because the previous document.domain was set to discord.com?
Does anyone know of any good ways to troubleshoot this kind of problem? CORS errors are common, but there are no CORS errors, just window.closed == true.