Skip to content

Commit e057da0

Browse files
committed
scope handling fix (wip)
1 parent 955b81b commit e057da0

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/main/java/org/htmlunit/javascript/host/canvas/ImageData.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public static ImageData jsConstructor(final Context cx, final VarScope scope,
7272
data = array;
7373
if (data.getArrayLength() % 4 != 0) {
7474
throw JavaScriptEngine.asJavaScriptException(
75-
(HtmlUnitScriptable) JavaScriptEngine.getTopCallScope().getGlobalThis(),
75+
(HtmlUnitScriptable) getTopLevelScope(scope).getGlobalThis(),
7676
"ImageData ctor - data length mod 4 not zero",
7777
DOMException.INVALID_STATE_ERR);
7878
}
@@ -83,7 +83,7 @@ public static ImageData jsConstructor(final Context cx, final VarScope scope,
8383

8484
if (data.getArrayLength() != 4 * width * height) {
8585
throw JavaScriptEngine.asJavaScriptException(
86-
(HtmlUnitScriptable) JavaScriptEngine.getTopCallScope().getGlobalThis(),
86+
(HtmlUnitScriptable) getTopLevelScope(scope).getGlobalThis(),
8787
"ImageData ctor - width not correct",
8888
DOMException.INDEX_SIZE_ERR);
8989
}
@@ -94,7 +94,7 @@ public static ImageData jsConstructor(final Context cx, final VarScope scope,
9494

9595
if (data.getArrayLength() != 4 * width * height) {
9696
throw JavaScriptEngine.asJavaScriptException(
97-
(HtmlUnitScriptable) JavaScriptEngine.getTopCallScope().getGlobalThis(),
97+
(HtmlUnitScriptable) getTopLevelScope(scope).getGlobalThis(),
9898
"ImageData ctor - width/height not correct",
9999
DOMException.INDEX_SIZE_ERR);
100100
}
@@ -106,13 +106,13 @@ public static ImageData jsConstructor(final Context cx, final VarScope scope,
106106

107107
if (width < 0) {
108108
throw JavaScriptEngine.asJavaScriptException(
109-
(HtmlUnitScriptable) JavaScriptEngine.getTopCallScope().getGlobalThis(),
109+
(HtmlUnitScriptable) getTopLevelScope(scope).getGlobalThis(),
110110
"ImageData ctor - width negative",
111111
DOMException.INDEX_SIZE_ERR);
112112
}
113113
if (height < 0) {
114114
throw JavaScriptEngine.asJavaScriptException(
115-
(HtmlUnitScriptable) JavaScriptEngine.getTopCallScope().getGlobalThis(),
115+
(HtmlUnitScriptable) getTopLevelScope(scope).getGlobalThis(),
116116
"ImageData ctor - height negative",
117117
DOMException.INDEX_SIZE_ERR);
118118
}

0 commit comments

Comments
 (0)