embind relies on new Function() to generate high-performance marshaling
code.  Are there plans to make Emscripten run in an environment without new
Function()?



On Wed, May 14, 2014 at 2:03 PM, juj <notifications@github.com> wrote:

> In src/preamble.js:
>
> > +
> > +    // When the code is compressed, the name of cfunc is not literally 'cfunc' anymore
> > +    var cfuncname = parseJSFunc(function(){return cfunc}).returnValue;
> > +    // Call the function
> > +    funcstr += 'var ret = ' + cfuncname + '(' + argNames.join(',') + ');';
> > +    if (!numericRet) { // Return type can only by 'string' or 'number'
> > +      // Convert the result to a string
> > +      var strgfy = parseJSFunc(function(){return Pointer_stringify}).returnValue;
> > +      funcstr += 'ret = ' + strgfy + '(ret);';
> > +    }
> > +    if (!numericArgs) {
> > +      // If we had a stack, restore it
> > +      funcstr += JSsource['stackRestore'].body + ';';
> > +    }
> > +    funcstr += 'return ret})';
> > +    return eval(funcstr);
>
> On a side note, since both eval() and new Function are restricted by a
> content security policy in packaged web apps (see here
> https://developer.chrome.com/extensions/contentSecurityPolicy ), is there
> a way to avoid using either?
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/kripken/emscripten/pull/2345/files#r12661282>
> .
>



-- 
Chad Austin
Technical Director, IMVU
http://engineering.imvu.com <http://www.imvu.com/members/Chad/>
http://chadaustin.me