Giter VIP home page Giter VIP logo

Comments (5)

ackava avatar ackava commented on May 10, 2024

We actually forgot to add support for string parameter in setTimeout and setInterval methods, so they will not work anyway.
We are evaluating how to add CSP support, meanwhile you can override eval and function as shown below.

var context = new JSContext();
context[KeyStrings.eval] = new JSFunction((in Arguments a) => throw context.NewTypeError("Not supported"));
context["Function"] = new JSFunction((in Arguments a) => throw context.NewTypeError("Not supported"));

Let me know if you face some issue.

from yantra.

tonto7973 avatar tonto7973 commented on May 10, 2024

Hello,
I've tried the approach you outlined. eval works fine, but I'm getting an exception when defining Function:

YantraJS.Core.JSException
  HResult=0x80131500
  Message=Cannot modify property Function of [object Object]
  Source=YantraJS.Core
  StackTrace:
at Item in /home/runner/work/yantra/yantra/YantraJS.Core/Core/Object/JSObject.cs:line 459

Using version 1.1.220.
Not sure if there is any othe rworkaround.
Thanks.

from yantra.

ackava avatar ackava commented on May 10, 2024

@tonto7973

I have added EvalEvent inside JSContext which lets you throw an exception as shown below. You can ignore earlier approach.

var context = new JSContext();
context.EvalEvent += (s, e) => throw context.NewTypeError("Eval not supported");

This should work. This event will be fired in eval and in Function constructor.

from yantra.

tonto7973 avatar tonto7973 commented on May 10, 2024

Hi @ackava, this helped. Many thanks.

from yantra.

ackava avatar ackava commented on May 10, 2024

@tonto7973

We are happy that we were able to help you, please do not forget to put star and please promote our Engine on social media and on your blog when you get a chance.

from yantra.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.