Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change wait/wake tests and $262.agent to work properly in a browser #928

Open
lars-t-hansen opened this issue Mar 22, 2017 · 1 comment
Open
Assignees

Comments

@lars-t-hansen
Copy link
Contributor

The wait/wake tests were not written to work in a browser, only in a JS shell, and there are several things that must change before they can work in a browser:

For example, Firefox requires the creator of a Worker to return to the event loop after creating the Worker, before the Worker will start. (ISTR that @binji told me at some point he thinks Chrome may have the same restriction.) The wait/wake tests currently assume that $262.agent.start() will start the worker and the test can just forge ahead; it just ain't so. At a minimum, $262.agent.start() must take a continuation to be invoked once the worker is properly up, in the manner of $262.agent.broadcast().

For another example, $262.agent.sleep() is used on the main thread in these tests, and that is OK for a shell but generally a problem in the browser: If the main thread is busy-waiting for something to happen on the worker while the worker happens to need the main thread to accomplish something, we'll deadlock. (At least in Firefox the main thread performs some work on behalf of workers.) And busy-waiting is the only way to implement sleep on the main thread, absent a callback-based method. The appropriate fix here is likely to remove $262.agent.sleep() on the main thread - it should still be available in an agent - and to rewrite the tests, probably by adding new agents that perform the tasks currently performed by the main thread. Additional $262.agent functionality may be needed to trigger a callback in the main thread that the test is finished.

/cc @binji, @akroshg, @pizlonator, @syg

@delta62
Copy link

delta62 commented Jun 24, 2019

It would be very convenient to run these tests from within a browser! Is this on anyone's radar to fix? If not, is there any way I can contribute?

It seems that this would be an interface change for the harness API as well as an update to all tests utilizing sleep and agent.start().

@rwaldron rwaldron self-assigned this Nov 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants