Re: [ace] window.console

604 views
Skip to first unread message

Harutyun Amirjanyan

unread,
Nov 8, 2012, 2:38:23 PM11/8/12
to ace-d...@googlegroups.com
worker shouldn't be included in window it's meant to be loaded into webWorker
https://github.com/ajaxorg/ace/wiki/Building-Ace-with-r.js-optimizer

i'll add a descriptive error message to it
since this question comes up very often.

iruff

unread,
Nov 8, 2012, 3:23:18 PM11/8/12
to ace-d...@googlegroups.com
My apologies on the double similar messages...

Ok, so let me back up then. If I just try to do the most simple case where I do a copy/paste of the example of embedding into an html file, I get this error in the Chrome console

Could not load worker ace.js:1
DOMException
  1. code18
  2. message"SECURITY_ERR: DOM Exception 18"
  3. name"SECURITY_ERR"
  4. stack"Error: An attempt was made to break through the security policy of the user agent.↵ at new g (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:262767)↵ at createWorker (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/mode-javascript.js:1:1649)↵ at $startWorker (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:77728)↵ at setMode (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:77029)↵ at http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:76911↵ at i (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:75960)↵ at e (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:1024)↵ at i (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:1630)↵ at HTMLScriptElement.<anonymous> (http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js:1:76296)"
  5. __proto__DOMException
ace.js:1
Directly linking to the worker was my workaround for the above error, but of course produced the error you responded about. I've attached the html, but it should be a near copy/paste with the exception of my failed workarounds being commented out.

Thanks for the quick reply!
Isaiah
ace.html

Harutyun Amirjanyan

unread,
Nov 8, 2012, 3:34:30 PM11/8/12
to ace-d...@googlegroups.com
due to same origin restrictions workers can't be loaded from cdn
you need to put them on your site, and add
ace.config.set("workerPath", "path/to/ace/src-min");

iruff

unread,
Nov 8, 2012, 3:48:39 PM11/8/12
to ace-d...@googlegroups.com
That did the trick thanks! Awesome tool!!
Reply all
Reply to author
Forward
0 new messages