Module Load Progress Events In NaCl With Manifest_version = 2 And No Inline Javascript
I upgraded my manifest_version to '2' as per this document, and then was suprised to see chrome burping up errors like: Refused to execute inline script because it violates the fo
Solution 1:
According to the documentation for NaCl progress events, event listeners have to be added as follows:
<div id="listener">
<script type="text/javascript">
document.getElementById('listener').addEventListener('load', function() {
// Example
}, true);
</script>
<embed name="nacl_module" ... type="application/x-nacl" />
</div>
This if forbidden by the Content security policy (see also). There's only one way to solve it: By moving the script to an external file:
<div id="listener">
<script src="listener-load.js"></script>
<embed name="nacl_module" ... type="application/x-nacl" />
</div>
// listener-load.js:
document.getElementById('listener').addEventListener('load', ..., true);
Because the construction of the DOM blocks until the external file is loaded, the script is loaded before the <embed>
tag is inserted. Since the external files are packaged with the extension, the impact on performance can be neglected.
Post a Comment for "Module Load Progress Events In NaCl With Manifest_version = 2 And No Inline Javascript"