BetterCMS
BetterCMS copied to clipboard
Cross domain issue for ACE editor when loading CMS resources from CDN.
Issue is caused by ACE internal command:
new Worker("http://d3hf62uppzvupw.cloudfront.net/1.5.0/bcms-root/scripts/ace/worker-javascript.js")
https://github.com/ajaxorg/ace/issues/678
The situation is better than 2012 when #678 was closed. Browsers (including IE11) now support loading webworker from blob urls, so we can now XHR the worker code cross-domain (assuming our cdn has CORS headers), and, from there, load it from a blob.
Background: http://colonelpanic.net/2014/08/using-pdf-js-web-worker-cross-domain-cors/ Until recently, IE didn't support webworkers from blobs, but now they do: https://connect.microsoft.com/IE/feedback/details/801810/web-workers-from-blob-urls-in-ie-10-and-11
If we're concerned about IE10 for this case, we could check for webworker blob support and then fall back to a direct load if blobs aren' tsupported. https://github.com/adambom/parallel.js/issues/65
(Really the browsers should just respect CORS headers for webworker URLs.... But this works today.)