[HtmlUnit] SVN: [13832] branches/huThread/htmlunit/src/main/java/com/gargoylesoftware /htmlunit/javascript/JavaScriptEngine.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[HtmlUnit] SVN: [13832] branches/huThread/htmlunit/src/main/java/com/gargoylesoftware /htmlunit/javascript/JavaScriptEngine.java

asashour-2
Revision: 13832
          http://sourceforge.net/p/htmlunit/code/13832
Author:   asashour
Date:     2017-03-19 21:39:54 +0000 (Sun, 19 Mar 2017)
Log Message:
-----------
thread: update

Modified Paths:
--------------
    branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java

Modified: branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java
===================================================================
--- branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2017-03-19 21:38:57 UTC (rev 13831)
+++ branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/JavaScriptEngine.java 2017-03-19 21:39:54 UTC (rev 13832)
@@ -101,7 +101,7 @@
 
     private static final Log LOG = LogFactory.getLog(JavaScriptEngine.class);
 
-    private final WebClient webClient_;
+    private WebClient webClient_;
     private final HtmlUnitContextFactory contextFactory_;
     private final JavaScriptConfiguration jsConfig_;
 
@@ -632,10 +632,12 @@
      * @param webWindow the WebWindow to be registered.
      */
     public synchronized void registerWindowAndMaybeStartEventLoop(final WebWindow webWindow) {
-        if (javaScriptExecutor_ == null) {
-            javaScriptExecutor_ = BackgroundJavaScriptFactory.theFactory().createJavaScriptExecutor(webClient_);
+        if (webClient_ != null) {
+            if (javaScriptExecutor_ == null) {
+                javaScriptExecutor_ = BackgroundJavaScriptFactory.theFactory().createJavaScriptExecutor(webClient_);
+            }
+            javaScriptExecutor_.addWindow(webWindow);
         }
-        javaScriptExecutor_.addWindow(webWindow);
     }
 
     /**
@@ -655,6 +657,7 @@
      * Shutdown the JavaScriptEngine.
      */
     public void shutdown() {
+        webClient_ = null;
         if (javaScriptExecutor_ != null) {
             javaScriptExecutor_.shutdown();
             javaScriptExecutor_ = null;


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop
Loading...