diff --git a/src/changes/changes.xml b/src/changes/changes.xml index 28225213b0d..93f9043e0cf 100644 --- a/src/changes/changes.xml +++ b/src/changes/changes.xml @@ -8,6 +8,19 @@ + + Class org.htmlunit.javascript.preprocessor.HtmxOneNineTenScriptPreProcessor removed. + This class is no longer required because default parameter support was added to core-js. + + + core-js: Support for default parameters added. + + + core-js: String.isWellFormed() and String.toWellFormed() added. + + + core-js: Support surrogate chars in JSON.stringify(). + Upgrade Apache commons-io to 2.17.0. diff --git a/src/main/java/org/htmlunit/javascript/preprocessor/HtmxOneNineTenScriptPreProcessor.java b/src/main/java/org/htmlunit/javascript/preprocessor/HtmxOneNineTenScriptPreProcessor.java deleted file mode 100644 index 39af25e7efd..00000000000 --- a/src/main/java/org/htmlunit/javascript/preprocessor/HtmxOneNineTenScriptPreProcessor.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2002-2024 Gargoyle Software Inc. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.htmlunit.javascript.preprocessor; - -import org.apache.commons.lang3.StringUtils; -import org.htmlunit.ScriptPreProcessor; -import org.htmlunit.html.HtmlElement; -import org.htmlunit.html.HtmlPage; - -/** - * PreProzessor to fix one default parameter method. - * - * @author Ronald Brill - */ -public class HtmxOneNineTenScriptPreProcessor implements ScriptPreProcessor { - - private final ScriptPreProcessor nextScriptPreProcessor_; - - public HtmxOneNineTenScriptPreProcessor() { - nextScriptPreProcessor_ = null; - } - - public HtmxOneNineTenScriptPreProcessor(final ScriptPreProcessor nextScriptPreProcessor) { - nextScriptPreProcessor_ = nextScriptPreProcessor; - } - - @Override - public String preProcess(final HtmlPage htmlPage, final String sourceCode, final String sourceName, - final int lineNumber, final HtmlElement htmlElement) { - - String patchedSourceCode = sourceCode; - - if (sourceName.contains("/htmx.js") && !sourceName.contains("/htmx.js#")) { - patchedSourceCode = StringUtils.replace( - sourceCode, - "function makeTagRegEx(tag, global = false) {", - "function makeTagRegEx(tag) {\n" - + " " - + "var global = arguments.length > 1 && arguments[1] !== undefined " - + "? arguments[1] : false;\n"); - } - else if (sourceName.contains("/htmx.min.js") && !sourceName.contains("/htmx.min.js#")) { - patchedSourceCode = StringUtils.replace( - sourceCode, - "function e(e,t=false){", - "function e(e){" - + "var t = arguments.length > 1 && arguments[1] !== undefined " - + "? arguments[1] : false; "); - } - - if (nextScriptPreProcessor_ != null) { - return nextScriptPreProcessor_.preProcess(htmlPage, patchedSourceCode, sourceName, lineNumber, htmlElement); - } - - return patchedSourceCode; - } -} diff --git a/src/test/java/org/htmlunit/libraries/HtmxTest1x9x10.java b/src/test/java/org/htmlunit/libraries/HtmxTest1x9x10.java index acb715e5d86..65a164bf936 100644 --- a/src/test/java/org/htmlunit/libraries/HtmxTest1x9x10.java +++ b/src/test/java/org/htmlunit/libraries/HtmxTest1x9x10.java @@ -15,7 +15,6 @@ package org.htmlunit.libraries; import org.htmlunit.WebClient; -import org.htmlunit.javascript.preprocessor.HtmxOneNineTenScriptPreProcessor; import org.htmlunit.junit.BrowserRunner; import org.htmlunit.junit.BrowserRunner.Alerts; import org.htmlunit.junit.BrowserRunner.BuggyWebDriver; @@ -44,7 +43,7 @@ public void htmx() throws Exception { protected void setupWebClient(final WebClient webClient) { super.setupWebClient(webClient); - webClient.setScriptPreProcessor(new HtmxOneNineTenScriptPreProcessor()); + // there is a script error in sse.js (line 32) webClient.getOptions().setThrowExceptionOnScriptError(false); } } diff --git a/src/test/java/org/htmlunit/libraries/HtmxTest1x9x12.java b/src/test/java/org/htmlunit/libraries/HtmxTest1x9x12.java index df47567a622..a9fa7f7704d 100644 --- a/src/test/java/org/htmlunit/libraries/HtmxTest1x9x12.java +++ b/src/test/java/org/htmlunit/libraries/HtmxTest1x9x12.java @@ -14,8 +14,6 @@ */ package org.htmlunit.libraries; -import org.htmlunit.WebClient; -import org.htmlunit.javascript.preprocessor.HtmxOneNineTenScriptPreProcessor; import org.htmlunit.junit.BrowserRunner; import org.htmlunit.junit.BrowserRunner.Alerts; import org.htmlunit.junit.BrowserRunner.BuggyWebDriver; @@ -39,11 +37,4 @@ public class HtmxTest1x9x12 extends HtmxTest { public void htmx() throws Exception { htmx("htmx-1.9.12"); } - - @Override - protected void setupWebClient(final WebClient webClient) { - super.setupWebClient(webClient); - - webClient.setScriptPreProcessor(new HtmxOneNineTenScriptPreProcessor()); - } } diff --git a/src/test/java/org/htmlunit/libraries/HtmxTest2x0x0.java b/src/test/java/org/htmlunit/libraries/HtmxTest2x0x0.java index ab57eabc47b..0dfeac2873b 100644 --- a/src/test/java/org/htmlunit/libraries/HtmxTest2x0x0.java +++ b/src/test/java/org/htmlunit/libraries/HtmxTest2x0x0.java @@ -14,8 +14,6 @@ */ package org.htmlunit.libraries; -import org.htmlunit.WebClient; -import org.htmlunit.javascript.preprocessor.HtmxOneNineTenScriptPreProcessor; import org.htmlunit.junit.BrowserRunner; import org.htmlunit.junit.BrowserRunner.Alerts; import org.htmlunit.junit.BrowserRunner.HtmlUnitNYI; @@ -43,11 +41,4 @@ public class HtmxTest2x0x0 extends HtmxTest { public void htmx() throws Exception { htmx("htmx-2.0.0"); } - - @Override - protected void setupWebClient(final WebClient webClient) { - super.setupWebClient(webClient); - - webClient.setScriptPreProcessor(new HtmxOneNineTenScriptPreProcessor()); - } } diff --git a/src/test/java/org/htmlunit/libraries/HtmxTest2x0x2.java b/src/test/java/org/htmlunit/libraries/HtmxTest2x0x2.java index 034a8b5fe8f..0839c0a73e6 100644 --- a/src/test/java/org/htmlunit/libraries/HtmxTest2x0x2.java +++ b/src/test/java/org/htmlunit/libraries/HtmxTest2x0x2.java @@ -14,8 +14,6 @@ */ package org.htmlunit.libraries; -import org.htmlunit.WebClient; -import org.htmlunit.javascript.preprocessor.HtmxOneNineTenScriptPreProcessor; import org.htmlunit.junit.BrowserRunner; import org.htmlunit.junit.BrowserRunner.Alerts; import org.htmlunit.junit.BrowserRunner.HtmlUnitNYI; @@ -43,11 +41,4 @@ public class HtmxTest2x0x2 extends HtmxTest { public void htmx() throws Exception { htmx("htmx-2.0.2"); } - - @Override - protected void setupWebClient(final WebClient webClient) { - super.setupWebClient(webClient); - - webClient.setScriptPreProcessor(new HtmxOneNineTenScriptPreProcessor()); - } }