-
Notifications
You must be signed in to change notification settings - Fork 287
Don't allow timeouts to be registered when shutting down #802
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
Conversation
Currently, a timeout that sets a timeout can cause loop.run to block forever. Also, cleanup URL stitch with leading './'. The resulting URL was valid, but since we use the URL as the module cache key, it's important to resolve various representations of the same URL in the same way.
|
Initial version of this didn't work well. The goal is to prevent this type of code: function logEvents() {
send(events);
setTimeout(logEvents, 3000);From making loop.run() run forever. However, simply preventing timeouts from being registered during "shutdown" can break pages. For example, our fetch.js does this: onload: function() {
// ...
setTimeout(function() {
resolve(new Response(body, options));
}, 0);
}Which means that something like: fetch(request).then((res) => {.....});may not work if In other words, some timeouts we want to ignore, and some we don't. But I don't think we can tell which is why so, for now, I just added a timeout. |
| }; | ||
|
|
||
| try page.wait(); | ||
| try page.wait(std.time.ns_per_s * 3); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we will like to set a user-facing option at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we take a param, it should get used/passed to:
browser/src/browser/html/window.zig
Line 220 in cb35b36
| if (delay > 5000) { |
I was thinking something a bit fancier. Accepting an arbitrary JS script, e.g. --eval "document.getElementbyId('comments')" which we run on every loop and, when it returns a truthy JS value, we exit.
Currently, a timeout that sets a timeout can cause loop.run to block forever.
Also, cleanup URL stitch with leading './'. The resulting URL was valid, but since we use the URL as the module cache key, it's important to resolve various representations of the same URL in the same way.