From 62f7cc179ba85cd43bfc8152dde41591241e18b0 Mon Sep 17 00:00:00 2001 From: Ronald Brill Date: Mon, 20 Nov 2023 12:02:59 +0100 Subject: [PATCH] next try --- .../javascript/HtmlUnitContextFactory.java | 5 ++- .../javascript/HtmlUnitWrapFactory.java | 36 ------------------- 2 files changed, 2 insertions(+), 39 deletions(-) delete mode 100644 src/main/java/org/htmlunit/javascript/HtmlUnitWrapFactory.java diff --git a/src/main/java/org/htmlunit/javascript/HtmlUnitContextFactory.java b/src/main/java/org/htmlunit/javascript/HtmlUnitContextFactory.java index cedadd09ae5..0bc1e7ef694 100644 --- a/src/main/java/org/htmlunit/javascript/HtmlUnitContextFactory.java +++ b/src/main/java/org/htmlunit/javascript/HtmlUnitContextFactory.java @@ -37,7 +37,6 @@ import org.htmlunit.corejs.javascript.Script; import org.htmlunit.corejs.javascript.ScriptRuntime; import org.htmlunit.corejs.javascript.Scriptable; -import org.htmlunit.corejs.javascript.WrapFactory; import org.htmlunit.corejs.javascript.debug.Debugger; import org.htmlunit.html.HtmlElement; import org.htmlunit.html.HtmlPage; @@ -60,7 +59,6 @@ public class HtmlUnitContextFactory extends ContextFactory { private final BrowserVersion browserVersion_; private long timeout_; private Debugger debugger_; - private final WrapFactory wrapFactory_ = new HtmlUnitWrapFactory(); private boolean deminifyFunctionCode_; /** @@ -293,7 +291,8 @@ protected Context makeContext() { cx.setInstructionObserverThreshold(INSTRUCTION_COUNT_THRESHOLD); cx.setErrorReporter(new HtmlUnitErrorReporter(webClient_.getJavaScriptErrorListener())); - cx.setWrapFactory(wrapFactory_); + // We don't want to wrap String & Co. + cx.getWrapFactory().setJavaPrimitiveWrap(false); if (debugger_ != null) { cx.setDebugger(debugger_, null); diff --git a/src/main/java/org/htmlunit/javascript/HtmlUnitWrapFactory.java b/src/main/java/org/htmlunit/javascript/HtmlUnitWrapFactory.java deleted file mode 100644 index 41073cb499f..00000000000 --- a/src/main/java/org/htmlunit/javascript/HtmlUnitWrapFactory.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2002-2023 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; - -import java.io.Serializable; - -import org.htmlunit.corejs.javascript.Scriptable; -import org.htmlunit.corejs.javascript.WrapFactory; - -/** - * Called by Rhino to Wrap Object as {@link Scriptable}. - * - * @author Marc Guillemot - * @author Ronald Brill - */ -public class HtmlUnitWrapFactory extends WrapFactory implements Serializable { - - /** - * Constructor. - */ - public HtmlUnitWrapFactory() { - setJavaPrimitiveWrap(false); // We don't want to wrap String & Co. - } -}