File tree Expand file tree Collapse file tree 3 files changed +28
-9
lines changed
main/java/org/openqa/selenium/htmlunit
test/java/org/openqa/selenium/htmlunit Expand file tree Collapse file tree 3 files changed +28
-9
lines changed Original file line number Diff line number Diff line change 5
5
6
6
<groupId >org.seleniumhq.selenium</groupId >
7
7
<artifactId >htmlunit3-driver</artifactId >
8
- <version >4.23.0 </version >
8
+ <version >4.24.0-SNAPSHOT </version >
9
9
10
10
<name >${project.artifactId} </name >
11
11
<description >WebDriver compatible driver for HtmlUnit headless browser</description >
Original file line number Diff line number Diff line change @@ -788,12 +788,31 @@ public void close() {
788
788
789
789
@ Override
790
790
public void quit () {
791
- if (webClient_ != null ) {
792
- alert_ .close ();
793
- webClient_ .close ();
794
- webClient_ = null ;
791
+ // closing the web client while some async processes are running
792
+ // will produce strange effects; therefore wait until they are done
793
+ while (runAsyncRunning_ ) {
794
+ try {
795
+ Thread .sleep (10 );
796
+ }
797
+ catch (final InterruptedException e ) {
798
+ throw new RuntimeException (e );
799
+ }
800
+ }
801
+
802
+ conditionLock_ .lock ();
803
+ runAsyncRunning_ = true ;
804
+ try {
805
+ if (webClient_ != null ) {
806
+ alert_ .close ();
807
+ webClient_ .close ();
808
+ webClient_ = null ;
809
+ }
810
+ defaultExecutor_ .shutdown ();
811
+ }
812
+ finally {
813
+ runAsyncRunning_ = false ;
814
+ conditionLock_ .unlock ();
795
815
}
796
- defaultExecutor_ .shutdown ();
797
816
}
798
817
799
818
@ Override
Original file line number Diff line number Diff line change @@ -543,15 +543,15 @@ protected WebDriver buildWebDriver() throws IOException {
543
543
}
544
544
if (webDriver_ == null ) {
545
545
final HtmlUnitDriverOptions driverOptions = new HtmlUnitDriverOptions (getBrowserVersion ());
546
-
546
+
547
547
if (isWebClientCached ()) {
548
548
driverOptions .setCapability (HtmlUnitOption .optHistorySizeLimit , 0 );
549
549
}
550
-
550
+
551
551
if (getWebClientTimeout () != null ) {
552
552
driverOptions .setCapability (HtmlUnitOption .optTimeout , getWebClientTimeout ());
553
553
}
554
-
554
+
555
555
webDriver_ = new HtmlUnitDriver (driverOptions );
556
556
webDriver_ .setExecutor (EXECUTOR_POOL );
557
557
}
You can’t perform that action at this time.
0 commit comments