jalangi2 icon indicating copy to clipboard operation
jalangi2 copied to clipboard

Webworkers

Open infra-0-0 opened this issue 9 years ago • 6 comments

Possibly a bug in Jalangi2.

  • launch jalangi2 proxy @ bc854106567f0d30c4e0aab0bc02ea9d5692a28c
  • navigate to http://www.w3schools.com/HTML/html5_webworkers.asp
  • click "Start Worker"

Expected behavior:

  • counter increments

Actual behavior:

  • webworker code is not instrumented with Jalangi2 code available in the main session as 'window.J$'
  • counter does not increment
  • "ReferenceError: J$ is not defined"

infra-0-0 avatar Mar 02 '16 01:03 infra-0-0

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?

stroucki avatar Oct 14 '21 05:10 stroucki

@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.

msridhar avatar Oct 14 '21 15:10 msridhar

@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.

stroucki avatar Oct 14 '21 19:10 stroucki

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.

msridhar avatar Oct 14 '21 20:10 msridhar

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.

stroucki avatar Oct 14 '21 21:10 stroucki

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 .

msridhar avatar Oct 14 '21 21:10 msridhar