Revision: 797
          http://jwebunit.svn.sourceforge.net/jwebunit/?rev=797&view=rev
Author:   henryju
Date:     2009-02-28 12:48:03 +0000 (Sat, 28 Feb 2009)

Log Message:
-----------
[2647451] Exposed option to toggle exceptions on Javascript errors. (thanks to 
Kent R. Spillner)

Modified Paths:
--------------
    
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
    
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
    
trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java
    trunk/src/changes/changes.xml

Modified: 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
===================================================================
--- 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
  2009-02-05 16:37:19 UTC (rev 796)
+++ 
trunk/jwebunit-core/src/main/java/net/sourceforge/jwebunit/api/ITestingEngine.java
  2009-02-28 12:48:03 UTC (rev 797)
@@ -67,6 +67,13 @@
     void setScriptingEnabled(boolean value);
 
     /**
+     * Set whether or not to throw an exception on Javascript errors.
+     * 
+     * @param value true to throw an exception on Javascript errors.
+     */
+    void setThrowExceptionOnScriptError(boolean value);
+
+    /**
      * Get all cookies.
      * 
      * @return List of javax.servlet.http.Cookie.

Modified: 
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
===================================================================
--- 
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
       2009-02-05 16:37:19 UTC (rev 796)
+++ 
trunk/jwebunit-htmlunit-plugin/src/main/java/net/sourceforge/jwebunit/htmlunit/HtmlUnitTestingEngineImpl.java
       2009-02-28 12:48:03 UTC (rev 797)
@@ -128,6 +128,11 @@
     private boolean jsEnabled = true;
 
     /**
+     * Should throw exception on Javascript error.
+     */
+    private boolean throwExceptionOnScriptError = true;
+
+    /**
      * Javascript alerts.
      */
     private LinkedList<JavascriptAlert> expectedJavascriptAlerts = new 
LinkedList<JavascriptAlert>();
@@ -236,6 +241,13 @@
         }
     }
 
+    public void setThrowExceptionOnScriptError(boolean value) {
+        throwExceptionOnScriptError = value;
+        if (wc != null) {
+            wc.setThrowExceptionOnScriptError(throwExceptionOnScriptError);
+        }
+    }
+
     public List<javax.servlet.http.Cookie> getCookies() {
         List<javax.servlet.http.Cookie> result = new 
LinkedList<javax.servlet.http.Cookie>();
         Set<Cookie> cookies = wc.getCookieManager().getCookies();
@@ -745,7 +757,7 @@
             wc = new WebClient(bv);
         }
         wc.setJavaScriptEnabled(jsEnabled);
-        wc.setThrowExceptionOnScriptError(true);
+        wc.setThrowExceptionOnScriptError(throwExceptionOnScriptError);
         wc.setRedirectEnabled(true);
         wc.setRefreshHandler(new ImmediateRefreshHandler());
         wc.setTimeout(timeout);

Modified: 
trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java
===================================================================
--- 
trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java
       2009-02-05 16:37:19 UTC (rev 796)
+++ 
trunk/jwebunit-selenium-plugin/src/main/java/net/sourceforge/jwebunit/selenium/SeleniumTestingEngineImpl.java
       2009-02-28 12:48:03 UTC (rev 797)
@@ -430,6 +430,10 @@
                if(value == false) throw new 
UnsupportedOperationException("setScriptingEnabled");
        }
 
+       public void setThrowExceptionOnScriptError(boolean value) {
+               throw new 
UnsupportedOperationException("setThrowExceptionOnScriptError");
+       }
+
        public void setTextField(String inputName, String text) {
                String xpath1 = formSelector() + "//inp...@name='" + inputName
                                + "' and (@type='text' or @type='password' or 
@type='file')]";

Modified: trunk/src/changes/changes.xml
===================================================================
--- trunk/src/changes/changes.xml       2009-02-05 16:37:19 UTC (rev 796)
+++ trunk/src/changes/changes.xml       2009-02-28 12:48:03 UTC (rev 797)
@@ -8,6 +8,9 @@
     </properties>
     <body>
         <release version="2.2" date="UNKNOW">
+            <action type="add" dev="henryju" issue="2647451" due-to="Kent R. 
Spillner">
+                Exposed option to toggle exceptions on Javascript errors.
+            </action>
             <action type="fix" dev="henryju" issue="2568604" 
due-to="Umkhulubaas">
                 Used buffered output stream to improve WebTester.saveAs method 
performances.
             </action>


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
JWebUnit-development mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jwebunit-development

Reply via email to