Skip to content

Commit fe12245

Browse files
committed
scope handling fix (wip)
1 parent 212ab17 commit fe12245

5 files changed

Lines changed: 12 additions & 10 deletions

File tree

src/main/java/org/htmlunit/WebConsole.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
import org.htmlunit.corejs.javascript.NativeConsole.ConsolePrinter;
2626
import org.htmlunit.corejs.javascript.NativeConsole.Level;
2727
import org.htmlunit.corejs.javascript.ScriptStackElement;
28-
import org.htmlunit.corejs.javascript.Scriptable;
28+
import org.htmlunit.corejs.javascript.VarScope;
2929

3030
/**
3131
* This class can be used to print messages to the logger. The first parameter
@@ -157,7 +157,7 @@ public Logger getLogger() {
157157
}
158158

159159
@Override
160-
public void print(final Context cx, final Scriptable scope, final Level level,
160+
public void print(final Context cx, final VarScope scope, final Level level,
161161
final Object[] args, final ScriptStackElement[] stack) {
162162
switch (level) {
163163
case TRACE:
@@ -205,7 +205,7 @@ public void print(final Context cx, final Scriptable scope, final Level level,
205205
}
206206
}
207207

208-
private static String format(final Context cx, final Scriptable scope, final Object[] args) {
208+
private static String format(final Context cx, final VarScope scope, final Object[] args) {
209209
String msg = NativeConsole.format(cx, scope, args);
210210
msg = msg.replaceAll("\\r?\\n", "\n");
211211
return msg;

src/main/java/org/htmlunit/javascript/host/URLSearchParams.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ public String getClassName() {
118118
}
119119

120120
@Override
121-
protected boolean isDone(final Context cx, final Scriptable scope) {
121+
protected boolean isDone(final Context cx, final VarScope scope) {
122122
return !iterator_.hasNext();
123123
}
124124

125125
@Override
126-
protected Object nextValue(final Context cx, final Scriptable scope) {
126+
protected Object nextValue(final Context cx, final VarScope scope) {
127127
final NameValuePair e = iterator_.next();
128128
return switch (type_) {
129129
case KEYS -> e.getName();

src/main/java/org/htmlunit/javascript/host/dom/AbstractList.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
import org.htmlunit.corejs.javascript.ExternalArrayData;
2727
import org.htmlunit.corejs.javascript.Scriptable;
28+
import org.htmlunit.corejs.javascript.VarScope;
2829
import org.htmlunit.html.DomChangeEvent;
2930
import org.htmlunit.html.DomChangeListener;
3031
import org.htmlunit.html.DomElement;
@@ -471,7 +472,7 @@ protected Scriptable getScriptableForElement(final Object object) {
471472
* {@inheritDoc}
472473
*/
473474
@Override
474-
public void defineProperty(final Scriptable scope,
475+
public void defineProperty(final VarScope scope,
475476
final String propertyName, final Object delegateTo,
476477
final Method getter, final Method setter, final int attributes) {
477478
// length is defined on the prototype, don't define it again

src/main/java/org/htmlunit/javascript/host/dom/NodeList.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public NodeList(final DomNode domNode, final List<DomNode> initialElements) {
8989
* Creates an instance.
9090
* @param parentScope the parent scope
9191
*/
92-
NodeList(final Scriptable parentScope) {
92+
NodeList(final VarScope parentScope) {
9393
super();
9494
setParentScope(parentScope);
9595
setPrototype(getPrototype(getClass()));
@@ -103,7 +103,7 @@ public NodeList(final DomNode domNode, final List<DomNode> initialElements) {
103103
* @param elements the elements
104104
* @return an empty collection
105105
*/
106-
public static NodeList staticNodeList(final Scriptable parentScope, final List<DomNode> elements) {
106+
public static NodeList staticNodeList(final VarScope parentScope, final List<DomNode> elements) {
107107
return new NodeList(parentScope) {
108108
@Override
109109
public List<DomNode> getElements() {

src/main/java/org/htmlunit/javascript/host/xml/FormData.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import org.htmlunit.corejs.javascript.Function;
2727
import org.htmlunit.corejs.javascript.Scriptable;
2828
import org.htmlunit.corejs.javascript.TopLevel;
29+
import org.htmlunit.corejs.javascript.VarScope;
2930
import org.htmlunit.javascript.HtmlUnitScriptable;
3031
import org.htmlunit.javascript.JavaScriptEngine;
3132
import org.htmlunit.javascript.configuration.JsxClass;
@@ -117,15 +118,15 @@ public String getClassName() {
117118
* {@inheritDoc}
118119
*/
119120
@Override
120-
protected boolean isDone(final Context cx, final Scriptable scope) {
121+
protected boolean isDone(final Context cx, final VarScope scope) {
121122
return index_ >= nameValuePairList_.size();
122123
}
123124

124125
/**
125126
* {@inheritDoc}
126127
*/
127128
@Override
128-
protected Object nextValue(final Context cx, final Scriptable scope) {
129+
protected Object nextValue(final Context cx, final VarScope scope) {
129130
if (isDone(cx, scope)) {
130131
return Context.getUndefinedValue();
131132
}

0 commit comments

Comments
 (0)