Quantcast

[HtmlUnit] SVN: [14452] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ html

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: [14452] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ html

rbri
Revision: 14452
          http://sourceforge.net/p/htmlunit/code/14452
Author:   rbri
Date:     2017-05-14 07:59:08 +0000 (Sun, 14 May 2017)
Log Message:
-----------
remove not used parameter

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2017-05-14 07:08:22 UTC (rev 14451)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlPage.java 2017-05-14 07:59:08 UTC (rev 14452)
@@ -944,13 +944,12 @@
      * <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
      *
      * @param srcAttribute the source attribute from the script tag
-     * @param charset the charset from the script tag
      * @return the result of loading the specified external JavaScript file
      * @throws FailingHttpStatusCodeException if the request's status code indicates a request
      *         failure and the {@link WebClient} was configured to throw exceptions on failing
      *         HTTP status codes
      */
-    JavaScriptLoadResult loadExternalJavaScriptFile(final String srcAttribute, final Charset charset)
+    JavaScriptLoadResult loadExternalJavaScriptFile(final String srcAttribute)
         throws FailingHttpStatusCodeException {
 
         final WebClient client = getWebClient();
@@ -980,7 +979,7 @@
 
         final Object script;
         try {
-            script = loadJavaScriptFromUrl(scriptURL, charset);
+            script = loadJavaScriptFromUrl(scriptURL);
         }
         catch (final IOException e) {
             client.getJavaScriptErrorListener().loadScriptError(this, scriptURL, e);
@@ -1006,7 +1005,6 @@
      * there is a problem loading the code from the specified URL.
      *
      * @param url the URL of the script
-     * @param charset the charset to use to read the text
      * @return the content of the file, or {@code null} if we ran into a compile error
      * @throws IOException if there is a problem downloading the JavaScript file
      * @throws FailingHttpStatusCodeException if the request's status code indicates a request
@@ -1013,10 +1011,9 @@
      *         failure and the {@link WebClient} was configured to throw exceptions on failing
      *         HTTP status codes
      */
-    private Object loadJavaScriptFromUrl(final URL url, final Charset charset) throws IOException,
+    private Object loadJavaScriptFromUrl(final URL url) throws IOException,
         FailingHttpStatusCodeException {
 
-        Charset scriptEncoding = charset;
         final Charset pageEncoding = getCharset();
         final WebRequest referringRequest = getWebResponse().getWebRequest();
 
@@ -1069,18 +1066,17 @@
             }
         }
 
-        if (scriptEncoding == null) {
-            final Charset contentCharset = response.getContentCharset();
-            if (!contentCharset.equals(ISO_8859_1)) {
-                scriptEncoding = contentCharset;
-            }
-            else if (!pageEncoding.equals(ISO_8859_1)) {
-                scriptEncoding = pageEncoding;
-            }
-            else {
-                scriptEncoding = ISO_8859_1;
-            }
+        final Charset scriptEncoding;
+        final Charset contentCharset = response.getContentCharset();
+        if (!contentCharset.equals(ISO_8859_1)) {
+            scriptEncoding = contentCharset;
         }
+        else if (!pageEncoding.equals(ISO_8859_1)) {
+            scriptEncoding = pageEncoding;
+        }
+        else {
+            scriptEncoding = ISO_8859_1;
+        }
 
         final String scriptCode = response.getContentAsString(scriptEncoding);
         if (null != scriptCode) {

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2017-05-14 07:08:22 UTC (rev 14451)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/HtmlScript.java 2017-05-14 07:59:08 UTC (rev 14452)
@@ -371,7 +371,7 @@
                 }
                 try {
                     executed_ = true;
-                    final JavaScriptLoadResult result = page.loadExternalJavaScriptFile(src, null);
+                    final JavaScriptLoadResult result = page.loadExternalJavaScriptFile(src);
                     if (result == JavaScriptLoadResult.SUCCESS) {
                         executeEvent(Event.TYPE_LOAD);
                     }

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java 2017-05-14 07:08:22 UTC (rev 14451)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/html/ScriptElementSupport.java 2017-05-14 07:59:08 UTC (rev 14452)
@@ -137,7 +137,7 @@
                 try {
                     final ScriptElement scriptElement = (ScriptElement) element;
                     scriptElement.setExecuted(true);
-                    final JavaScriptLoadResult result = page.loadExternalJavaScriptFile(src, null);
+                    final JavaScriptLoadResult result = page.loadExternalJavaScriptFile(src);
                     if (result == JavaScriptLoadResult.SUCCESS) {
                         executeEvent(element, Event.TYPE_LOAD);
                     }


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