Quantcast

[HtmlUnit] SVN: [13829] branches/huThread/htmlunit/src

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: [13829] branches/huThread/htmlunit/src

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

Modified Paths:
--------------
    branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
    branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
    branches/huThread/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java

Modified: branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java
===================================================================
--- branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-03-19 19:00:00 UTC (rev 13828)
+++ branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/WebClient.java 2017-03-19 19:37:31 UTC (rev 13829)
@@ -498,7 +498,8 @@
         WebAssert.notNull("webResponse", webResponse);
         WebAssert.notNull("webWindow", webWindow);
 
-        if (webResponse.getStatusCode() == HttpStatus.SC_NO_CONTENT) {
+        if (webResponse.getStatusCode() == HttpStatus.SC_NO_CONTENT
+                || scriptEngine_ == null) {
             return webWindow.getEnclosedPage();
         }
 
@@ -1836,6 +1837,7 @@
         // start a new window that will start the thread again
         if (scriptEngine_ != null) {
             scriptEngine_.shutdown();
+            scriptEngine_ = null;
         }
 
         try {

Modified: branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java
===================================================================
--- branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java 2017-03-19 19:00:00 UTC (rev 13828)
+++ branches/huThread/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/DomElement.java 2017-03-19 19:37:31 UTC (rev 13829)
@@ -1390,6 +1390,10 @@
             }
         };
 
+        final JavaScriptEngine engine = client.getJavaScriptEngine();
+        if (engine == null) {
+            return null;
+        }
         final ContextFactory cf = client.getJavaScriptEngine().getContextFactory();
         final ScriptResult result = (ScriptResult) cf.call(action);
         if (event.isAborted(result)) {

Modified: branches/huThread/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java
===================================================================
--- branches/huThread/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java 2017-03-19 19:00:00 UTC (rev 13828)
+++ branches/huThread/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/WebDriverTestCase.java 2017-03-19 19:37:31 UTC (rev 13829)
@@ -1096,17 +1096,6 @@
             //          }
             //          webClient_ = null;
             List<Thread> jsThreads = getJavaScriptThreads();
-            int waitCount = 0;
-            while (jsThreads.size() > 0 && waitCount < 10) {
-                try {
-                    waitCount++;
-                    Thread.sleep(100);
-                }
-                catch (final InterruptedException e) {
-                    // ignore
-                }
-                jsThreads = getJavaScriptThreads();
-            }
             assertEquals("There are still " + jsThreads.size()
             + " JS threads running after the test", 0, jsThreads.size());
         }


------------------------------------------------------------------------------
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...