Skip to content

Debugging Script Parse Errors

Paul-E edited this page Jan 10, 2014 · 2 revisions

Script parse errors are a class of bugs which arise because there is some bug in your script, but when using importScripts within a WebWorker, no useful stack trace is provided to help you locate the syntax error.

The solution is to load your code not in a web worker.

To make this easier, freedom provides a configuration option to switch the freedom module structure temporarily from web worker containment to iframe containment. The iframe containment is the isolation used for our unit tests, and works equivalently to the web worker structure - but does not provide the same level of security and isolation.

The easiest way to switch freedom to use iframes is to edit your script tag to include the portType:"frame" option. An example would be:

     <script type='text/javascript' src='freedom.js' data-manifest='manifest.json'>
     {"portType": "Frame"}
     </script>