BetterCMS icon indicating copy to clipboard operation
BetterCMS copied to clipboard

Cross domain issue for ACE editor when loading CMS resources from CDN.

Open ghost opened this issue 10 years ago • 3 comments

image

ghost avatar May 06 '14 14:05 ghost

Issue is caused by ACE internal command:

new Worker("http://d3hf62uppzvupw.cloudfront.net/1.5.0/bcms-root/scripts/ace/worker-javascript.js")

ghost avatar May 08 '14 08:05 ghost

https://github.com/ajaxorg/ace/issues/678

ghost avatar Jun 14 '14 06:06 ghost

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.)

davidbau avatar Aug 24 '14 15:08 davidbau