Skip to content

Commit 6d04db0

Browse files
committed
scope handling fix (wip)
1 parent e3cc9e4 commit 6d04db0

6 files changed

Lines changed: 10 additions & 8 deletions

File tree

src/main/java/org/htmlunit/javascript/FunctionWrapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ public VarScope getParentScope() {
190190
* {@inheritDoc}
191191
*/
192192
@Override
193-
public void setParentScope(final Scriptable scope) {
193+
public void setParentScope(final VarScope scope) {
194194
wrapped_.setParentScope(scope);
195195
}
196196

src/main/java/org/htmlunit/javascript/HtmlUnitScriptable.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public void setClassName(final String className) {
9494
* {@inheritDoc}
9595
*/
9696
@Override
97-
public void setParentScope(final Scriptable scope) {
97+
public void setParentScope(final VarScope scope) {
9898
if (scope == this) {
9999
throw new IllegalArgumentException("Object can't be its own parentScope");
100100
}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
import org.htmlunit.corejs.javascript.NativeObject;
4040
import org.htmlunit.corejs.javascript.Scriptable;
4141
import org.htmlunit.corejs.javascript.ScriptableObject;
42+
import org.htmlunit.corejs.javascript.TopLevel;
4243
import org.htmlunit.corejs.javascript.VarScope;
4344
import org.htmlunit.corejs.javascript.WithScope;
4445
import org.htmlunit.css.ComputedCssStyleDeclaration;
@@ -662,7 +663,7 @@ public HTMLCollection getElementsByClassName(final String className) {
662663
*/
663664
@JsxFunction
664665
public DOMRectList getClientRects() {
665-
final Scriptable topScope = getTopLevelScope(getParentScope());
666+
final TopLevel topScope = getTopLevelScope(getParentScope());
666667
final DOMRectList rectList = new DOMRectList();
667668
rectList.setParentScope(topScope);
668669
rectList.setPrototype(getPrototype(rectList.getClass()));

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
package org.htmlunit.javascript.host;
1616

1717
import org.htmlunit.WebWindow;
18-
import org.htmlunit.corejs.javascript.Scriptable;
18+
import org.htmlunit.corejs.javascript.VarScope;
1919
import org.htmlunit.javascript.HtmlUnitScriptableProxy;
2020

2121
/**
@@ -50,7 +50,7 @@ public Window getDelegee() {
5050
* @param parent the new parent scope
5151
*/
5252
@Override
53-
public void setParentScope(final Scriptable parent) {
53+
public void setParentScope(final VarScope parent) {
5454
// nothing as the window is the top level scope and its parent scope should stay null
5555
}
5656
}

src/main/java/org/htmlunit/javascript/host/css/CSSStyleSheet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import org.apache.commons.logging.Log;
2323
import org.apache.commons.logging.LogFactory;
24-
import org.htmlunit.corejs.javascript.Scriptable;
24+
import org.htmlunit.corejs.javascript.VarScope;
2525
import org.htmlunit.css.CssStyleSheet;
2626
import org.htmlunit.cssparser.dom.AbstractCSSRuleImpl;
2727
import org.htmlunit.cssparser.dom.CSSCharsetRuleImpl;
@@ -121,7 +121,7 @@ public CSSStyleSheet(final HTMLElement element, final String styleSheet, final S
121121
* @param parentScope the parent scope
122122
* @param cssStyleSheet the CSS stylesheet which this stylesheet host object represents
123123
*/
124-
public CSSStyleSheet(final HTMLElement element, final Scriptable parentScope,
124+
public CSSStyleSheet(final HTMLElement element, final VarScope parentScope,
125125
final CssStyleSheet cssStyleSheet) {
126126
super(element);
127127

src/main/java/org/htmlunit/javascript/host/file/FileList.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import java.util.ArrayList;
1818

1919
import org.htmlunit.corejs.javascript.Scriptable;
20+
import org.htmlunit.corejs.javascript.VarScope;
2021
import org.htmlunit.javascript.HtmlUnitScriptable;
2122
import org.htmlunit.javascript.JavaScriptEngine;
2223
import org.htmlunit.javascript.configuration.JsxClass;
@@ -77,7 +78,7 @@ public void updateFiles(final ArrayList<File> files) {
7778
* {@inheritDoc}
7879
*/
7980
@Override
80-
public void setParentScope(final Scriptable scope) {
81+
public void setParentScope(final VarScope scope) {
8182
super.setParentScope(scope);
8283
if (files_ != null) {
8384
for (final File file : files_) {

0 commit comments

Comments
 (0)