Search code examples
firefox-addonace-editor

Mozilla Add-on allow Ace Editor code validation


Ace Editor uses this thing called 'blob' to create the Worker (which finds errors in code) and I want to use it in my Firefox extension. The console log showed errors like:

Content Security Policy: The page's settings blocked the loading of a resource at blob:moz-extension://{extension-private-uuid}

I am able to fix this using

"content_security_policy": "script-src 'self' blob:; object-src 'self'",

but I read that Add-ons that use the blob: keyword will get rejected from AMO because of major security risks. Is that likely still the case considering that it's a library? If so, then is there any other way of getting the worker to work without blob and without editing any files?


Solution

  • Ok I found the solution.

    There is an Ace Editor setting

    ace.config.set('loadWorkerFromBlob', false); 
    

    which disables the loading of the worker file via blob. Yayyy!