Skip to content

Commit

Permalink
use the class configuration from the cache
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jul 27, 2024
1 parent a94ee46 commit 4f6ca24
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import org.htmlunit.corejs.javascript.FunctionObject;
import org.htmlunit.corejs.javascript.Scriptable;
import org.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration;
import org.htmlunit.javascript.configuration.ClassConfiguration;
import org.htmlunit.javascript.configuration.ClassConfiguration.ConstantInfo;
import org.htmlunit.javascript.configuration.JavaScriptConfiguration;

/**
* A FunctionObject that returns IDs of this object and all its parent classes.
Expand Down Expand Up @@ -103,8 +103,8 @@ public Object get(final String name, final Scriptable start) {
Class<?> klass = getPrototypeProperty().getClass();

while (value == NOT_FOUND && HtmlUnitScriptable.class.isAssignableFrom(klass)) {
final ClassConfiguration config = AbstractJavaScriptConfiguration.getClassConfiguration(
klass.asSubclass(HtmlUnitScriptable.class), browserVersion_);
final ClassConfiguration config = JavaScriptConfiguration.getInstance(browserVersion_)
.getClassConfiguration(klass.getName());
if (config != null) {
final List<ConstantInfo> constants = config.getConstants();
if (constants != null) {
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/htmlunit/javascript/host/intl/Intl.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import org.htmlunit.javascript.HtmlUnitScriptable;
import org.htmlunit.javascript.JavaScriptEngine;
import org.htmlunit.javascript.RecursiveFunctionObject;
import org.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration;
import org.htmlunit.javascript.configuration.ClassConfiguration;
import org.htmlunit.javascript.configuration.JavaScriptConfiguration;

/**
* A JavaScript object for {@code Intl}.
Expand All @@ -47,7 +47,8 @@ public void defineProperties(final BrowserVersion browserVersion) {

private void define(final Class<? extends HtmlUnitScriptable> c, final BrowserVersion browserVersion) {
try {
final ClassConfiguration config = AbstractJavaScriptConfiguration.getClassConfiguration(c, browserVersion);
final ClassConfiguration config = JavaScriptConfiguration.getInstance(browserVersion)
.getClassConfiguration(c.getName());
final HtmlUnitScriptable prototype = JavaScriptEngine.configureClass(config, this);
final FunctionObject functionObject =
new RecursiveFunctionObject(config.getJsConstructor().getKey(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@
import org.htmlunit.javascript.RecursiveFunctionObject;
import org.htmlunit.javascript.background.BasicJavaScriptJob;
import org.htmlunit.javascript.background.JavaScriptJob;
import org.htmlunit.javascript.configuration.AbstractJavaScriptConfiguration;
import org.htmlunit.javascript.configuration.ClassConfiguration;
import org.htmlunit.javascript.configuration.JavaScriptConfiguration;
import org.htmlunit.javascript.configuration.JsxClass;
import org.htmlunit.javascript.configuration.JsxConstructor;
import org.htmlunit.javascript.configuration.JsxFunction;
Expand Down Expand Up @@ -121,13 +121,12 @@ public void jsConstructor() {
context.initSafeStandardObjects(this);
JavaScriptEngine.configureRhino(webClient, browserVersion, this);

ClassConfiguration config = AbstractJavaScriptConfiguration.getClassConfiguration(
(Class<? extends HtmlUnitScriptable>) DedicatedWorkerGlobalScope.class.getSuperclass(),
browserVersion);
final JavaScriptConfiguration jsConfig = JavaScriptConfiguration.getInstance(browserVersion);
ClassConfiguration config =
jsConfig.getClassConfiguration(DedicatedWorkerGlobalScope.class.getSuperclass().getName());
final HtmlUnitScriptable parentPrototype = JavaScriptEngine.configureClass(config, this);

config = AbstractJavaScriptConfiguration.getClassConfiguration(
DedicatedWorkerGlobalScope.class, browserVersion);
config = jsConfig.getClassConfiguration(DedicatedWorkerGlobalScope.class.getName());
final HtmlUnitScriptable prototype = JavaScriptEngine.configureClass(config, this);
prototype.setPrototype(parentPrototype);
setPrototype(prototype);
Expand Down

0 comments on commit 4f6ca24

Please sign in to comment.