Samsung / jalangi2

Dynamic analysis framework for JavaScript
Apache License 2.0
435 stars 119 forks source link

Webworkers #87

Open infra-0-0 opened 8 years ago

infra-0-0 commented 8 years ago

Possibly a bug in Jalangi2.

Expected behavior:

Actual behavior:

stroucki commented 3 years ago

Webworkers are isolated from the main context. I'm looking to somehow bridge it to allow the code to run, though I'm pretty sure I have no hope of getting data out. @msridhar any comment on this issue?

msridhar commented 3 years ago

@stroucki what is your goal exactly? As you note, webworkers are isolated and can only communicate via message passing. You could probably move data around by creating appropriate message handlers via your analysis and then passing data around in the endExecution() callback. But it would be some work.

stroucki commented 3 years ago

@msridhar I would like to instrument the javascript of a large commercial site, using jalangi via a proxy. The proxy instruments the code, but if it is running in a worker, it dies immediately from the undefined reference.

The site renders without the worker working, but I'm trying to be as complete as I can be.

msridhar commented 3 years ago

Thanks for the details. This seems tricky to fix. One solution would be to load the core Jalangi runtime scripts (and the analysis scripts) within each worker. But, in the proxy, I don't think you can tell whether a script will be loaded in the main context or within a worker. If there were some way to tell, that would be useful. Otherwise, I don't immediately have an idea on how to solve this.

stroucki commented 3 years ago

I am currently thinking of adding a check for J$ being undefined at the beginning of a script, and trying to set up J$ accordingly if so.

msridhar commented 3 years ago

Let us know if you are successful!

On Oct 14, 2021 at 2:00:46 PM, stroucki @.***> wrote:

I am currently thinking of adding a check for J$ being undefined at the beginning of a script, and trying to set up J$ accordingly if so.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Samsung/jalangi2/issues/87#issuecomment-943728483, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABPEUIGDXFTKWYI6B3TSK3UG5AH5ANCNFSM4B44EKUQ .