I mean this 2 methods:
public int waitForBackgroundJavaScript(final long timeoutMillis)
public int waitForBackgroundJavaScriptStartingBefore(final long delayMillis)
We usually do this when opening a page:
Page p=webClient.getPage(...);
webClient.waitForBackgroundJavaScriptStartingBefore(5000);
I noticed in some cases background jobs are not executed. For example with this kind of onload function:
function my_onload() {
do_some_time_consuming_work(); //this costs like 2000ms
setTimeout(time_func, 0);
}
In the case above, I noticed the 'time_func' sometimes executed but sometimes did not.
With waitForBackgroundJavaScriptStartingBefore(5000) I expect that all jobs run normally and those jobs started before 5000 will complete. But the fact is not that case. I checked the source and found that the waitForBackgroundJavaScriptStartingBefore locks the job manager while adding job requires that lock. So there will be no jobs added to the job queue after the waitForBackgroundJavaScriptxxx() method starts. That's not what I expected.
Is that a problem or I miss understood?
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too